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
a0e412f1
Commit
a0e412f1
authored
Aug 23, 2017
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch "www"
parents
607129b7
77170df3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
11436 additions
and
251 deletions
+11436
-251
Makefile
doc/startup-guide/Makefile
+2
-1
pandoc.latex
doc/startup-guide/pandoc.latex
+4
-0
wrs-startup_guide.md
doc/startup-guide/wrs-startup_guide.md
+66
-26
style.css
userspace/rootfs_override/var/www/css/style.css
+13
-3
wrs-data.php
userspace/rootfs_override/var/www/data/wrs-data.php
+63
-31
wrs-info-generator.php
...space/rootfs_override/var/www/data/wrs-info-generator.php
+22
-12
deletesfp.php
userspace/rootfs_override/var/www/deletesfp.php
+1
-1
endpointconfiguration.php
userspace/rootfs_override/var/www/endpointconfiguration.php
+16
-25
endpointmode.php
userspace/rootfs_override/var/www/endpointmode.php
+34
-4
fiberconfiguration.php
userspace/rootfs_override/var/www/fiberconfiguration.php
+72
-0
footer.php
userspace/rootfs_override/var/www/footer.php
+5
-1
functions.php
userspace/rootfs_override/var/www/functions.php
+238
-67
functionsget.php
userspace/rootfs_override/var/www/functionsget.php
+60
-0
getinfo.php
userspace/rootfs_override/var/www/getinfo.php
+22
-0
getwrstatus.php
userspace/rootfs_override/var/www/getwrstatus.php
+22
-0
head.php
userspace/rootfs_override/var/www/head.php
+3
-1
dropmodes.js
userspace/rootfs_override/var/www/js/dropmodes.js
+33
-0
func.js
userspace/rootfs_override/var/www/js/func.js
+31
-0
jquery-1.10.1.min.js
userspace/rootfs_override/var/www/js/jquery-1.10.1.min.js
+0
-6
jquery-3.1.1.js
userspace/rootfs_override/var/www/js/jquery-3.1.1.js
+10220
-0
jquery-3.1.1.min.js
userspace/rootfs_override/var/www/js/jquery-3.1.1.min.js
+4
-0
loadinfo.js
userspace/rootfs_override/var/www/js/loadinfo.js
+59
-0
loadwrinfo.js
userspace/rootfs_override/var/www/js/loadwrinfo.js
+130
-0
scripts.js
userspace/rootfs_override/var/www/js/scripts.js
+23
-18
json.php
userspace/rootfs_override/var/www/json.php
+73
-0
menu.php
userspace/rootfs_override/var/www/menu.php
+6
-3
modifymode.php
userspace/rootfs_override/var/www/modifymode.php
+8
-21
reset.php
userspace/rootfs_override/var/www/reset.php
+67
-0
sfpconfiguration.php
userspace/rootfs_override/var/www/sfpconfiguration.php
+13
-11
sysinfo.php
userspace/rootfs_override/var/www/sysinfo.php
+28
-2
wrinfo.php
userspace/rootfs_override/var/www/wrinfo.php
+38
-0
wr_mon.c
userspace/tools/wr_mon.c
+60
-18
No files found.
doc/startup-guide/Makefile
View file @
a0e412f1
...
...
@@ -24,7 +24,8 @@ TEX=$(SRC:.md=.tex)
DOC
=
$
(
SRC:.md
=
.doc
)
## Pandoc arguments
OPTIONS
=
-f
markdown
--toc
--number-sections
--smart
EXTENSIONS
=
+definition_lists
OPTIONS
=
-f
markdown
$(EXTENSIONS)
--toc
--number-sections
--smart
TEMPLATE
=
pandoc.latex
...
...
doc/startup-guide/pandoc.latex
View file @
a0e412f1
...
...
@@ -55,6 +55,10 @@
%% Generic
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
$if(url)$
\usepackage{url}
$endif$
...
...
doc/startup-guide/wrs-startup_guide.md
View file @
a0e412f1
...
...
@@ -83,6 +83,9 @@ conditions
1.
3 05/08/2014 Benoit Rat
\
Updating for v4.2 release
[
Seven Solutions
]
1.
4 15/05/2017 Benoit Rat
\
Updating for v5.0.1 release
[Seven Solutions]
------------------------------------------------------------------------
\c
learpage
...
...
@@ -92,32 +95,46 @@ conditions
DHCP
: The Dynamic Host Configuration Protocol to obtain network configuration.
FMC
: FPGA Mezzanine Card, an ANSI standard for mezzanine card form factor.
HDL
: Hardware description language.
LM32
: LatticeMico32 is a 32-bit microprocessor soft core optimized for field-programmable gate arrays (FPGAs).
NAND
: NAND Flash Memory, a type of reprogrammable non-volatile computer memory.
PCIe
: Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard.
PTP
: Precise Time Protocol, a time synchronization protocol.
SMC
: SubMiniature version C, coaxial connector used in radio-frequency circuits.
SFP
: Small form-factor pluggable transceiver, a hot-pluggable transceiver for optical fiber.
SPEC
: Simple PCIe FMC carrier.
SVEC
: Simple VME FMC carrier.
UART
: Universal Asynchronous Receiver/Transmitter.
WR
: White Rabbit.
WRS
: White Rabbit Switch.
WMI
: Web Management Interface
...
...
@@ -514,6 +531,21 @@ wait until the WRS has reboot.
> **Notes**: A NTP server should be provided for the grandmaster switch
so that we can distribute the current TAI seconds to the whole WR network
### Using menuconfig
Another way to modify the parameters to configure the
[
WRS
]
in Grandmaster is by
[
opening an SSH terminal
](
#login-via-ssh
)
and then run the command:
make -C /wr/etc/ menuconfig
You will get a menu to directly modify the
`dot-config`
but with a more friendly
[
^termdisplay
]
interface.
Then just go to
`Timing Mode`
, select
`Grand-Master`
,
`Save`
,
`Exit`
.
Your WRS is now ready to be in GM mode at next reboot.
[
^termdisplay
]:
With
some small terminal size, or while using minicom the ncurse interface does not behave well,
and the menuconfig is not properly displayed.
### By editing the dot-config file in a terminal
If you prefer to configure the
[
WRS
]
using a terminal you should open the
`dot-config`
file
...
...
@@ -541,7 +573,6 @@ CONFIG_TIME_GM=y
and finally you need to
`reboot`
the switch.
Non-DHCP user
---------------
...
...
@@ -742,6 +773,16 @@ Specification
| **DAC** | 2xAD5662BRJ (16bit; 2.7-5.54V) |
+--------------------+-------------------------------------------------+
+--------------------+-------------------------------------------------+
| ***SMC I/O *** | |
+====================+=================================================+
| **PPS input** | TTL Level (2-5V High); 0.4mA (50Ohm disabled |
| | by default) / 4.4mA (when 50Ohm enabled) |
+--------------------+-------------------------------------------------+
| **10MHz input** | 250mV (rms) @ 50Ohm -> ~1dB |
+--------------------+-------------------------------------------------+
+--------------------+-------------------------------------------------+
| ***Others*** | |
+====================+=================================================+
...
...
@@ -809,8 +850,7 @@ executing the following command:
~~~
~~{.bash}
#On the WRS
wrs_version > /tmp/bug_report.txt
rtu_stat >> /tmp/bug_report.txt
wrs_version -t > /tmp/bug_report.txt
dmesg >> /tmp/bug_report.txt
#Obtain the IP of the switch
...
...
@@ -830,7 +870,7 @@ Contact-Us
To contact Seven Solutions company please use:
*
<
info
@sevensols.com>
*
<
support
@sevensols.com>
*
(+34) 958 285 024
*
<http://www.sevensols.com>
...
...
@@ -861,15 +901,15 @@ Please be responsible and protect our environment.
References
==============
*
[
wrs-3/18.pdf
]
: Datasheet for the White Rabbit Switch v3 - 18 SFPs
*
[
wrs-user-manual.pdf
]
: User manual documentation of the tools.
*
[
wr_external_reference.pdf
]
: Connect the
[
WRS
]
in GrandMaster mode.
*
[
whiterabbitsolution
]
: White Rabbit as a complete timing solutions
*
[
WRS Wiki
]
: White Rabbit Switch Wiki on ohwr.org
*
[
WRS FAQ
]
: WR-Switch Frequently Added Questions
*
[
wr-switch-testing
]
: Project for testing the switch itself
*
[
SFPs Wiki
]
: Type of SFP supported by the
[
WRS
]
*
[
latest stable release
]
: http://www.sevensols.com/dl/wr-switch-sw/bin/latest_stable.tar.gz
*
[
wrs-3/18.pdf
]
: Datasheet for the White Rabbit Switch v3 - 18 SFPs
*
[
wrs-user-manual.pdf
]
: User manual documentation of the tools.
*
[
wr_external_reference.pdf
]
: Connect the
[
WRS
]
in GrandMaster mode.
*
[
whiterabbitsolution
]
: White Rabbit as a complete timing solutions
*
[
WRS Wiki
]
: White Rabbit Switch Wiki on ohwr.org
*
[
WRS FAQ
]
: WR-Switch Frequently Added Questions
*
[
wr-switch-testing
]
: Project for testing the switch itself
*
[
SFPs Wiki
]
: Type of SFP supported by the
[
WRS
]
*
[
latest stable release
]
:
`http://www.sevensols.com/dl/wr-switch-sw/bin/latest_stable.tar.gz`
<!-- List of links -->
...
...
userspace/rootfs_override/var/www/css/style.css
View file @
a0e412f1
...
...
@@ -308,6 +308,11 @@ table.altrowstablesmall input {
font-size
:
100%
;
}
#endpointconfig
table
.altrowstablesmall
input
{
width
:
45px
;
font-size
:
100%
;
}
table
.altrowstabledash
{
font-family
:
verdana
,
arial
,
sans-serif
;
font-size
:
11px
;
...
...
@@ -467,7 +472,12 @@ element.style {
}
.center
{
margin-left
:
auto
;
margin-right
:
auto
;
text-align
:
center
;
margin-left
:
auto
;
margin-right
:
auto
;
text-align
:
center
;
}
table
.fiberstable
td
{
width
:
auto
!important
;
}
userspace/rootfs_override/var/www/data/wrs-data.php
View file @
a0e412f1
...
...
@@ -19,12 +19,16 @@ if(empty($_SESSION["KCONFIG"])){
load_kconfig
();
}
if
(
empty
(
$_SESSION
[
"WRSVERSION"
])){
$_SESSION
[
"WRSVERSION"
]
=
shell_exec
(
"/wr/bin/wrs_version -g"
);
}
// Forms are firstly generated by default, but can be modified by users.
$WRS_TABLE_INFO
=
Array
(
'DASHBOARD'
=>
Array
(
'DASHBOARD_00'
=>
Array
(
'name'
=>
'H
OSTNAME
'
,
'name'
=>
'H
ostname
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
HOSTNAME
],
),
'DASHBOARD_02'
=>
Array
(
...
...
@@ -32,89 +36,89 @@ $WRS_TABLE_INFO = Array (
'value'
=>
$_SESSION
[
"WRS_INFO"
][
IPADDRESS
],
),
'DASHBOARD_03'
=>
Array
(
'name'
=>
'MAC
ADDRESS
'
,
'name'
=>
'MAC
Address
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
MACADDRESS
],
),
'DASHBOARD_04'
=>
Array
(
'name'
=>
'K
ERNEL
'
,
'name'
=>
'K
ernel Version
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
KERNEL
],
),
'DASHBOARD_05'
=>
Array
(
'name'
=>
'F
IRMWARE
'
,
'name'
=>
'F
irmware Version
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
FIRMWARE
],
),
'DASHBOARD_06'
=>
Array
(
'name'
=>
'H
ARDWARE
'
,
'name'
=>
'H
ardware Version
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
HARDWARE
],
),
'DASHBOARD_07'
=>
Array
(
'name'
=>
'FPGA'
,
'name'
=>
'FPGA
type
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
FPGA
],
),
'DASHBOARD_08'
=>
Array
(
'name'
=>
'M
ANUFACTURER
'
,
'name'
=>
'M
anufacturer
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
MANUFACTURER
],
),
'DASHBOARD_09'
=>
Array
(
'name'
=>
'S
ERIALNUMBER
'
,
'name'
=>
'S
erial Number
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
SERIALNUMBER
],
),
'DASHBOARD_10'
=>
Array
(
'name'
=>
'K
ERNELCOMPILEDDATE
'
,
'name'
=>
'K
ernel Compiled Date
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
KERNELCOMPILEDDATE
],
),
),
'CONTACT'
=>
Array
(
'CONTACT_00'
=>
Array
(
'name'
=>
'F
IRMWARE
'
,
'name'
=>
'F
irmware Version
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
FIRMWARE
],
),
'CONTACT_01'
=>
Array
(
'name'
=>
'K
ERNEL
'
,
'name'
=>
'K
ernel Version
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
KERNEL
],
),
'CONTACT_02'
=>
Array
(
'name'
=>
'C
OMPILEDBY
'
,
'name'
=>
'C
ompiled By
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
COMPILEDBY
],
),
'CONTACT_03'
=>
Array
(
'name'
=>
'K
ERNELCOMPILEDDATE
'
,
'name'
=>
'K
ernel Compiled Date
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
KERNELCOMPILEDDATE
],
),
'CONTACT_04'
=>
Array
(
'name'
=>
'H
ARDWARE
'
,
'name'
=>
'H
ardware Version
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
HARDWARE
],
),
'CONTACT_05'
=>
Array
(
'name'
=>
'FPGA'
,
'name'
=>
'FPGA
Version
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
FPGA
],
),
'CONTACT_06'
=>
Array
(
'name'
=>
'M
ANUFACTURER
'
,
'name'
=>
'M
anufacturer
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
MANUFACTURER
],
),
'CONTACT_07'
=>
Array
(
'name'
=>
'S
ERIALNUMBER
'
,
'name'
=>
'S
erial Number
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
SERIALNUMBER
],
),
'CONTACT_08'
=>
Array
(
'name'
=>
'G
ATEWARE
'
,
'name'
=>
'G
ateware Version
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
GATEWARE
],
),
'CONTACT_09'
=>
Array
(
'name'
=>
'G
ATEWAREBUILD
'
,
'name'
=>
'G
ateware Build
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
GATEWAREBUILD
],
),
'CONTACT_10'
=>
Array
(
'name'
=>
'WR
SHDLCOMMIT
'
,
'name'
=>
'WR
Switch HDL Commit
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
WRSHDLCOMMIT
],
),
'CONTACT_11'
=>
Array
(
'name'
=>
'G
CORESCOMMIT
'
,
'name'
=>
'G
eneral Cores Commit
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
GCORESCOMMIT
],
),
'CONTACT_12'
=>
Array
(
'name'
=>
'WR
CORESCOMMIT
'
,
'name'
=>
'WR
Cores Commit
'
,
'value'
=>
$_SESSION
[
"WRS_INFO"
][
WRCORESCOMMIT
],
),
),
...
...
@@ -139,35 +143,63 @@ $WRS_FORMS = Array(
'SYSTEM_LOGS'
=>
Array
(
'SYSTEM_LOGS_00'
=>
Array
(
'key'
=>
"CONFIG_WRS_LOG_HAL"
,
'name'
=>
"
HAL log
"
,
'name'
=>
"
Logging directions for the WR HAL
"
,
'value'
=>
$_SESSION
[
"KCONFIG"
][
"CONFIG_WRS_LOG_HAL"
],
'vname'
=>
"loghal"
,
),
'SYSTEM_LOGS_01'
=>
Array
(
'key'
=>
"CONFIG_WRS_LOG_LEVEL_HAL"
,
'name'
=>
"Logging verbosity level for the WR HAL"
,
'value'
=>
$_SESSION
[
"KCONFIG"
][
"CONFIG_WRS_LOG_LEVEL_HAL"
],
'vname'
=>
"loglevelhal"
,
),
'SYSTEM_LOGS_02'
=>
Array
(
'key'
=>
"CONFIG_WRS_LOG_RTU"
,
'name'
=>
"
RTU log
"
,
'name'
=>
"
Logging directions for the RTU daemon
"
,
'value'
=>
$_SESSION
[
"KCONFIG"
][
"CONFIG_WRS_LOG_RTU"
],
'vname'
=>
"logrtu"
,
),
'SYSTEM_LOGS_02'
=>
Array
(
'SYSTEM_LOGS_03'
=>
Array
(
'key'
=>
"CONFIG_WRS_LOG_LEVEL_RTU"
,
'name'
=>
"Logging verbosity level for the RTU daemon"
,
'value'
=>
$_SESSION
[
"KCONFIG"
][
"CONFIG_WRS_LOG_LEVEL_RTU"
],
'vname'
=>
"loglevelrtu"
,
),
'SYSTEM_LOGS_04'
=>
Array
(
'key'
=>
"CONFIG_WRS_LOG_PTP"
,
'name'
=>
"
PTP log
"
,
'name'
=>
"
Logging directions for the PTP daemon
"
,
'value'
=>
$_SESSION
[
"KCONFIG"
][
"CONFIG_WRS_LOG_PTP"
],
'vname'
=>
"logptp"
,
),
'SYSTEM_LOGS_03'
=>
Array
(
'SYSTEM_LOGS_05'
=>
Array
(
'key'
=>
"CONFIG_WRS_LOG_LEVEL_PTP"
,
'name'
=>
"Logging verbosity level for the PTP daemon"
,
'value'
=>
$_SESSION
[
"KCONFIG"
][
"CONFIG_WRS_LOG_LEVEL_PTP"
],
'vname'
=>
"loglevelptp"
,
),
'SYSTEM_LOGS_06'
=>
Array
(
'key'
=>
"CONFIG_WRS_LOG_OTHER"
,
'name'
=>
"
other applications log
"
,
'name'
=>
"
Logging directions for other programs
"
,
'value'
=>
$_SESSION
[
"KCONFIG"
][
"CONFIG_WRS_LOG_OTHER"
],
'vname'
=>
"logother"
,
),
'SYSTEM_LOGS_04'
=>
Array
(
'SYSTEM_LOGS_07'
=>
Array
(
'key'
=>
"CONFIG_WRS_LOG_LEVEL_OTHER"
,
'name'
=>
"Logging verbosity level for other programs"
,
'value'
=>
$_SESSION
[
"KCONFIG"
][
"CONFIG_WRS_LOG_LEVEL_OTHER"
],
'vname'
=>
"loglevelother"
,
),
'SYSTEM_LOGS_08'
=>
Array
(
'key'
=>
"CONFIG_WRS_LOG_MONIT"
,
'name'
=>
"Monit
or
log"
,
'name'
=>
"Monit log"
,
'value'
=>
$_SESSION
[
"KCONFIG"
][
"CONFIG_WRS_LOG_MONIT"
],
'vname'
=>
"logmonit"
,
),
'SYSTEM_LOGS_0
5
'
=>
Array
(
'SYSTEM_LOGS_0
9
'
=>
Array
(
'key'
=>
"CONFIG_WRS_LOG_SNMPD"
,
'name'
=>
"SNMPd log"
,
'value'
=>
$_SESSION
[
"KCONFIG"
][
"CONFIG_WRS_LOG_SNMPD"
],
...
...
userspace/rootfs_override/var/www/data/wrs-info-generator.php
View file @
a0e412f1
...
...
@@ -12,6 +12,17 @@
*
*/
#Save info to temp file so we dont have to execute command at each call
if
(
empty
(
$_SESSION
[
"WRSVERSIONTMP"
])){
$file_version
=
"/tmp/www_wrs_version.txt"
;
if
(
!
file_exists
(
$file_version
))
{
$_SESSION
[
"WRSVERSIONTMP"
]
=
shell_exec
(
"/wr/bin/wrs_version -t | tee > "
.
$file_version
);
}
else
{
$_SESSION
[
"WRSVERSIONTMP"
]
=
shell_exec
(
"cat "
.
$file_version
);
}
}
$outputfilename
=
"/var/www/data/wrs-info.php"
;
...
...
@@ -28,19 +39,18 @@ $options = Array (
Array
(
"KERNEL"
,
"Kernel Version"
,
"uname -r"
,
"y"
),
Array
(
"KERNELCOMPILEDDATE"
,
"Kernel Compiled Date"
,
"uname -v"
,
"y"
),
Array
(
"FIRMWARE"
,
"Firmware Version"
,
"/wr/bin/wrs_version | awk '{print $4}'"
,
"y"
),
Array
(
"HARDWARE"
,
"Hardware Version"
,
"
/wr/bin/wrs_version -t
| grep 'scb\|back' | sort -r | sed 's/back/ back/' | sed 's/-version: /: v/'"
,
"y"
),
Array
(
"FPGA"
,
"FPGA Version"
,
"
/wr/bin/wrs_version -f
"
,
"y"
),
Array
(
"COMPILEDBY"
,
"Compiled By"
,
'/wr/bin/wrs_version -v | cut -d " " -f 2-'
,
"y"
),
Array
(
"MANUFACTURER"
,
"Manufacturer"
,
"
/wr/bin/wrs_version -
t | grep 'manufacturer' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"SERIALNUMBER"
,
"Serial Number"
,
"
/wr/bin/wrs_version -
t | grep 'serial' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"GATEWARE"
,
"Gateware Version"
,
"
/wr/bin/wrs_version -
t | grep 'gateware-version' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"GATEWAREBUILD"
,
"Gateware Build"
,
"
/wr/bin/wrs_version -
t | grep 'gateware-build' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"WRSHDLCOMMIT"
,
"WR Switch HDL Commit"
,
"
/wr/bin/wrs_version -
t | grep 'wr_switch_hdl-commit' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"GCORESCOMMIT"
,
"General Cores Commit"
,
"
/wr/bin/wrs_version -
t | grep 'general-cores-commit' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"WRCORESCOMMIT"
,
"WR Cores Commit"
,
"
/wr/bin/wrs_version -
t | grep 'wr-cores-commit' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"HARDWARE"
,
"Hardware Version"
,
"
cat /tmp/www_wrs_version.txt
| grep 'scb\|back' | sort -r | sed 's/back/ back/' | sed 's/-version: /: v/'"
,
"y"
),
Array
(
"FPGA"
,
"FPGA Version"
,
"
cat /tmp/www_wrs_version.txt | grep 'fpga-type' | sed 's/[^:]*: //'
"
,
"y"
),
Array
(
"COMPILEDBY"
,
"Compiled By"
,
"cat /tmp/www_wrs_version.txt | grep 'bult-by' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"MANUFACTURER"
,
"Manufacturer"
,
"
cat /tmp/www_wrs_version.tx
t | grep 'manufacturer' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"SERIALNUMBER"
,
"Serial Number"
,
"
cat /tmp/www_wrs_version.tx
t | grep 'serial' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"GATEWARE"
,
"Gateware Version"
,
"
cat /tmp/www_wrs_version.tx
t | grep 'gateware-version' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"GATEWAREBUILD"
,
"Gateware Build"
,
"
cat /tmp/www_wrs_version.tx
t | grep 'gateware-build' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"WRSHDLCOMMIT"
,
"WR Switch HDL Commit"
,
"
cat /tmp/www_wrs_version.tx
t | grep 'wr_switch_hdl-commit' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"GCORESCOMMIT"
,
"General Cores Commit"
,
"
cat /tmp/www_wrs_version.tx
t | grep 'general-cores-commit' | sed 's/[^:]*: //'"
,
"y"
),
Array
(
"WRCORESCOMMIT"
,
"WR Cores Commit"
,
"
cat /tmp/www_wrs_version.tx
t | grep 'wr-cores-commit' | sed 's/[^:]*: //'"
,
"y"
),
);
// Code for wrs-info.php generation.
$output
=
'<?php
...
...
userspace/rootfs_override/var/www/deletesfp.php
View file @
a0e412f1
...
...
@@ -28,7 +28,7 @@
save_kconfig
();
apply_kconfig
();
header
(
'Location: sfpc
alib
ration.php'
);
header
(
'Location: sfpc
onfigu
ration.php'
);
?>
</div>
...
...
userspace/rootfs_override/var/www/endpointc
alib
ration.php
→
userspace/rootfs_override/var/www/endpointc
onfigu
ration.php
View file @
a0e412f1
...
...
@@ -3,6 +3,7 @@
<div
class=
"main"
>
<div
class=
"page"
>
<div
class=
"header"
>
<script
type=
"text/javascript"
src=
"js/func.js"
></script>
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div
class=
"header-ports"
>
<?php
wrs_header_ports
();
?>
</div>
<div
class=
"topmenu"
>
...
...
@@ -16,7 +17,7 @@
</div>
<div
class=
"rightpanel"
>
<div
class=
"rightbody"
>
<h1
class=
"title"
>
Endpoint C
alib
ration
<a
href=
'http://www.ohwr.org/projects/white-rabbit/wiki/Calibration'
target=
'_blank'
><img
align=
right
src=
"./img/question.png"
></a></h1>
<h1
class=
"title"
>
Endpoint C
onfigu
ration
<a
href=
'http://www.ohwr.org/projects/white-rabbit/wiki/Calibration'
target=
'_blank'
><img
align=
right
src=
"./img/question.png"
></a></h1>
<br>
<?php
session_is_started
()
?>
...
...
@@ -28,16 +29,20 @@
<center>NOTE: If you do not know how to calibrate endpoints
please click on <a href='http://www.ohwr.org/projects/white-rabbit/wiki/Calibration'
target='_blank'> here </a>*<hr><br>"
;
$formatID
=
"alternatecolor"
;
$formatID
=
"alternatecolor1"
;
$class
=
"altrowstablesmall firstcol"
;
$infoname
=
"Endpoint Configuration"
;
//$size = "6";
if
(
strpos
(
$_SESSION
[
"KCONFIG"
][
"CONFIG_PORT01_PARAMS"
],
'proto='
)
!==
false
)
$header
=
array
(
"WR port"
,
"Protocol"
,
"Tx"
,
"Rx"
,
"Mode"
,
"Fiber"
);
if
(
strpos
(
$_SESSION
[
"KCONFIG"
][
"CONFIG_PORT01_PARAMS"
],
'monitor='
)
!==
false
)
$header
=
array
(
key
=>
"key"
,
name
=>
"WR port"
,
proto
=>
"Protocol"
,
tx
=>
"Δ Tx"
,
rx
=>
"Δ Rx"
,
role
=>
"Mode"
,
fiber
=>
"Fiber"
,
monitor
=>
"Monitor"
,
ext
=>
"Extension"
,
dm
=>
"Delay Mechanism"
);
else
if
(
strpos
(
$_SESSION
[
"KCONFIG"
][
"CONFIG_PORT01_PARAMS"
],
'proto='
)
!==
false
)
$header
=
array
(
key
=>
"key"
,
name
=>
"WR port"
,
proto
=>
"Protocol"
,
tx
=>
"Δ Tx"
,
rx
=>
"Δ Rx"
,
role
=>
"Mode"
,
fiber
=>
"Fiber"
);
else
$header
=
array
(
"WR port"
,
"Tx"
,
"Rx"
,
"Mode"
,
"Fiber"
);
$header
=
array
(
key
=>
"key"
,
name
=>
"WR port"
,
tx
=>
"Δ Tx"
,
rx
=>
"Δ Rx"
,
role
=>
"Mode"
,
fiber
=>
"Fiber"
);
$matrix
=
array
(
"key=CONFIG_PORT01_PARAMS,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_PORT01_PARAMS"
],
"key=CONFIG_PORT02_PARAMS,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_PORT02_PARAMS"
],
"key=CONFIG_PORT03_PARAMS,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_PORT03_PARAMS"
],
...
...
@@ -57,28 +62,14 @@
"key=CONFIG_PORT17_PARAMS,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_PORT17_PARAMS"
],
"key=CONFIG_PORT18_PARAMS,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_PORT18_PARAMS"
],
);
print_multi_form
(
$matrix
,
$header
,
$formatID
,
$class
,
$infoname
,
$size
);
print_
dynamic_
multi_form
(
$matrix
,
$header
,
$formatID
,
$class
,
$infoname
,
$size
);
if
(
process_multi_form
(
$matrix
)){
save_kconfig
();
apply_kconfig
();
header
(
'Location: endpointcalib
ration.php'
);
header
(
'Location: endpointconfigu
ration.php'
);
}
$formatID
=
"alternatecolor1"
;
$class
=
"altrowstablesmall firstcol"
;
$infoname
=
"Available Fibers"
;
$size
=
"10"
;
$header
=
array
(
"#"
,
"Alpha"
);
$matrix
=
array
(
"id=0,key=CONFIG_FIBER00_PARAMS,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_FIBER00_PARAMS"
],
"id=1,key=CONFIG_FIBER01_PARAMS,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_FIBER01_PARAMS"
],
"id=2,key=CONFIG_FIBER02_PARAMS,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_FIBER02_PARAMS"
],
"id=3,key=CONFIG_FIBER03_PARAMS,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_FIBER03_PARAMS"
]);
print_multi_form
(
$matrix
,
$header
,
$formatID
,
$class
,
$infoname
,
$size
);
?>
</div>
...
...
userspace/rootfs_override/var/www/endpointmode.php
View file @
a0e412f1
...
...
@@ -3,6 +3,7 @@
<div
class=
"main"
>
<div
class=
"page"
>
<div
class=
"header"
>
<script
type=
"text/javascript"
src=
"js/dropmodes.js"
></script>
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div
class=
"header-ports"
>
<?php
wrs_header_ports
();
?>
</div>
<div
class=
"topmenu"
>
...
...
@@ -25,20 +26,49 @@
//Load all
$modes
=
parse_endpoint_modes
();
$names
=
array
(
"slave"
,
"auto"
,
"non_wr"
,
"none"
,
"master"
);
echo
'<table class="altrowstable" id="alternatecolor" style="width:100%;text-align:center">'
;
for
(
$i
=
0
;
$i
<
9
;
$i
++
){
echo
'<tr>'
;
echo
'<th>wri'
.
(
$i
+
1
)
.
'</td>'
;
echo
'<td><a href="modifymode.php?wri='
.
(
$i
+
1
)
.
'&mode='
.
$modes
[
$i
]
.
'">'
.
$modes
[
$i
]
.
'</a></th>'
;
echo
'<th>wri'
.
(
$i
+
1
)
.
'</th>'
;
$tmp
=
$i
+
1
;
echo
'<td><select name="selected" id="selected-'
.
$tmp
.
'" class="drop">'
;
for
(
$j
=
0
;
$j
<
sizeof
(
$names
);
$j
++
){
if
(
$modes
[
$i
]
==
$names
[
$j
]){
echo
'<option selected="selected" ">'
.
$modes
[
$i
]
.
'</option>'
;
}
else
{
echo
'<option value='
.
$names
[
$j
]
.
'>'
.
$names
[
$j
]
.
'</option>'
;
}
}
echo
'</select></td>'
;
echo
'<th>wri'
.
(
$i
+
10
)
.
'</th>'
;
echo
'<td><a href="modifymode.php?wri='
.
(
$i
+
10
)
.
'&mode='
.
$modes
[
$i
+
9
]
.
'">'
.
$modes
[
$i
+
9
]
.
'</a></td>'
;
$tmp2
=
$i
+
10
;
echo
'<td><select name="selected" id="selected-'
.
$tmp2
.
'" class="drop">'
;
for
(
$j
=
0
;
$j
<
sizeof
(
$names
);
$j
++
){
if
(
$modes
[
$i
+
9
]
==
$names
[
$j
]){
echo
'<option selected="selected" ">'
.
$modes
[
$i
+
9
]
.
'</option>'
;
}
else
{
echo
'<option value='
.
$names
[
$j
]
.
'>'
.
$names
[
$j
]
.
'</option>'
;
}
}
echo
'</select></td>'
;
echo
'</tr>'
;
}
echo
'</table>'
;
echo
'<br>'
;
echo
'<p align="right">Go to <a href="endpointc
alib
ration.php">advanced mode</a></p>'
;
echo
'<p align="right">Go to <a href="endpointc
onfigu
ration.php">advanced mode</a></p>'
;
?>
...
...
userspace/rootfs_override/var/www/fiberconfiguration.php
0 → 100644
View file @
a0e412f1
<?php
include
'functions.php'
;
include
'head.php'
;
?>
<body
id=
"epcalib"
>
<div
class=
"main"
>
<div
class=
"page"
>
<div
class=
"header"
>
<script
type=
"text/javascript"
src=
"js/func.js"
></script>
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div
class=
"header-ports"
>
<?php
wrs_header_ports
();
?>
</div>
<div
class=
"topmenu"
>
<?php
include
'topmenu.php'
?>
</div>
</div>
<div
class=
"content"
>
<div
class=
"leftpanel"
>
<h2>
Main Menu
</h2>
<?php
include
'menu.php'
?>
</div>
<div
class=
"rightpanel"
>
<div
class=
"rightbody"
>
<h1
class=
"title"
>
Fiber Configuration
<a
href=
'http://www.ohwr.org/projects/white-rabbit/wiki/Calibration'
target=
'_blank'
><img
align=
right
src=
"./img/question.png"
></a></h1>
<br>
<?php
session_is_started
()
?>
<?php
// Warning message
echo
"<hr>
<center>NOTE: If you do not know how to calibrate endpoints
please click on <a href='http://www.ohwr.org/projects/white-rabbit/wiki/Calibration'
target='_blank'> here </a>*<hr><br>"
;
$formatID
=
"alternatecolor1"
;
$class
=
"altrowstablesmall firstcol fiberstable"
;
$infoname
=
"Available Fibers"
;
$size
=
"3"
;
$header
=
array
(
"#"
,
"λtx"
,
"λrx"
,
"Value"
);
$matrix
=
array
(
"key=CONFIG_FIBER00_PARAMS, id=0,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_FIBER00_PARAMS"
],
"key=CONFIG_FIBER01_PARAMS, id=1,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_FIBER01_PARAMS"
],
"key=CONFIG_FIBER02_PARAMS,id=2,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_FIBER02_PARAMS"
],
"key=CONFIG_FIBER03_PARAMS, id=3,"
.
$_SESSION
[
"KCONFIG"
][
"CONFIG_FIBER03_PARAMS"
]);
//change string to match drawing function
$length
=
count
(
$matrix
);
for
(
$i
=
0
;
$i
<
$length
;
$i
++
)
{
$matrix
[
$i
]
=
str_replace
(
"alpha_"
,
"tx="
,
$matrix
[
$i
]);
$matrix
[
$i
]
=
lreplace
(
"_"
,
",rx="
,
$matrix
[
$i
]);
$matrix
[
$i
]
=
lreplace
(
"="
,
",val="
,
$matrix
[
$i
]);
}
print_multi_form
(
$matrix
,
$header
,
$formatID
,
$class
,
$infoname
,
$size
);
if
(
process_multi_form
(
$matrix
)){
save_kconfig
();
apply_kconfig
();
header
(
'Location: fiberconfiguration.php'
);
}
?>
</div>
</div>
</div>
<div
class=
"footer"
>
<?php
include
'footer.php'
?>
</div>
</div>
</div>
</body>
</html>
userspace/rootfs_override/var/www/footer.php
View file @
a0e412f1
...
...
@@ -2,5 +2,9 @@
<a
href=
'http://www.ohwr.org/projects/wr-switch-sw'
target=
"_blank"
><IMG
SRC=
'img/ohr.png'
align=
left
,
vspace=
7,
hspace=
5,
width=
35
,
hight=
100
,
border=
0
,
alt=
'OHR'
></a>
<p>
White Rabbit Project - Open Hardware and Source Project
<a
class=
"footer-link"
target=
"_blank"
href=
"http://www.ohwr.org/projects/white-rabbit/wiki"
>
White-Rabbit OHR
</a>
<a
href=
'sysinfo.php'
target=
"_blank"
><IMG
SRC=
'img/light_php.png'
align=
right
,
vspace=
7,
hspace=
5,
width=
100
,
hight=
100
,
border=
0
,
alt=
'PHP Info'
></a>
<?php
if
(
isset
(
$_SESSION
[
'myusername'
]))
echo
"<a href='sysinfo.php' target='_blank'>"
;
echo
"<IMG SRC='img/light_php.png' align=right , vspace=7, hspace=5, width=100 , hight=100 , border=0 , alt='PHP Info'>"
;
if
(
isset
(
$_SESSION
[
'myusername'
]))
echo
"</a>"
;
?>
</p>
userspace/rootfs_override/var/www/functions.php
View file @
a0e412f1
This diff is collapsed.
Click to expand it.
userspace/rootfs_override/var/www/functionsget.php
0 → 100644
View file @
a0e412f1
<?php
/*
* Obtain info from wr_mon
*
* @author Anne M. <anne@sevensols.com>
*
*/
include
'functions.php'
;
#Save info to temp file so we dont have to execute command at each call
function
createTempDataFile
(){
shell_exec
(
"/wr/bin/wr_mon -w > /tmp/www_wr_mon.txt"
);
}
createTempDataFile
();
#Obtain the temperatures
function
getTemperatures
(
$sub_id
=
-
1
){
$temperatures
=
shell_exec
(
"cat /tmp/www_wr_mon.txt | grep TEMP"
);
$temperatures
=
split
(
" "
,
$temperatures
);
if
(
$sub_id
!=
-
1
){
$temperatures
=
$temperatures
[
$sub_id
];
}
return
$temperatures
;
}
#Obtain the wr servo timing
function
getTiming
(){
$ports
=
shell_exec
(
"cat /tmp/www_wr_mon.txt | grep SERVO"
);
$ports
=
explode
(
" "
,
$ports
);
$txt
=
$ports
;
return
$txt
;
}
#Obtain wr date
function
getWrDate
(){
$wr_date
=
shell_exec
(
"/wr/bin/wr_date -n get |tail -2"
);
$wr_date
=
explode
(
"
\n
"
,
$wr_date
);
return
$wr_date
;
}
#Obtain the wr info as html table
function
getTablePortStatus
(){
ob_start
();
draw_table
();
$sfp
=
ob_get_contents
();
ob_end_clean
();
return
$sfp
;
}
#Obtain the wr info
function
getPortStatus
(){
$wrinfo
=
shell_exec
(
"cat /tmp/www_wr_mon.txt | grep wri"
);
$wrinfo
=
explode
(
"
\n
"
,
$wrinfo
);
return
$wrinfo
;
}
?>
userspace/rootfs_override/var/www/getinfo.php
0 → 100644
View file @
a0e412f1
<?php
/*
* Send dynamic information
*
* @author Anne M. <anne@sevensols.com>
*
*/
include
'json.php'
;
include
'functionsget.php'
;
$data
=
array
();
array_push
(
$data
,
getTemperatures
(
1
));
array_push
(
$data
,
getWrDate
());
array_push
(
$data
,
getTablePortStatus
());
array_push
(
$data
,
getTiming
());
echo
__json_encode
(
$data
);
?>
userspace/rootfs_override/var/www/getwrstatus.php
0 → 100644
View file @
a0e412f1
<?php
/*
* Send wr dynamic information
*
* @author Anne M. <anne@sevensols.com>
*
*/
include
'json.php'
;
include
'functionsget.php'
;
$data
=
array
();
array_push
(
$data
,
getPortStatus
());
array_push
(
$data
,
getTemperatures
());
array_push
(
$data
,
getWrDate
());
array_push
(
$data
,
getTiming
());
echo
__json_encode
(
$data
);
?>
userspace/rootfs_override/var/www/head.php
View file @
a0e412f1
...
...
@@ -28,6 +28,8 @@ $_SESSION['LAST_ACTIVITY'] = time();
<!-- Javascript goes in the document HEAD -->
<!-- Javascript are located in /js/scripts.js -->
<script
type=
"text/javascript"
src=
"js/jquery-1.10.1.min.js"
></script>
<script
type=
"text/javascript"
src=
"js/jquery-3.1.1.min.js"
></script>
<script
type=
"text/javascript"
src=
"js/jquery-3.1.1.js"
></script>
<script
type=
"text/javascript"
src=
"js/scripts.js"
></script>
<script
type=
"text/javascript"
src=
"js/loadinfo.js"
></script>
</head>
userspace/rootfs_override/var/www/js/dropmodes.js
0 → 100644
View file @
a0e412f1
/*
* Javascripts for endpointmode.php
*
* @author Anne M. Muñoz <amunoz@sevensols.com>
*
* Depending on the dropdown list option selected updates the port status
* without the need of procesing a POST call in PHP
* The process is controlled by javascript, avoiding to reload the page
* improving user experience
*
* Result: A Dropdown List with the choices for the port status
*
*/
$
(
document
).
ready
(
function
()
{
$
(
'.drop'
).
on
(
'change'
,
set_endpoint_mode
);
});
function
set_endpoint_mode
(){
var
selected
=
$
(
"#"
+
this
.
id
).
val
();
var
wri
=
"wri"
+
this
.
id
.
replace
(
/^
\D
+/g
,
''
);
console
.
log
(
selected
,
wri
);
$
.
ajax
({
url
:
'modifymode.php'
,
type
:
'GET'
,
data
:
{
wri
:
wri
,
mode
:
selected
}
});
}
userspace/rootfs_override/var/www/js/func.js
0 → 100644
View file @
a0e412f1
$
(
document
).
ready
(
function
()
{
addColorRows
(
"#alternatecolor1"
);
columnNonEditable
(
"#alternatecolor1"
,
2
);
changeMode
();
});
function
addColorRows
(
name
){
$
(
"table"
+
name
+
" tbody tr:nth-child(odd)"
).
addClass
(
"oddrowcolor"
);
$
(
"table"
+
name
+
" tbody tr:nth-child(even)"
).
addClass
(
"evenrowcolor"
);
}
function
columnNonEditable
(
id
,
column
){
$
(
id
+
" tr > :nth-child("
+
column
+
") input"
).
prop
(
"readonly"
,
true
);
}
function
changeMode
(){
if
(
$
(
"#endpointconfig"
).
length
!=
0
)
{
$
(
".drop"
).
on
(
'change'
,
function
()
{
$
(
this
).
attr
(
'value'
,
$
(
this
).
val
());
});
$
(
".checkbox"
).
on
(
'change'
,
function
()
{
if
(
$
(
this
).
val
()
==
"n"
)
$
(
this
).
attr
(
'value'
,
"y"
);
else
$
(
this
).
attr
(
'value'
,
"n"
);
});
}
}
userspace/rootfs_override/var/www/js/jquery-1.10.1.min.js
deleted
100644 → 0
View file @
607129b7
This diff is collapsed.
Click to expand it.
userspace/rootfs_override/var/www/js/jquery-
1.10
.1.js
→
userspace/rootfs_override/var/www/js/jquery-
3.1
.1.js
View file @
a0e412f1
This diff is collapsed.
Click to expand it.
userspace/rootfs_override/var/www/js/jquery-3.1.1.min.js
0 → 100644
View file @
a0e412f1
This diff is collapsed.
Click to expand it.
userspace/rootfs_override/var/www/js/loadinfo.js
0 → 100644
View file @
a0e412f1
var
datainfo
;
get_info
();
var
interval
=
setInterval
(
get_info
,
5000
);
function
get_info
(){
try
{
$
.
ajax
({
url
:
"getinfo.php"
,
type
:
"POST"
,
data
:
"data"
,
success
:
function
(
data
)
{
datainfo
=
JSON
.
parse
(
data
);
if
(
$
(
"#sfp_panel"
).
length
>
0
)
updateValues
();
else
clearInterval
(
interval
);
},
error
:
function
()
{
clearInterval
(
interval
);
}
});
// AJAX Get
}
catch
(
err
){
console
.
log
(
err
);
}
}
function
updateValues
(){
$
(
"#sfp_panel"
).
html
(
datainfo
[
2
]);
$
(
"#temp"
).
text
(
datainfo
[
0
]);
$
(
"#datewr"
).
html
(
datainfo
[
1
][
0
]
+
'<br>'
+
datainfo
[
1
][
1
]);
var
status
;
var
end
=
false
;
for
(
var
i
=
0
;
i
<
datainfo
[
3
].
length
-
1
&&
!
end
;
i
++
){
var
content
=
datainfo
[
3
][
i
];
if
(
content
.
indexOf
(
"sv"
)
>-
1
){
//datainfo[3][i] = '<b>' + content + '<b><br/>';
if
(
content
.
indexOf
(
"0"
)
>-
1
)
{
datainfo
[
3
][
i
+
1
]
=
''
+
'<br/>'
;
//modify next line
status
=
datainfo
[
3
][
i
+
1
];
}
else
{
datainfo
[
3
][
i
+
1
]
=
datainfo
[
3
][
i
+
1
].
replace
(
"ss:"
,
""
);
datainfo
[
3
][
i
+
1
]
=
datainfo
[
3
][
i
+
1
].
replace
(
"
\
'"
,
""
);
datainfo
[
3
][
i
+
1
]
=
datainfo
[
3
][
i
+
1
].
replace
(
"
\
'"
,
""
);
datainfo
[
3
][
i
+
1
]
=
datainfo
[
3
][
i
+
1
]
;
status
=
datainfo
[
3
][
i
+
1
];
}
end
=
true
;
//jump to next state
}
}
$
(
"#timing"
).
html
(
status
);
}
userspace/rootfs_override/var/www/js/loadwrinfo.js
0 → 100644
View file @
a0e412f1
var
datainfowr
;
get_wrinfo
();
var
intervalwr
=
setInterval
(
get_wrinfo
,
5000
);
function
get_wrinfo
(){
$
.
ajax
({
url
:
"getwrstatus.php"
,
type
:
"POST"
,
data
:
"data"
,
success
:
function
(
data
)
{
datainfowr
=
JSON
.
parse
(
data
);
updateWrValues
()
},
error
:
function
()
{
clearInterval
(
intervalwr
);
}
});
// AJAX Get
}
function
updateWrValues
(){
var
tables
=
""
;
//table temperatures + time
tables
+=
drawrowtable
(
removewhitespaces
(
datainfowr
[
1
]));
tables
+=
'<br>'
;
//table ports status
tables
+=
drawportstable
(
datainfowr
[
0
]);
tables
+=
'<br>'
;
//table timing parameters & sync status
var
data
=
datainfowr
[
2
]
+
','
+
removewhitespaces
(
datainfowr
[
3
]);
tables
+=
drawtimingtable
(
data
);
tables
+=
'<br>'
;
$
(
"#wrstatus"
).
html
(
tables
);
addcolorrows
();
}
function
removewhitespaces
(
darray
){
darray
=
darray
.
filter
(
function
(
str
)
{
return
/
\S
/
.
test
(
str
);
});
return
darray
;
}
function
drawrowtable
(
data
){
var
names
=
[[
"FGPA"
,
"fgpa"
],[
"PLL"
,
"pll"
],[
"Left power supply"
,
"psl"
],[
"Right power supply"
,
"psr"
]];
var
tablewr
=
'<div><table class="altrowstable firstcol" width="100%" id="alternatecolor">'
;
tablewr
+=
'<tr><th>Temperatures</th></tr>'
;
for
(
var
i
=
1
;
i
<
data
.
length
;
i
++
)
{
data
[
i
]
=
data
[
i
].
split
(
":"
);
tablewr
+=
'<tr><td>'
+
names
[
i
-
1
][
0
]
+
'</td><td>'
+
data
[
i
][
1
]
+
" °C"
+
'</td></tr>'
;
}
tablewr
+=
'</table></div>'
;
return
tablewr
;
}
function
drawtimingtable
(
data
){
var
names
=
[[
"WR time"
,
"TAI"
],[
"Switch time"
,
"UTC"
],[
"Servo state"
,
"ss"
],[
"Round-trip time (mu)"
,
"mu"
],
[
"Master-slave delay"
,
"dms"
],[
"Master PHY delays TX"
,
"dtxm"
],
[
"Master PHY delays RX"
,
"drxm"
],
[
"Slave PHY delays TX"
,
"dtxs"
],[
"Slave PHY delays RX"
,
"drxs"
],
[
"Total link asymmetry"
,
"asym"
],
[
"Estimated link length"
,
"ll"
],
[
"Clock offset"
,
"cko"
],[
"Phase setpoint"
,
"setp"
],[
"Servo update counter"
,
"ucnt"
]];
var
tablewr
=
'<div><table class="altrowstable firstcol" width="100%" id="alternatecolor">'
;
tablewr
+=
'<tr><th>Timing parameters</th></tr>'
;
var
j
=
0
;
data
=
data
.
split
(
","
);
for
(
var
i
=
0
;
i
<
data
.
length
;
i
++
)
{
if
((
data
[
i
].
match
(
/:/g
)
||
[]).
length
>
1
){
tablewr
+=
'<tr><td>'
+
names
[
j
][
0
]
+
'</td><td>'
+
data
[
i
]
+
'</td></tr>'
;
j
++
;
}
else
if
((
data
[
i
].
match
(
/:/g
)
||
[]).
length
==
1
){
data
[
i
]
=
data
[
i
].
split
(
":"
);
if
(
data
[
i
][
0
].
indexOf
(
"ss"
)
>=
0
){
data
[
i
][
1
]
=
data
[
i
][
1
].
replace
(
"
\
'"
,
''
);
data
[
i
][
1
]
=
data
[
i
][
1
].
replace
(
"
\
'"
,
''
);
tablewr
+=
'<tr><td>'
+
names
[
j
][
0
]
+
'</td><td>'
+
data
[
i
][
1
]
+
'</td></tr>'
;
j
++
;
}
else
if
(
data
[
i
][
0
].
indexOf
(
"ucnt"
)
>=
0
){
tablewr
+=
'<tr><td>'
+
names
[
j
][
0
]
+
'</td><td>'
+
data
[
i
][
1
]
+
' times'
+
'</td></tr>'
;
j
++
;
}
else
if
(
data
[
i
][
0
].
indexOf
(
"ll"
)
>=
0
){
tablewr
+=
'<tr><td>'
+
names
[
j
][
0
]
+
'</td><td>'
+
data
[
i
][
1
]
/
100
+
' m '
+
'</td></tr>'
;
j
++
;
}
else
if
(
data
[
i
][
0
].
indexOf
(
"sv"
)
<
0
&&
data
[
i
][
0
].
indexOf
(
"crtt"
)
<
0
&&
data
[
i
][
0
].
indexOf
(
"lock"
)
<
0
){
tablewr
+=
'<tr><td>'
+
names
[
j
][
0
]
+
'</td><td>'
+
data
[
i
][
1
]
/
1000
+
' nsec'
+
'</td></tr>'
;
j
++
;
}
}
}
tablewr
+=
'</table></div>'
;
return
tablewr
;
}
function
drawportstable
(
data
){
var
tablewr
=
'<div><table class="altrowstable firstcol" width="100%" id="alternatecolor">'
;
tablewr
+=
'<tr><th>Port</th><th>Link</th><th>WRconf</th><th>Freq</th><th>Calibration</th><th>MAC of peer port</th>'
;
for
(
var
i
=
0
;
i
<
data
.
length
-
1
;
i
++
)
{
data
[
i
]
=
data
[
i
].
split
(
" "
);
data
[
i
]
=
removewhitespaces
(
data
[
i
]);
tablewr
+=
'<tr>'
;
for
(
var
j
=
0
;
j
<
6
;
j
++
)
{
tablewr
+=
'<td>'
+
data
[
i
][
j
]
+
'</td>'
;
}
tablewr
+=
'</tr>'
;
}
tablewr
+=
'</table></div>'
;
return
tablewr
;
}
function
addcolorrows
(){
$
(
"table#alternatecolor tbody tr:nth-child(odd)"
).
addClass
(
"oddrowcolor"
);
$
(
"table#alternatecolor tbody tr:nth-child(even)"
).
addClass
(
"evenrowcolor"
);
}
function
columnNonEditable
(
id
,
column
){
$
(
id
+
" tr > :nth-child("
+
column
+
") input"
).
prop
(
"readonly"
,
true
);
}
userspace/rootfs_override/var/www/js/scripts.js
View file @
a0e412f1
...
...
@@ -10,8 +10,8 @@
function
altRows
(
id
){
if
(
document
.
getElementsByTagName
){
var
table
=
document
.
getElementById
(
id
);
try
{
var
rows
=
table
.
getElementsByTagName
(
"tr"
);
for
(
i
=
0
;
i
<
rows
.
length
;
i
++
){
if
(
i
%
2
==
0
){
rows
[
i
].
className
+=
" evenrowcolor"
;
...
...
@@ -30,6 +30,11 @@ function altRows(id){
rows
[
i
].
className
+=
" oddrowcolor"
;
}
}
}
catch
(
err
){
console
.
log
(
err
);
}
}
}
window
.
onload
=
function
(){
...
...
userspace/rootfs_override/var/www/json.php
0 → 100644
View file @
a0e412f1
<?php
/*
* JSON FUNCTIONS for dynamic send-receive info
*
* @author Anne M. <anne@sevensols.com>
*
*/
function
__json_encode
(
$data
)
{
if
(
is_array
(
$data
)
||
is_object
(
$data
)
)
{
$islist
=
is_array
(
$data
)
&&
(
empty
(
$data
)
||
array_keys
(
$data
)
===
range
(
0
,
count
(
$data
)
-
1
)
);
if
(
$islist
)
{
$json
=
'['
.
implode
(
','
,
array_map
(
'__json_encode'
,
$data
)
)
.
']'
;
}
else
{
$items
=
Array
();
foreach
(
$data
as
$key
=>
$value
)
{
$items
[]
=
__json_encode
(
"
$key
"
)
.
':'
.
__json_encode
(
$value
);
}
$json
=
'{'
.
implode
(
','
,
$items
)
.
'}'
;
}
}
elseif
(
is_string
(
$data
)
)
{
# Escape non-printable or Non-ASCII characters.
# I also put the \\ character first, as suggested in comments on the 'addclashes' page.
$string
=
'"'
.
addcslashes
(
$data
,
"
\\\"\n\r\t
/"
.
chr
(
8
)
.
chr
(
12
))
.
'"'
;
$json
=
''
;
$len
=
strlen
(
$string
);
# Convert UTF-8 to Hexadecimal Codepoints.
for
(
$i
=
0
;
$i
<
$len
;
$i
++
)
{
$char
=
$string
[
$i
];
$c1
=
ord
(
$char
);
# Single byte;
if
(
$c1
<
128
)
{
$json
.=
(
$c1
>
31
)
?
$char
:
sprintf
(
"
\\
u%04x"
,
$c1
);
continue
;
}
# Double byte
$c2
=
ord
(
$string
[
++
$i
]);
if
(
(
$c1
&
32
)
===
0
)
{
$json
.=
sprintf
(
"
\\
u%04x"
,
(
$c1
-
192
)
*
64
+
$c2
-
128
);
continue
;
}
# Triple
$c3
=
ord
(
$string
[
++
$i
]);
if
(
(
$c1
&
16
)
===
0
)
{
$json
.=
sprintf
(
"
\\
u%04x"
,
((
$c1
-
224
)
<<
12
)
+
((
$c2
-
128
)
<<
6
)
+
(
$c3
-
128
));
continue
;
}
# Quadruple
$c4
=
ord
(
$string
[
++
$i
]);
if
(
(
$c1
&
8
)
===
0
)
{
$u
=
((
$c1
&
15
)
<<
2
)
+
((
$c2
>>
4
)
&
3
)
-
1
;
$w1
=
(
54
<<
10
)
+
(
$u
<<
6
)
+
((
$c2
&
15
)
<<
2
)
+
((
$c3
>>
4
)
&
3
);
$w2
=
(
55
<<
10
)
+
((
$c3
&
15
)
<<
6
)
+
(
$c4
-
128
);
$json
.=
sprintf
(
"
\\
u%04x
\\
u%04x"
,
$w1
,
$w2
);
}
}
}
else
{
# int, floats, bools, null
$json
=
strtolower
(
var_export
(
$data
,
true
));
}
return
$json
;
}
?>
userspace/rootfs_override/var/www/menu.php
View file @
a0e412f1
...
...
@@ -33,13 +33,16 @@ echo '<div class="login">
/* show Aux. CLK2 configuration only if version 3.4 */
if
(
strpos
(
$_SESSION
[
"WRS_INFO"
][
HARDWARE
],
'scb: v3.4'
)
!==
false
)
echo
'<li><a href="auxclk.php">Aux Clock Config</a></li>'
;
echo
'<li><a href="sfpcalibration.php">SFP Calibration</a></li>'
;
echo
'<li><a href="wrinfo.php">WR Monitoring</a></li>'
;
echo
'<li><a href="endpointconfiguration.php">Endpoint Configuration</a></li>'
;
echo
'<li><a href="sfpconfiguration.php">SFP Configuration</a></li>'
;
echo
'<li><a href="fiberconfiguration.php">Fiber Configuration</a></li>'
;
echo
'<li><a href="logs.php">System Logs</a></li>'
;
echo
'<li><a href="endpoint.php">Endpoint Tool </a></li>'
;
echo
'<li><a href="endpointcalibration.php">Endpoint Calibration</a></li>'
;
echo
'<li><a href="load.php">LM32 & FPGA</a></li>'
;
echo
'<li><a href="logs.php">System logs</a></li>'
;
echo
'<li><a href="terminal.php">Virtual Console</a></li>'
;
echo
'<li><a href="firmware.php">Firmware</a></li>'
;
echo
'<li><a href="reset.php">Reboot & Reset</a></li>'
;
echo
'</ul>'
;
}
echo
'</ul><br><hr>'
;
...
...
userspace/rootfs_override/var/www/modifymode.php
View file @
a0e412f1
...
...
@@ -22,32 +22,19 @@
<?php
$endpoint
=
intval
(
$_GET
[
"wri"
]);
$endpoint
=
$_POST
[
"wri"
];
$endpoint
=
preg_replace
(
"/[^0-9]/"
,
''
,
$endpoint
);
$endpoint
=
sprintf
(
"%02s"
,
$endpoint
);
$endpoint
=
strval
(
$endpoint
);
$mode
=
$_GET
[
"mode"
];
switch
(
$mode
)
{
case
"master"
:
$new_mode
=
"slave"
;
break
;
case
"slave"
:
$new_mode
=
"auto"
;
break
;
case
"auto"
:
$new_mode
=
"non-wr"
;
break
;
case
"non-wr"
:
$new_mode
=
"none"
;
break
;
case
"none"
:
$new_mode
=
"master"
;
break
;
}
$mode
=
$_POST
[
"mode"
];
$string
=
$_SESSION
[
"KCONFIG"
][
"CONFIG_PORT"
.
$endpoint
.
"_PARAMS"
];
$string
=
str_replace
(
$mode
,
$new_mode
,
$string
);
$portions
=
explode
(
","
,
$string
);
$portions
[
4
]
=
"role="
.
$mode
;
$string
=
implode
(
","
,
$portions
);
$_SESSION
[
"KCONFIG"
][
"CONFIG_PORT"
.
$endpoint
.
"_PARAMS"
]
=
$string
;
save_kconfig
();
...
...
userspace/rootfs_override/var/www/reset.php
0 → 100644
View file @
a0e412f1
<?php
include
'functions.php'
;
include
'head.php'
;
?>
<body
id=
"management"
>
<div
class=
"main"
>
<div
class=
"page"
>
<div
class=
"header"
>
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div
class=
"header-ports"
>
<?php
wrs_header_ports
();
?>
</div>
<div
class=
"topmenu"
>
<?php
include
'topmenu.php'
?>
</div>
</div>
<div
class=
"content"
>
<div
class=
"leftpanel"
>
<h2>
Main Menu
</h2>
<?php
include
'menu.php'
?>
</div>
<div
class=
"rightpanel"
>
<div
class=
"rightbody"
>
<h1
class=
"title"
>
Reboot
&
Reset
<a
href=
'help.php?help_id=firmware'
onClick=
'showPopup(this.href);return(false);'
><img
align=
right
src=
"./img/question.png"
></a></h1>
<?php
session_is_started
();
?>
<h2>
Reboot
</h2>
<br>
<p>
This will reboot your switch
</p>
<br>
<FORM
method=
"POST"
ENCTYPE=
"multipart/form-data"
onsubmit=
"return confirm('Are you sure you want to reboot the switch?');"
>
<th><INPUT
type=
submit
value=
"Reboot"
class=
"btn"
name=
"reboot"
></th>
</FORM>
<br>
<hr>
<br>
<h2>
Reset
</h2>
<br>
<p>
This will reset your switch to the default configuration
</p>
<br>
<FORM
method=
"POST"
ENCTYPE=
"multipart/form-data"
onsubmit=
"return confirm('Are you sure you want to reset the switch?');"
>
<th><INPUT
type=
submit
value=
"Reset"
class=
"btn"
name=
"reset"
></th>
</FORM>
<?php
if
(
isset
(
$_POST
[
'reset'
])){
resetswitch
();
}
if
(
isset
(
$_POST
[
'reboot'
])){
wrs_reboot
();
}
?>
</div>
</div>
</div>
<div
class=
"footer"
>
<?php
include
'footer.php'
?>
</div>
</div>
</div>
</body>
</html>
userspace/rootfs_override/var/www/sfpc
alib
ration.php
→
userspace/rootfs_override/var/www/sfpc
onfigu
ration.php
View file @
a0e412f1
...
...
@@ -27,12 +27,12 @@
$formatID
=
"alternatecolor"
;
$class
=
"altrowstablesmall firstcol"
;
$infoname
=
"SFP C
alib
ration"
;
$infoname
=
"SFP C
onfigu
ration"
;
$vn
=
0
;
$vs
=
0
;
$counter
=
0
;
$header
=
array
(
"Vendor Name"
,
"Vendor Serial"
,
"Model"
,
"tx"
,
"rx"
,
"
wl
_txrx"
);
$header
=
array
(
"Vendor Name"
,
"Vendor Serial"
,
"Model"
,
"tx"
,
"rx"
,
"
λ
_txrx"
);
$matrix
=
array
();
for
(
$i
=
0
;
$i
<
10
;
$i
++
){
...
...
@@ -81,7 +81,7 @@
foreach
(
$matrix
as
$elements
)
{
echo
"<tr>"
;
$element
=
explode
(
","
,
$elements
);
for
(
$j
=
0
;
$j
<
6
;
$j
++
)
{
for
(
$j
=
0
;
$j
<
7
;
$j
++
)
{
$columns
=
explode
(
"="
,
$element
[
$j
]);
if
(
$columns
[
0
]
==
"key"
){
...
...
@@ -127,13 +127,15 @@
$error
=
0
;
if
(
!
empty
(
$_POST
[
"update"
])){
for
(
$j
=
0
;
$j
<
$i
&&
!
$error
;
$j
++
){
if
(
empty
(
$_POST
[
"pn"
.
$j
])
||
empty
(
$_POST
[
"tx"
.
$j
])
||
empty
(
$_POST
[
"tx"
.
$j
])
||
empty
(
$_POST
[
"wl_txrx"
.
$j
])){
if
(
$_POST
[
"pn"
.
$j
]
==
""
||
$_POST
[
"tx"
.
$j
]
==
""
||
$_POST
[
"rx"
.
$j
]
==
""
||
$_POST
[
"wl_txrx"
.
$j
]
==
""
){
echo
"<p>Model, Tx, Rx and WL_TXRX cannot be empty.</p>"
;
$error
=
1
;
}
else
{
}
else
{
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]
=
""
;
if
(
empty
(
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]))
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]
.=
empty
(
$_POST
[
"vn"
.
$j
])
?
""
:
"vn="
.
$_POST
[
"vn"
.
$j
];
else
...
...
@@ -146,9 +148,9 @@
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]
.=
empty
(
$_POST
[
"pn"
.
$j
])
?
""
:
"pn="
.
$_POST
[
"pn"
.
$j
];
else
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]
.=
empty
(
$_POST
[
"pn"
.
$j
])
?
""
:
",pn="
.
$_POST
[
"pn"
.
$j
];
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]
.=
empty
(
$_POST
[
"tx"
.
$j
])
?
""
:
",tx="
.
$_POST
[
"tx"
.
$j
];
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]
.=
empty
(
$_POST
[
"rx"
.
$j
])
?
""
:
",rx="
.
$_POST
[
"rx"
.
$j
];
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]
.=
empty
(
$_POST
[
"wl_txrx"
.
$j
])
?
""
:
",wl_txrx="
.
$_POST
[
"wl_txrx"
.
$j
];
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]
.=
",tx="
.
$_POST
[
"tx"
.
$j
];
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]
.=
",rx="
.
$_POST
[
"rx"
.
$j
];
$_SESSION
[
"KCONFIG"
][
$_POST
[
"key"
.
$j
]]
.=
",wl_txrx="
.
$_POST
[
"wl_txrx"
.
$j
];
}
}
...
...
@@ -157,12 +159,12 @@
save_kconfig
();
apply_kconfig
();
header
(
'Location: sfpc
alib
ration.php'
);
header
(
'Location: sfpc
onfigu
ration.php'
);
}
}
echo
'<hr><div align="right">
<A HREF="sfpc
alib
ration.php?add=y">
<A HREF="sfpc
onfigu
ration.php?add=y">
<img src="img/add.png" style="width:30px;height:30px;vertical-align:center">
<span style="">Add new SFP</span></A>
</div>'
;
...
...
userspace/rootfs_override/var/www/sysinfo.php
View file @
a0e412f1
<?php
include
'functions.php'
;
ob_start
();
if
(
strcmp
(
$_SESSION
[
'LASTIME'
],
filectime
(
$GLOBALS
[
'kconfigfile'
]))
&&
strcmp
(
basename
(
$_SERVER
[
'PHP_SELF'
]),
"reboot.php"
)){
echo
"<script>
alert('WARNING: Dotconfig has been modified. Realoading configuration...');
window.location.href='index.php';
</script>"
;
load_kconfig
();
}
if
(
isset
(
$_SESSION
[
'LAST_ACTIVITY'
])
&&
(
!
empty
(
$_SESSION
[
"myusername"
]))
&&
(
time
()
-
$_SESSION
[
'LAST_ACTIVITY'
]
>
600
))
{
// last request was more than 10 minutes ago
session_unset
();
session_destroy
();
header
(
'Location: index.php'
);
}
$_SESSION
[
'LAST_ACTIVITY'
]
=
time
();
phpinfo
();
if
(
isset
(
$_SESSION
[
'myusername'
]))
{
phpinfo
();
}
else
{
header
(
'Location: index.php'
);
}
?>
userspace/rootfs_override/var/www/wrinfo.php
0 → 100644
View file @
a0e412f1
<?php
include
'functions.php'
;
include
'head.php'
;
?>
<body
id=
"management"
>
<div
class=
"main"
>
<div
class=
"page"
>
<div
class=
"header"
>
<script
type=
"text/javascript"
src=
"js/loadwrinfo.js"
></script>
<!--<h1>White-Rabbit Switch Tool</h1>-->
<div
class=
"header-ports"
>
<?php
wrs_header_ports
();
?>
</div>
<div
class=
"topmenu"
>
<?php
include
'topmenu.php'
?>
</div>
</div>
<div
class=
"content"
>
<div
class=
"leftpanel"
>
<h2>
Main Menu
</h2>
<?php
include
'menu.php'
?>
</div>
<div
class=
"rightpanel"
>
<div
class=
"rightbody"
>
<h1
class=
"title"
>
WR Live Information
<a
href=
'help.php?help_id=wrinfo'
onClick=
'showPopup(this.href);return(false);'
><img
align=
right
src=
"./img/question.png"
></a></h1>
<?php
session_is_started
();
?>
<div
id=
"wrstatus"
></div>
</div>
</div>
</div>
<div
class=
"footer"
>
<?php
include
'footer.php'
?>
</div>
</div>
</div>
</body>
</html>
userspace/tools/wr_mon.c
View file @
a0e412f1
...
...
@@ -494,14 +494,33 @@ void show_ports(int alive)
}
term_cprintf
(
C_WHITE
,
"
\n
"
);
}
else
if
(
mode
&
WEB_INTERFACE
)
{
printf
(
"%-5s "
,
if_name
);
printf
(
"%s "
,
state_up
(
port_state
->
state
)
?
"up"
:
"down"
);
printf
(
"%s "
,
if_mode
);
printf
(
"%s "
,
port_state
->
locked
?
"Locked"
:
"NoLock"
);
printf
(
"%s
\n
"
,
port_state
->
calib
.
rx_calibrated
printf
(
"%s
"
,
port_state
->
calib
.
rx_calibrated
&&
port_state
->
calib
.
tx_calibrated
?
"Calibrated"
:
"Uncalibrated"
);
for
(
j
=
0
;
j
<
ppg
->
nlinks
;
j
++
)
{
if
(
strcmp
(
if_name
,
pp_array
[
j
].
cfg
.
iface_name
)
)
{
/* Instance not for this interface
* skip */
continue
;
}
if
(
state_up
(
port_state
->
state
))
{
unsigned
char
*
p
=
pp_array
[
j
].
peer
;
printf
(
"%02x:%02x:%02x:%02x:%02x:%02x"
" "
,
p
[
0
],
p
[
1
],
p
[
2
],
p
[
3
],
p
[
4
],
p
[
5
]);
}
}
printf
(
"
\n
"
);
}
else
if
(
print_port
)
{
printf
(
"port:%s "
,
if_name
);
printf
(
"lnk:%d "
,
state_up
(
port_state
->
state
));
...
...
@@ -568,12 +587,27 @@ void show_servo(int alive)
term_cprintf
(
C_WHITE
,
"%15.3f nsec
\n
"
,
ppsi_servo_local
.
picos_mu
/
1000
.
0
);
term_cprintf
(
C_BLUE
,
"Estimated link length: "
);
/* (RTT - deltas) / 2 * c / ri
c = 299792458 - speed of light in m/s
ri = 1.4682 - refractive index for fiber g.652. However,
experimental measurements using long (~5km) and
short (few m) fibers gave a value 1.4827
*/
term_cprintf
(
C_WHITE
,
"%10.2f meters
\n
"
,
crtt
/
2
/
1e6
*
299
.
792458
/
1
.
4827
);
term_cprintf
(
C_BLUE
,
"Master-slave delay: "
);
term_cprintf
(
C_WHITE
,
"%15.3f nsec
\n
"
,
ppsi_servo_local
.
delta_ms
/
1000
.
0
);
term_cprintf
(
C_BLUE
,
"Total link asymmetry: "
);
term_cprintf
(
C_WHITE
,
"%15.3f nsec
\n
"
,
total_asymmetry
/
1000
.
0
);
term_cprintf
(
C_WHITE
,
"%15.3f nsec, "
,
total_asymmetry
/
1000
.
0
);
/* print alpha as fixed point number */
term_cprintf
(
C_BLUE
,
"alpha: "
);
term_cprintf
(
C_WHITE
,
"%d
\n
"
,
ppsi_servo_local
.
fiber_fix_alpha
);
/*if (0) {
term_cprintf(C_BLUE, "Fiber asymmetry: ");
...
...
@@ -634,6 +668,14 @@ void show_servo(int alive)
printf
(
"dtxs:%d drxs:%d "
,
ppsi_servo_local
.
delta_tx_s
,
ppsi_servo_local
.
delta_rx_s
);
printf
(
"asym:%lld "
,
total_asymmetry
);
/* (RTT - deltas) / 2 * c / ri
c = 299792458 - speed of light in m/s
ri = 1.4682 - refractive index for fiber g.652. However,
experimental measurements using long (~5km) and
short (few m) fibers gave a value 1.4827
*/
printf
(
"ll:%d "
,
(
int
)
(
crtt
/
2
/
1e6
*
299
.
792458
/
1
.
4827
*
100
));
printf
(
"crtt:%llu "
,
crtt
);
printf
(
"cko:%lld "
,
ppsi_servo_local
.
offset
);
printf
(
"setp:%d "
,
ppsi_servo_local
.
cur_setpoint
);
...
...
@@ -644,18 +686,15 @@ void show_servo(int alive)
/* SPEC shows temperature, but that can be selected separately
* in this program
*/
if
(
mode
==
WEB_INTERFACE
)
printf
(
"
\n
"
);
}
}
void
show_temperatures
(
void
)
{
if
((
mode
==
SHOW_GUI
)
||
(
mode
&
WEB_INTERFACE
))
{
if
(
mode
==
SHOW_GUI
)
{
/* -------------------------------------------------------------------------------*/
if
((
mode
==
SHOW_GUI
))
{
term_cprintf
(
C_CYAN
,
"
\n
-------------------------------- Temperatures ---------------------------------
\n
"
);
}
else
{
term_cprintf
(
C_CYAN
,
"
\n
Temperatures:
\n
"
);
}
term_cprintf
(
C_BLUE
,
"FPGA: "
);
term_cprintf
(
C_WHITE
,
"%2.2f "
,
...
...
@@ -675,12 +714,16 @@ void show_temperatures(void)
printf
(
"pll:%2.2f "
,
temp_sensors_local
.
pll
/
256
.
0
);
printf
(
"psl:%2.2f "
,
temp_sensors_local
.
psl
/
256
.
0
);
printf
(
"psr:%2.2f"
,
temp_sensors_local
.
psr
/
256
.
0
);
if
(
mode
==
WEB_INTERFACE
)
printf
(
"
\n
"
);
}
}
void
show_time
(
void
)
{
printf
(
"TIME sec:%lld nsec:%d "
,
seconds
,
nanoseconds
);
if
(
mode
==
WEB_INTERFACE
)
printf
(
"
\n
"
);
}
void
show_all
(
void
)
...
...
@@ -700,7 +743,7 @@ void show_all(void)
ppsi_alive
=
(
ppsi_head
->
pid
&&
(
kill
(
ppsi_head
->
pid
,
0
)
==
0
))
+
ignore_alive
;
if
(
mode
&
SHOW_WR_TIME
)
{
if
(
mode
&
(
SHOW_WR_TIME
|
WEB_INTERFACE
)
)
{
if
(
ppsi_alive
)
show_time
();
else
if
(
mode
==
SHOW_ALL
)
...
...
@@ -711,7 +754,7 @@ void show_all(void)
show_ports
(
hal_alive
);
}
if
(
mode
&
SHOW_SERVO
||
mode
==
SHOW_GUI
)
{
if
(
mode
&
(
SHOW_SERVO
|
WEB_INTERFACE
)
||
mode
==
SHOW_GUI
)
{
show_servo
(
ppsi_alive
);
}
...
...
@@ -785,7 +828,13 @@ int main(int argc, char *argv[])
init_shm
();
if
(
shw_fpga_mmap_init
()
<
0
)
{
pr_error
(
"Can't initialize FPGA mmap
\n
"
);
exit
(
1
);
}
if
(
mode
&
WEB_INTERFACE
)
{
shw_pps_gen_read_time
(
&
seconds
,
&
nanoseconds
);
read_servo
();
read_hal
();
show_all
();
...
...
@@ -793,12 +842,6 @@ int main(int argc, char *argv[])
}
term_init
(
usecolor
);
if
(
shw_fpga_mmap_init
()
<
0
)
{
pr_error
(
"Can't initialize FPGA mmap
\n
"
);
exit
(
1
);
}
setvbuf
(
stdout
,
NULL
,
_IOFBF
,
4096
);
/* main loop */
...
...
@@ -828,7 +871,6 @@ int main(int argc, char *argv[])
if
(
seconds
!=
last_seconds
)
{
read_servo
();
read_hal
();
show_all
();
last_seconds
=
seconds
;
...
...
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