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
84
Issues
84
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
32f139b5
Commit
32f139b5
authored
Jul 10, 2015
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'adam-led'
Improve LED signaling
parents
a374bd52
279dd8a2
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
157 additions
and
17 deletions
+157
-17
wrs-user-manual.in
doc/wrs-user-manual.in
+34
-0
i2c_sfp.c
userspace/libwr/i2c_sfp.c
+6
-6
sfp_lib.h
userspace/libwr/include/libwr/sfp_lib.h
+7
-8
wrs_status_led.sh
userspace/rootfs_override/etc/init.d/wrs_status_led.sh
+5
-0
K70hald.sh
userspace/rootfs_override/etc/rcS/K70hald.sh
+1
-0
K80wrs_status_led.sh
userspace/rootfs_override/etc/rcS/K80wrs_status_led.sh
+1
-0
Makefile
userspace/tools/Makefile
+2
-0
wrs_status_led.c
userspace/tools/wrs_status_led.c
+88
-0
hal_ports.c
userspace/wrsw_hal/hal_ports.c
+13
-3
No files found.
doc/wrs-user-manual.in
View file @
32f139b5
...
...
@@ -724,6 +724,40 @@ split of the measured value is equally right). Other transceiver
types can be calibrated to either positive or negative values, to cope
with the @i
{
difference
}
between them and the @t
{
AXGE
}
devices.
@c ==========================================================================
@node Front panel's LEDs
@section Front panel's LEDs
There are two LEDs on front panel describing switch's status and two LEDs for
each switch's port. Each LED can be off, light with green or orange color, or
combination of both giving yellow.
For more details please refer to following subsections.
@c =-------------------------------------------------------------------------
@node Status LEDs
@subsection Status LEDs
The status LED is placed together with power indicator LED on the left side of
switch's front panel. The status LED is the right one.
During barebox/kernel boot the status LED is off. When startup-mb.sh starts
the LED is set to yellow. If the HAL starts successfully then the LED is set to
green. If the HAL caught a SIGNAL sent by other process, HAL sets the status
LED to orange.
When reboot is performed status LED is turned off.
@c =-------------------------------------------------------------------------
@node Ports' LEDs
@subsection Ports' LEDs
Under each switch's port there are two LEDs. The left LED is on when particular
port is populated with a SFP and the link is up. It's color is dependent on
the configured function. For ports configured as a slave the LED is green, for
non-wr ports the LED is orange. For ports configured as a master and other
cases (including wrong configuration) the left LED is yellow.
The right LED blinks when packet is transmitted or received on a port.
@c ############################################################################
@node Booting with Barebox
@chapter Booting with Barebox
...
...
userspace/libwr/i2c_sfp.c
View file @
32f139b5
...
...
@@ -411,13 +411,13 @@ void shw_sfp_gpio_init(void)
for
(
i
=
0
;
i
<
18
;
i
++
)
{
shw_sfp_set_led_synced
(
i
,
1
);
shw_udelay
(
7000
);
shw_sfp_set_
led_link
(
i
,
1
);
shw_sfp_set_
generic
(
i
,
1
,
SFP_LED_WRMODE_MASTER
);
shw_udelay
(
7000
);
}
for
(
i
=
0
;
i
<
18
;
i
++
)
{
shw_sfp_set_led_synced
(
i
,
0
);
shw_udelay
(
7000
);
shw_sfp_set_
led_link
(
i
,
0
);
shw_sfp_set_
generic
(
i
,
0
,
SFP_LED_WRMODE_MASTER
);
shw_udelay
(
7000
);
}
...
...
@@ -457,9 +457,9 @@ void shw_sfp_gpio_set(int num, uint8_t state)
else
curr
&=
0xf0
;
if
(
state
&
SFP_LED_
LINK
)
if
(
state
&
SFP_LED_
WRMODE1
)
curr
|=
SFP_LED_LINK_MASK
(
top
);
if
(
state
&
SFP_LED_WRMODE
)
if
(
state
&
SFP_LED_WRMODE
2
)
curr
|=
SFP_LED_WRMODE_MASK
(
top
);
if
(
state
&
SFP_LED_SYNCED
)
curr
|=
SFP_LED_SYNCED_MASK
(
top
);
...
...
@@ -500,9 +500,9 @@ uint8_t shw_sfp_gpio_get(int num)
i2c_transfer
(
bus
,
addr
,
0
,
1
,
&
curr
);
if
(
curr
&
SFP_LED_LINK_MASK
(
top
))
out
|=
SFP_LED_
LINK
;
out
|=
SFP_LED_
WRMODE1
;
if
(
curr
&
SFP_LED_WRMODE_MASK
(
top
))
out
|=
SFP_LED_WRMODE
;
out
|=
SFP_LED_WRMODE
2
;
if
(
curr
&
SFP_LED_SYNCED_MASK
(
top
))
out
|=
SFP_LED_SYNCED
;
if
(
curr
&
SFP_TX_DISABLE_MASK
(
top
))
...
...
userspace/libwr/include/libwr/sfp_lib.h
View file @
32f139b5
#ifndef __LIBWR_SHW_SFPLIB_H
#define __LIBWR_SHW_SFPLIB_H
#define SFP_LED_LINK (1 << 0)
#define SFP_LED_WRMODE (1 << 1)
/* note each led contains green and orange part */
#define SFP_LED_WRMODE_SLAVE (1)
/* green */
#define SFP_LED_WRMODE_NON_WR (2)
/* orange */
#define SFP_LED_WRMODE_MASTER (3)
/* yellow */
#define SFP_LED_WRMODE_OFF (3)
/* to off entire WRMODE LED */
#define SFP_LED_WRMODE1 (1 << 0)
#define SFP_LED_WRMODE2 (1 << 1)
#define SFP_LED_SYNCED (1 << 2)
#define SFP_TX_DISABLE (1 << 3)
#define shw_sfp_set_led_link(num, status) \
shw_sfp_set_generic(num, status, SFP_LED_LINK)
#define shw_sfp_set_led_wrmode(num, status) \
shw_sfp_set_generic(num, status, SFP_LED_WRMODE)
#define shw_sfp_set_led_synced(num, status) \
shw_sfp_set_generic(num, status, SFP_LED_SYNCED)
...
...
userspace/rootfs_override/etc/init.d/wrs_status_led.sh
0 → 100755
View file @
32f139b5
#!/bin/sh
# turn off status led at reboot
/wr/bin/wrs_status_led
-x
userspace/rootfs_override/etc/rcS/K70hald.sh
0 → 120000
View file @
32f139b5
../init.d/hald.sh
\ No newline at end of file
userspace/rootfs_override/etc/rcS/K80wrs_status_led.sh
0 → 120000
View file @
32f139b5
../init.d/wrs_status_led.sh
\ No newline at end of file
userspace/tools/Makefile
View file @
32f139b5
...
...
@@ -6,6 +6,8 @@ TOOLS += sdb-read
TOOLS
+=
nbtee
TOOLS
+=
wrs_auxclk
TOOLS
+=
wrs_checkcfg
TOOLS
+=
wrs_status_led
PPSI_CONFIG
=
../ppsi/include/generated/autoconf.h
WR_INSTALL_ROOT
?=
/usr/lib/white-rabbit
...
...
userspace/tools/wrs_status_led.c
0 → 100644
View file @
32f139b5
/*
* wrs_status_led.c
*
* Turn on/off and change color of status LED
*
* Created on: July 9, 2015
* Authors:
* - Adam Wujek
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License...
*/
#include <stdlib.h>
#include <getopt.h>
#include <libwr/shw_io.h>
#include <libwr/wrs-msg.h>
#ifndef __GIT_VER__
#define __GIT_VER__ "x.x"
#endif
#ifndef __GIT_USR__
#define __GIT_USR__ "?"
#endif
void
help
(
const
char
*
pgrname
)
{
printf
(
"wrs_status_led. Commit %s, built on "
__DATE__
"
\n
"
,
__GIT_VER__
);
printf
(
"usage: %s <command>
\n
"
,
pgrname
);
printf
(
"available commands are:
\n
"
" -x turn off status led
\n
"
" -h this help
\n
"
"
\n
"
);
exit
(
1
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
opt
;
/* argc forced to 1: -t and -v are not "terse" and "verbose" */
wrs_msg_init
(
1
,
argv
);
assert_init
(
shw_pio_mmap_init
());
shw_io_init
();
shw_io_configure_all
();
while
((
opt
=
getopt
(
argc
,
argv
,
"yxhqv"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'x'
:
shw_io_write
(
shw_io_led_state_o
,
0
);
shw_io_write
(
shw_io_led_state_g
,
0
);
break
;
case
'y'
:
shw_io_write
(
shw_io_led_state_o
,
1
);
shw_io_write
(
shw_io_led_state_g
,
1
);
break
;
case
'h'
:
help
(
argv
[
0
]);
exit
(
0
);
break
;
case
'q'
:
break
;
/* done in wrs_msg_init() */
case
'v'
:
break
;
/* done in wrs_msg_init() */
default:
fprintf
(
stderr
,
"Unrecognized option. Call %s -h for help.
\n
"
,
argv
[
0
]);
exit
(
1
);
}
}
return
0
;
}
userspace/wrsw_hal/hal_ports.c
View file @
32f139b5
...
...
@@ -327,7 +327,8 @@ static int hal_port_link_down(struct hal_port_state * p, int link_up)
rts_set_mode
(
RTS_MODE_GM_FREERUNNING
);
}
shw_sfp_set_led_link
(
p
->
hw_index
,
0
);
/* turn off link/wrmode LEDs */
shw_sfp_set_generic
(
p
->
hw_index
,
0
,
SFP_LED_WRMODE_OFF
);
p
->
state
=
HAL_PORT_STATE_LINK_DOWN
;
hal_port_reset_state
(
p
);
...
...
@@ -380,8 +381,17 @@ static void hal_port_fsm(struct hal_port_state * p)
p
->
tx_cal_pending
=
0
;
p
->
rx_cal_pending
=
0
;
shw_sfp_set_led_link
(
p
->
hw_index
,
1
);
/* set link/wrmode LEDs */
if
(
p
->
mode
==
HEXP_PORT_MODE_WR_SLAVE
)
{
/* slave */
shw_sfp_set_generic
(
p
->
hw_index
,
1
,
SFP_LED_WRMODE_SLAVE
);
}
else
if
(
p
->
mode
==
HEXP_PORT_MODE_NON_WR
)
{
/* non-wr */
shw_sfp_set_generic
(
p
->
hw_index
,
1
,
SFP_LED_WRMODE_NON_WR
);
}
else
{
/* master or other */
shw_sfp_set_generic
(
p
->
hw_index
,
1
,
SFP_LED_WRMODE_MASTER
);
}
pr_info
(
"%s: link up
\n
"
,
p
->
name
);
p
->
state
=
HAL_PORT_STATE_UP
;
}
...
...
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