Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
Software for White Rabbit PTP Core
Commits
8c5a3c94
Commit
8c5a3c94
authored
Feb 01, 2021
by
Adam Wujek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev/sfp: use 64bit to store alpha for SFPs
Signed-off-by:
Adam Wujek
<
adam.wujek@creotech.pl
>
parent
655620ed
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
17 deletions
+26
-17
eeprom.c
dev/eeprom.c
+3
-3
sfp.c
dev/sfp.c
+1
-1
storage.c
dev/storage.c
+2
-2
wrpc.tex
doc/wrpc.tex
+9
-5
sfp.h
include/sfp.h
+1
-1
storage.h
include/storage.h
+4
-2
cmd_sfp.c
shell/cmd_sfp.c
+6
-3
No files found.
dev/eeprom.c
View file @
8c5a3c94
...
...
@@ -25,13 +25,13 @@
* ----------------------------------------------
* | cal_ph_trans (4B) | SFP count (1B) |
* --------------------------------------------------------------------------------------------
* | SFP(1) part number (16B) | alpha (
4
B) | deltaTx (4B) | deltaRx (4B) | chksum(1B) |
* | SFP(1) part number (16B) | alpha (
8
B) | deltaTx (4B) | deltaRx (4B) | chksum(1B) |
* --------------------------------------------------------------------------------------------
* | SFP(2) part number (16B) | alpha (
4
B) | deltaTx (4B) | deltaRx (4B) | chksum(1B) |
* | SFP(2) part number (16B) | alpha (
8
B) | deltaTx (4B) | deltaRx (4B) | chksum(1B) |
* --------------------------------------------------------------------------------------------
* | (....) | (....) | (....) | (....) | (...) |
* --------------------------------------------------------------------------------------------
* | SFP(count) part number (16B) | alpha (
4
B) | deltaTx (4B) | deltaRx (4B) | chksum(1B) |
* | SFP(count) part number (16B) | alpha (
8
B) | deltaTx (4B) | deltaRx (4B) | chksum(1B) |
* --------------------------------------------------------------------------------------------
*
* Fields description:
...
...
dev/sfp.c
View file @
8c5a3c94
...
...
@@ -20,7 +20,7 @@
#include "storage.h"
/* Calibration data (from EEPROM if available) */
int
32_t
sfp_alpha
=
73622176
;
/* default
values if could not read EEPROM */
int
64_t
sfp_alpha
=
1235332333756144
;
/* def
values if could not read EEPROM */
int32_t
sfp_deltaTx
=
0
;
int32_t
sfp_deltaRx
=
0
;
int32_t
sfp_in_db
=
0
;
...
...
dev/storage.c
View file @
8c5a3c94
...
...
@@ -460,12 +460,12 @@ int set_persistent_mac(uint8_t portnum, uint8_t *mac)
* For each sfp we have
*
* - part number (16 bytes)
* - alpha (
4
bytes)
* - alpha (
8
bytes)
* - deltaTx (4 bytes)
* - delta Rx (4 bytes)
* - checksum (1 byte) (low order 8 bits of the sum of all bytes)
*
* the total is
29
bytes for each sfp (ugly, but we are byte-oriented anyways
* the total is
33
bytes for each sfp (ugly, but we are byte-oriented anyways
*/
...
...
doc/wrpc.tex
View file @
8c5a3c94
...
...
@@ -666,11 +666,13 @@ where \texttt{xx:xx:xx:xx:xx:xx} is the MAC address of your board.\\
Next, you should input calibration fixed delays values and alpha parameters. The
example below clears any existing entries and adds two Axcen transceivers with
$
\Delta
_{
TX
}$
,
$
\Delta
_{
RX
}$
and
$
\alpha
$
parameters associated with them.
Please note that the
$
\alpha
$
value is slit into two values. The most
significant
9
decimal digits and the least significant
9
decimal digits.
\begin
{
lstlisting
}
wrc# sfp erase
wrc# sfp add AXGE
-
1254
-
0531
180750
148326
72169888
wrc# sfp add AXGE
-
3454
-
0531
180750
148326
-
73685416
wrc# sfp add AXGE
-
1254
-
0531
180750
148326
1235332
333756144
wrc# sfp add AXGE
-
3454
-
0531
180750
148326
-
1235332
333756144
\end
{
lstlisting
}
To check the content of the SFP database you can execute the
\textit
{
sfp show
}
...
...
@@ -1070,7 +1072,7 @@ Simple verification of performed actions:\\
The same add can also be achieved by performing
\texttt
{
sfp add
}
command in
the WRPC's console:
\begin{lstlisting}
wrc# sfp add NEW-SFP 1111 2222 3333
wrc# sfp add NEW-SFP 1111 2222
0
3333
Update existing SFP entry
3 SFPs in DB
\end{lstlisting}
...
...
@@ -1907,8 +1909,10 @@ tools used to build and run it, you can write to our mailing list
as VHDL generic parameters of the WR PTP Core. Command
\code
{
sdb
}
is
available if
\texttt
{
CONFIG
\_
GENSDBFS
}
is set.
\\
\code
{
sfp add <PN> <deltaTx> <deltaRx> <alpha>
}
&
stores calibration
parameters for SFP to a file in Flash/EEPROM
\\
\code
{
sfp add <PN> <deltaTx> <deltaRx> <alphaH> <alphaL>
}
&
stores calibration
parameters for SFP to a file in Flash/EEPROM.
\code
{
<alphaL>
}
is the 9 lower
decimal digits of alpha value,
\code
{
<alphaH>
}
are the 9 higher decimal
digits. For negative alpha values only
\code
{
<alphaH>
}
is negative.
\\
\code
{
sfp erase
}
&
erases the SFP database stored in the Flash/EEPROM
\\
...
...
include/sfp.h
View file @
8c5a3c94
...
...
@@ -19,7 +19,7 @@
extern
char
sfp_pn
[
SFP_PN_LEN
];
extern
int32_t
sfp_in_db
;
extern
int
32
_t
sfp_alpha
;
extern
int
64
_t
sfp_alpha
;
extern
int32_t
sfp_deltaTx
;
extern
int32_t
sfp_deltaRx
;
...
...
include/storage.h
View file @
8c5a3c94
...
...
@@ -41,8 +41,10 @@
/* It should be:
* #define EE_BASE_INIT (EE_BASE_SFP + sizeof(sfpcount) + \
* SFPS_MAX * sizeof(struct s_sfpinfo))
* The used definition define the start of the init script
5
bytes
* The used definition define the start of the init script
21
bytes
* (sizeof(sfpcount) + sizeof(t24p)) before the end of SFP database.
* Edit: Since the alpha was changed to 64bit, the size of sizeof(struct s_sfpinfo)
* increased by 4. The error is now 5 + 16 = 21 bytes, not 5 as before.
* To make the init script working during the update of old versions of wrpc
* SFPS_MAX is limited to 3. Adding the 4th SFP will corrupt the init script
* anyway.
...
...
@@ -73,7 +75,7 @@ struct storage_device;
struct
s_sfpinfo
{
char
pn
[
SFP_PN_LEN
];
int
32
_t
alpha
;
int
64
_t
alpha
;
int32_t
dTx
;
int32_t
dRx
;
uint8_t
chksum
;
...
...
shell/cmd_sfp.c
View file @
8c5a3c94
...
...
@@ -47,7 +47,7 @@ static int cmd_sfp(const char *args[])
return
-
EIO
;
}
return
0
;
}
else
if
(
args
[
4
]
&&
!
strcasecmp
(
args
[
0
],
"add"
))
{
}
else
if
(
args
[
5
]
&&
!
strcasecmp
(
args
[
0
],
"add"
))
{
temp
=
strnlen
(
args
[
1
],
SFP_PN_LEN
);
for
(
i
=
0
;
i
<
temp
;
++
i
)
sfp
.
pn
[
i
]
=
args
[
1
][
i
];
...
...
@@ -56,6 +56,9 @@ static int cmd_sfp(const char *args[])
sfp
.
dTx
=
atoi
(
args
[
2
]);
sfp
.
dRx
=
atoi
(
args
[
3
]);
sfp
.
alpha
=
atoi
(
args
[
4
]);
sfp
.
alpha
=
sfp
.
alpha
*
1000000000
;
/* first value defines a sign */
sfp
.
alpha
+=
(
sfp
.
alpha
<
0
?-
1
:
1
)
*
atoi
(
args
[
5
]);
temp
=
storage_get_sfp
(
&
sfp
,
SFP_ADD
,
0
);
if
(
temp
==
EE_RET_DBFULL
)
{
pp_printf
(
"SFP DB is full
\n
"
);
...
...
@@ -83,7 +86,7 @@ static int cmd_sfp(const char *args[])
pp_printf
(
"%d: PN:"
,
i
+
1
);
for
(
temp
=
0
;
temp
<
SFP_PN_LEN
;
++
temp
)
pp_printf
(
"%c"
,
sfp
.
pn
[
temp
]);
pp_printf
(
" dTx: %8d dRx: %8d alpha: %
8
d
\n
"
,
sfp
.
dTx
,
pp_printf
(
" dTx: %8d dRx: %8d alpha: %
19L
d
\n
"
,
sfp
.
dTx
,
sfp
.
dRx
,
sfp
.
alpha
);
}
return
0
;
...
...
@@ -112,7 +115,7 @@ static int cmd_sfp(const char *args[])
return
ret
;
}
/* match successful */
pp_printf
(
"SFP matched, dTx=%d dRx=%d alpha=%d
\n
"
,
pp_printf
(
"SFP matched, dTx=%d dRx=%d alpha=%
L
d
\n
"
,
sfp_deltaTx
,
sfp_deltaRx
,
sfp_alpha
);
return
ret
;
}
else
if
(
args
[
1
]
&&
!
strcasecmp
(
args
[
0
],
"ena"
))
{
...
...
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