Commit e616f26c authored by Adam Wujek's avatar Adam Wujek

Merge master

Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parents 70765afa 7006f56b
Introduction
=============
Most of the source code has been written according to the LGPL v2.1 license,
however some restrictions described below need to be considered.
Please look the the ppsi documentation for more information about licensing.
LGPL v2.1 License
==================
For some specific architecture (arch-wrs), the ppsi can be compiled using only
LGPL source code (if some diagnostic functionalities are disabled) and therefore
be distribute as a LGPL library together with proprietary code.
GPL v2 License
===============
If ppsi is compiled embedded within the wrpc-sw, it wil therefore fall under the
GPL v2 license due to the following points:
printf
-----------
Both the full and the partial printf code is distributed according to
the GPL-2, as it comes from the Linux kernel. This means that any
code using our diagnostics fall under the GPL requirements; you may
compile and use the diagnostic code internally with your own
proprietary code but you can't distribute binaries with diagnostics
without the complete source code and associated rights. You may avoid
the GPL requirements by using different printf implementations; if so
we'd love to have them contributed back in the package.
arch-wrc (lm32)
----------------
The same issue about the GPL license applies to the @i{div64_32}
function. We need this implementation in our @i{wrpc} code base
because the default @i{libgcc} division is very big, and we are always
tight with our in-FPGA memory space.
......@@ -4,6 +4,9 @@ A := arch-$(ARCH)
CFLAGS += -Itools
# needed for --gc-sections option of ld
PPSI_O_LDFLAGS = --entry=main
OBJ-y += $A/unix-startup.o \
$A/main-loop.o \
$A/unix-io.o \
......@@ -14,7 +17,8 @@ OBJ-y += $A/unix-startup.o \
lib/dump-funcs.o \
lib/drop.o \
lib/assert.o \
lib/div64.o
lib/div64.o \
lib/time-arith.o
# The user can set TIME=, but we pick unix time by default
TIME ?= unix
......
/*
* Copyright (C) 2011 CERN (www.cern.ch)
* Copyright (C) 2011-2022 CERN (www.cern.ch)
* Author: Alessandro Rubini
*
* Released to the public domain
......@@ -24,8 +24,26 @@ static int run_all_state_machines(struct pp_globals *ppg)
int j;
int delay_ms = 0, delay_ms_j;
/* TODO: check if in GM mode and initialized */
for (j = 0; j < ppg->nlinks; j++) {
struct pp_instance *ppi = INST(ppg, j);
int old_lu = ppi->link_up;
/* TODO: add the proper discovery of link_up */
ppi->link_up = 1;
if (old_lu != ppi->link_up) {
pp_diag(ppi, fsm, 1, "iface %s went %s\n",
ppi->iface_name, ppi->link_up ? "up" : "down");
if (ppi->link_up) {
ppi->state = PPS_INITIALIZING;
/* TODO: Get calibration values here */
}
}
delay_ms_j = pp_state_machine(ppi, NULL, 0);
/* delay_ms is the least delay_ms among all instances */
......@@ -35,6 +53,22 @@ static int run_all_state_machines(struct pp_globals *ppg)
delay_ms = delay_ms_j;
}
/* BMCA must run at least once per announce interval 9.2.6.8 */
if (pp_gtimeout(ppg, PP_TO_BMC)) {
/* Calculation of erbest, ebest, ... */
bmc_calculate_ebest(ppg);
pp_gtimeout_reset(ppg, PP_TO_BMC);
delay_ms = 0;
/* TODO: Check PLL state if needed/available */
} else {
/* check if the BMC timeout is the next to run */
int delay_bmca;
if ((delay_bmca = pp_gnext_delay_1(ppg, PP_TO_BMC)) < delay_ms)
delay_ms = delay_bmca;
}
return delay_ms;
}
......@@ -48,8 +82,6 @@ void unix_main_loop(struct pp_globals *ppg)
for (j = 0; j < ppg->nlinks; j++) {
ppi = INST(ppg, j);
/* just tell that the links are up */
ppi->link_up = TRUE;
/*
* The main loop here is based on select. While we are not
......@@ -62,32 +94,14 @@ void unix_main_loop(struct pp_globals *ppg)
delay_ms = run_all_state_machines(ppg);
while (1) {
int i;
/*
* If Ebest was changed in previous loop, run best
* master clock before checking for new packets, which
* would affect port state again
*/
if (ppg->ebest_updated) {
for (j = 0; j < ppg->nlinks; j++) {
int new_state;
struct pp_instance *ppi = INST(ppg, j);
new_state = bmc(ppi);
if (new_state != ppi->state) {
ppi->state = new_state;
ppi->is_new_state = 1;
}
}
ppg->ebest_updated = 0;
}
int packet_available;
i = unix_net_ops.check_packet(ppg, delay_ms);
packet_available = unix_net_ops.check_packet(ppg, delay_ms);
if (i < 0)
if (packet_available < 0)
continue;
if (i == 0) {
if (packet_available == 0) {
delay_ms = run_all_state_machines(ppg);
continue;
}
......@@ -99,7 +113,7 @@ void unix_main_loop(struct pp_globals *ppg)
delay_ms = -1;
for (j = 0; j < ppg->nlinks; j++) {
int tmp_d;
int tmp_d, i;
ppi = INST(ppg, j);
if ((ppi->ch[PP_NP_GEN].pkt_present) ||
......
/*
* Copyright (C) 2011 CERN (www.cern.ch)
* Copyright (C) 2011-2022 CERN (www.cern.ch)
* Author: Alessandro Rubini
*
* Released to the public domain
......@@ -23,16 +23,36 @@
#include <ppsi/ppsi.h>
#include "ppsi-unix.h"
char *format_hex(char *s, const unsigned char *mac, int cnt);
char *format_hex8(char *s, const unsigned char *mac);
/* ppg and fields */
static struct pp_globals ppg_static;
static defaultDS_t defaultDS;
static currentDS_t currentDS;
static parentDS_t parentDS;
static timePropertiesDS_t timePropertiesDS;
static struct pp_servo servo;
extern struct pp_ext_hooks pp_hooks;
/**
* Enable/disable asymmetry correction
*/
static void enable_asymmetryCorrection(struct pp_instance *ppi, Boolean enable ) {
if ((ppi->asymmetryCorrectionPortDS.enable = enable) == TRUE ) {
/* Enabled: The delay asymmetry will be calculated */
ppi->asymmetryCorrectionPortDS.scaledDelayCoefficient =
(ppi->cfg.scaledDelayCoefficient != 0) ?
ppi->cfg.scaledDelayCoefficient :
(RelativeDifference)(ppi->cfg.delayCoefficient * REL_DIFF_TWO_POW_FRACBITS);
ppi->portDS->delayAsymCoeff =
pp_servo_calculateDelayAsymCoefficient(ppi->asymmetryCorrectionPortDS.scaledDelayCoefficient);
}
ppi->asymmetryCorrectionPortDS.constantAsymmetry =
picos_to_interval(ppi->cfg.constantAsymmetry_ps);
}
int main(int argc, char **argv)
{
struct pp_globals *ppg;
......@@ -45,12 +65,20 @@ int main(int argc, char **argv)
pp_printf("PPSi. Commit %s, built on " __DATE__ "\n", PPSI_VERSION);
/* So far allow more than one instance of PPSi running on the same
* machine.
TODO: to be considered to allow only one instance of PPSi to run
* at the same time.
* Potential problems my be in:
* shmem (not used in arch-unix)
* race of setting of time if more than one instance run as slave
*/
ppg = &ppg_static;
ppg->defaultDS = &defaultDS;
ppg->currentDS = &currentDS;
ppg->parentDS = &parentDS;
ppg->timePropertiesDS = &timePropertiesDS;
ppg->servo = &servo;
ppg->rt_opts = &__pp_default_rt_opts;
/* We are hosted, so we can allocate */
......@@ -63,17 +91,17 @@ int main(int argc, char **argv)
exit(1);
}
/* Before the configuration is parsed, set defaults */
/* Set default configuration value for all instances */
for (i = 0; i < ppg->max_links; i++) {
ppi = INST(ppg, i);
ppi->proto = PP_DEFAULT_PROTO;
ppi->role = PP_DEFAULT_ROLE;
ppi->delayMechanism = MECH_E2E;
memcpy(&INST(ppg, i)->cfg, &__pp_default_instance_cfg,
sizeof(__pp_default_instance_cfg));
}
/* Set offset here, so config parsing can override it */
if (adjtimex(&t) >= 0)
timePropertiesDS.currentUtcOffset = t.tai;
memset(&t, 0, sizeof(t));
if (adjtimex(&t) >= 0) {
ppg->timePropertiesDS->currentUtcOffset = (Integer16)t.tai;
}
if (pp_parse_cmdline(ppg, argc, argv) != 0)
return -1;
......@@ -81,6 +109,8 @@ int main(int argc, char **argv)
/* If no item has been parsed, provide a default file or string */
if (ppg->cfg.cfg_items == 0)
pp_config_file(ppg, 0, PP_DEFAULT_CONFIGFILE);
/* No config found, add default */
if (ppg->cfg.cfg_items == 0)
pp_config_string(ppg, strdup("link 0; iface eth0; proto udp"));
......@@ -95,21 +125,113 @@ int main(int argc, char **argv)
ppi->iface_name = ppi->cfg.iface_name;
ppi->port_name = ppi->cfg.port_name;
ppi->delayMechanism = ppi->cfg.delayMechanism;
ppi->ext_hooks= &pp_hooks;
ppi->portDS = calloc(1, sizeof(*ppi->portDS));
ppi->servo = calloc(1, sizeof(*ppi->servo));
ppi->ext_hooks = &pp_hooks;
ppi->ptp_support = TRUE;
if (ppi->portDS) {
switch (ppi->cfg.profile) {
case PPSI_PROFILE_WR:
#if CONFIG_HAS_PROFILE_WR
ppi->protocol_extension = PPSI_EXT_WR;
/* Add WR extension portDS */
if ( !(ppi->portDS->ext_dsport =
wrs_shm_alloc(ppsi_head,
sizeof(struct wr_dsport))
)
) {
goto exit_out_of_memory;
}
/* Allocate WR data extension */
if (! (ppi->ext_data =
wrs_shm_alloc(ppsi_head,
sizeof(struct wr_data))
)
) {
goto exit_out_of_memory;
}
/* Set WR extension hooks */
ppi->ext_hooks = &wr_ext_hooks;
enable_asymmetryCorrection(ppi, TRUE);
#else
fprintf(stderr, "ppsi: Profile WR not supported");
exit(1);
#endif
break;
case PPSI_PROFILE_HA:
#if CONFIG_HAS_PROFILE_HA
if (!enable_l1Sync(ppi, TRUE))
goto exit_out_of_memory;
/* Force mandatory attributes - Do not take care of the configuration */
L1E_DSPOR_BS(ppi)->rxCoherentIsRequired = TRUE;
L1E_DSPOR_BS(ppi)->txCoherentIsRequired = TRUE;
L1E_DSPOR_BS(ppi)->congruentIsRequired = TRUE;
L1E_DSPOR_BS(ppi)->L1SyncEnabled = TRUE;
L1E_DSPOR_BS(ppi)->optParamsEnabled = FALSE;
enable_asymmetryCorrection(ppi, TRUE);
#else
fprintf(stderr, "ppsi: Profile HA not supported");
exit(1);
#endif
break;
case PPSI_PROFILE_PTP :
/* Do not take care of L1SYNC */
enable_asymmetryCorrection(ppi,
ppi->cfg.asymmetryCorrectionEnable);
ppi->protocol_extension = PPSI_EXT_NONE;
break;
case PPSI_PROFILE_CUSTOM :
#if CONFIG_HAS_PROFILE_CUSTOM
ppi->protocol_extension = PPSI_EXT_NONE; /* can be changed ...*/
#if CONFIG_HAS_EXT_L1SYNC
if (ppi->cfg.l1SyncEnabled) {
if (!enable_l1Sync(ppi, TRUE))
goto exit_out_of_memory;
/* Read L1SYNC parameters */
L1E_DSPOR_BS(ppi)->rxCoherentIsRequired = ppi->cfg.l1SyncRxCoherencyIsRequired;
L1E_DSPOR_BS(ppi)->txCoherentIsRequired = ppi->cfg.l1SyncTxCoherencyIsRequired;
L1E_DSPOR_BS(ppi)->congruentIsRequired = ppi->cfg.l1SyncCongruencyIsRequired;
L1E_DSPOR_BS(ppi)->optParamsEnabled = ppi->cfg.l1SyncOptParamsEnabled;
if (L1E_DSPOR_BS(ppi)->optParamsEnabled) {
L1E_DSPOR_OP(ppi)->timestampsCorrectedTx = ppi->cfg.l1SyncOptParamsTimestampsCorrectedTx;
}
}
enable_asymmetryCorrection(ppi, ppi->cfg.asymmetryCorrectionEnable);
#endif
#else
fprintf(stderr, "ppsi: Profile CUSTOM not supported");
exit(1);
#endif
break;
}
/* Parameters profile independent */
ppi->timestampCorrectionPortDS.egressLatency = picos_to_interval(ppi->cfg.egressLatency_ps);
ppi->timestampCorrectionPortDS.ingressLatency = picos_to_interval(ppi->cfg.ingressLatency_ps);
ppi->timestampCorrectionPortDS.messageTimestampPointLatency = 0;
ppi->portDS->masterOnly = ppi->cfg.masterOnly; /* can be overridden in pp_init_globals() */
} else {
goto exit_out_of_memory;
}
/* The following default names depend on TIME= at build time */
ppi->n_ops = &DEFAULT_NET_OPS;
ppi->t_ops = &DEFAULT_TIME_OPS;
ppi->portDS = calloc(1, sizeof(*ppi->portDS));
ppi->__tx_buffer = malloc(PP_MAX_FRAME_LENGTH);
ppi->__rx_buffer = malloc(PP_MAX_FRAME_LENGTH);
if (!ppi->portDS || !ppi->__tx_buffer || !ppi->__rx_buffer) {
fprintf(stderr, "ppsi: out of memory\n");
exit(1);
goto exit_out_of_memory;
}
}
pp_init_globals(ppg, &__pp_default_rt_opts);
seed = time(NULL);
......@@ -119,4 +241,32 @@ int main(int argc, char **argv)
unix_main_loop(ppg);
return 0; /* never reached */
exit_out_of_memory:
fprintf(stderr, "ppsi: out of memory\n");
exit(1);
}
char *format_hex(char *s, const unsigned char *mac, int cnt)
{
int i;
*s = '\0';
for (i = 0; i < cnt; i++) {
pp_sprintf(s, "%s%02x:", s, mac[i]);
}
/* remove last colon */
s[cnt * 3 - 1] = '\0'; /* cnt * strlen("FF:") - 1 */
return s;
}
char *format_hex8(char *s, const unsigned char *mac)
{
return format_hex(s, mac, 8);
}
char *format_mac(char *s, const unsigned char *mac)
{
format_hex(s, mac, 6);
return s;
}
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow.
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU GENERAL PUBLIC LICENSE
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
collective works based on the Library.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
the Library or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
You are not responsible for enforcing compliance by third parties with
this License.
7. If, as a consequence of a court judgment or allegation of patent
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
......@@ -226,114 +402,101 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
This library 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.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1989
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
That's all there is to it!
\ No newline at end of file
......@@ -5,10 +5,10 @@
* Author: Alessandro Rubini <rubini@gnudd.com>
* Based on ideas by Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* 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 library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*/
#include <stdio.h>
#include <stdlib.h>
......
......@@ -5,10 +5,10 @@
* Author: Alessandro Rubini <rubini@gnudd.com>
* Based on ideas by Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* 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 library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*/
#include <stdio.h>
#include <stdlib.h>
......
......@@ -5,10 +5,10 @@
* Author: Alessandro Rubini <rubini@gnudd.com>
* Based on ideas by Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* 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 library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*/
#ifndef __MINIPC_INT_H__
#define __MINIPC_INT_H__
......
......@@ -7,6 +7,12 @@
* This replicates some code of minipc-core and minipc-server.
* It implements the functions needed to make a freestanding server
* (for example, an lm32 running on an FPGA -- the case I actually need).
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*/
#include "minipc-int.h"
......
......@@ -5,10 +5,10 @@
* Author: Alessandro Rubini <rubini@gnudd.com>
* Based on ideas and code by Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* 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 library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*/
#include <stdio.h>
#include <stdlib.h>
......
......@@ -5,10 +5,10 @@
* Author: Alessandro Rubini <rubini@gnudd.com>
* Based on ideas by Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* 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 library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*/
#ifndef __MINIPC_H__
#define __MINIPC_H__
......
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <ppsi/ppsi.h>
#include <libwr/util.h>
#include <arpa/inet.h> /* for ntohl */
......
......@@ -35,7 +35,7 @@
@setchapternewpage off
@set update-month February 2020
@set update-month October 2022
@set release __RELEASE_GIT_ID__
@finalout
......@@ -44,7 +44,7 @@
@title PPSi Manual
@subtitle @value{update-month} (@value{release})
@subtitle Documentation about ``PTP Ported to Silicon''
@author A. Rubini, A.Colosimo and J-C Bau for CERN (be-co-ht)
@author A. Rubini, A.Colosimo, A.Wujek, J-C Bau for CERN
@end titlepage
@headings single
......@@ -60,6 +60,9 @@
PPSi (@sc{ptp} Ported to Silicon) is an application which, in
its basic operation, implements @sc{ieee} 1588-2019 specification in a way
that is portable to several architectures, including OS-less ones.
The current version of PPSi is compatible with @sc{ieee} 1588-2008
(@sc{ptp} version 2) and includes a number of optional features specified
in @sc{ieee} 1588-2019 (@sc{ptp} version 2.1).
This manual is mainly aimed at developers: people who are working with
@sc{ptp} and/or White Rabbit and need to use the protocol in their own
......@@ -76,8 +79,9 @@ shortened to @i{WR} in this manual.
WR is a multi-lab research project that aims at synchronizing
thousands of I/O devices distributed in a network several kilometers
wide; its software protocol is an extension of @sc{ptp}. A WR network is
made up of two devices: the @i{WR Switch} and the @i{WR Node}. White
wide; its software protocol is an extension of @sc{ptp}, @sc{wr-ptp}.
A WR network is
made up of two types of devices: the @i{WR Switch} and the @i{WR Node}. White
Rabbit is developed at ohwr.org:
@url{https://www.ohwr.org/project/white-rabbit}.
......@@ -94,27 +98,23 @@ implementation used in WR, running both standard @sc{ptp} and
The algorithm and computation routines regarding the basic @sc{ieee} 1588
are derived from the @i{PTPd} project, v.2.1.0 (see AUTHORS for details
about copyright); but as of March 2013 very little remains of the original
code base. In addition to the basic feature set we inherited from @i{PTPd},
we support raw Ethernet frames (@t{ETH_P_1588}), according to Annex F of the
specification and support for protocol extensions.
code base. In addition to the basic feature set the project inherited from
@i{PTPd}, the PPSI supports raw Ethernet frames (@t{ETH_P_1588}),
according to Annex F of the @sc{ieee} 1588 and support for protocol extensions.
We thank Danilo Sabato for fixing the @i{bare} architectures
Authors thank Danilo Sabato for fixing the @i{bare} architectures
(see @ref{Architectures}).
The home page of the PPSi project and the source repository are:
@indentedblock
@itemize @bullet
@item @url{https://www.ohwr.org/project/ppsi}
@item ssh://git@@ohwr.org:7999/project/ppsi.git
@end itemize
@end indentedblock
@url{https://www.ohwr.org/project/ppsi}
@c ##########################################################################
@node Status Features and Bugs
@chapter Status, Features, Bugs
This document tries to summarize the status of
the project, but we are working a lot on the package,
the project, but the development is still being done on the package,
so information here may be slightly out of date with respect to code.
The software package is designed to be modular: each of architectures,
......@@ -125,8 +125,8 @@ protocols and timing engine
@node Build-time Configuration
@section Build-time Configuration
After release 2013.11 we added to PPSi the Kconfig configuration
engine. Configuration is now performed by running ``@t{make
PPSi uses the Kconfig configuration
engine. Configuration is performed by running ``@t{make
menuconfig}'' or equivalent command.
A number of ready-to use configuration files are distributed in the
......@@ -142,8 +142,8 @@ running the standard @sc{ptp} version 2 protocol.
When building PPSi, the user can specify which architecture to build
for, by selecting it in @t{make menuconfig} or equivalent configuration
command. When cross-compiling, you need to tell your cross-compiler
prefix in the configuration step, or override it at build time
command. When cross-compiling, it is need to tell cross-compiler
a prefix in the configuration step, or override it at build time
by passing @t{CROSS_COMPILE=} on the command line.
The package currently supports the following architectures:
......@@ -156,8 +156,8 @@ The package currently supports the following architectures:
environment. The architecture is usually tested over the Linux
kernel using the standard GNU libraries. Most of the code relies
on standard @sc{posix} conventions, so this architecture most
likely works on @sc{bsd} and other variants as well. We may
change naming accordingly, after identifying the weak
likely works on @sc{bsd} and other variants as well. In the future
the name may change accordingly, after identifying the weak
(i.e. unportable) points. This architecture supports the standard
protocol on both @sc{udp} and raw Ethernet, also both at the
same time thanks to the per-link split of I/O methods.
......@@ -170,16 +170,18 @@ The package currently supports the following architectures:
separate architecture, even if the switch itself is a Linux
system running on an ARM processor. The switch is a complex
system, with several daemons cooperating through an IPC
mechanism: the standard main loop for a standalone Unix daemon
and shared memory mechanisms: the standard main loop for a
standalone Unix daemon
doesn't apply to the WR switch, and modelling it as a
separate architecture is the simplest and cleanest approach,
in our opinion (even if it leads to some code duplication).
separate architecture is the simplest and cleanest approach
(even if it leads to some code duplication).
The architectures relies on @i{time-wrs}.
@item wrpc
The @i{White Rabbit PTP Core} architecture is a port of PPSi to
run on our I/O devices. The @i{wrpc} is a ``@i{core}'', i.e. a
run on I/O devices. inside a Field Programmable Gate Array
(FPGA) chip. The @i{wrpc} is a ``@i{core}'', i.e. a
logic block, that runs in WR-capable I/O cards. Most such cards
are developed as open hardware on @i{ohwr.org}; examples are
the @sc{spec} (a PCIe carrier for FMC devices) and the @sc{svec}
......@@ -196,13 +198,13 @@ The package currently supports the following architectures:
to simulate a master and a slave exchanging ptp frames.
Arch-specific configuration options are implemented in
@i{arch-sim/sim-conf.c}. Use of the simulator is briefly
descibed in @ref{Configuring the Simulator}.
described in @ref{Configuring the Simulator}.
@item bare-i386
This architecture uses system calls towards the Linux kernel but
does not rely on standard libraries. The port only supports
raw Ethernet frames and is thought to be a validation for our
raw Ethernet frames and is thought to be a validation for
@i{freestanding} ports. The process built as @i{bare-i386}
runs on conventional x86 Linux hosts and demonstrates that
PPSi works properly with no added dependencies on external
......@@ -219,9 +221,9 @@ The package currently supports the following architectures:
@end table
We plan, over time, to support microcontrollers (a beta version for
ARM7 is working, and we are considering Cortex-M) and @i{bare-arm} (to
be tested on the WR switch).
@c We plan, over time, to support microcontrollers (a beta version for
@c ARM7 is working, and we are considering Cortex-M) and @i{bare-arm} (to
@c be tested on the WR switch).
@c ==========================================================================
@node Protocols
......@@ -229,36 +231,51 @@ be tested on the WR switch).
At build time, the user can select the standard protocol (selected by
default by most architectures) or an extension.
The code base only includes one extension, White Rabbit, which is the
default choice when building for one of the WR architectures.
Nothing in PPSi
prevents our fellow developers to support their own @i{ptp} extension
using PPSi.
The code base includes three extensions:
@indentedblock
@itemize @bullet
@item White Rabbit (WR) - specified in "White Rabbit Specification", v2.0:
@url{http://white-rabbit.web.cern.ch/documents/WhiteRabbitSpec.v2.0.pdf},
@item Layer 1 Syntonization (L1Sync, a.k.a. High Accuracy) - the experimental
implementation of a profile specified in Annex L of @sc{ieee} 1588-2019.
@item @i{Custom} - the experimental profile that allows free access to all
options and attributes
@end itemize
@end indentedblock
White Rabbit extension is the default choice when building for one of the
WR architectures.
The selection of the used extension (or standard PTP) is done in run-time by
a proper configuration.
PPSi can be easily expanded with a support of a new @i{ptp} profile.
Each extension lives in a subdirectory called @t{proto-ext-}@i{name}.
Source files in that directory may override the implementation for the
standard protocol (which lives in @t{proto-standard}) to provide their
own functionalities. To simplify writing extensions, the @i{proto-standard}
own functionalities. There is also a subdirectory @t{proto-ext-common}
which holds common code for all available extensions.
To simplify writing extensions, the @i{proto-standard}
functions already provide @i{hooks} so the extension itself can provide
callbacks while still using the basic @sc{ptp} engine.
The set of callbacks is currently based on the needs of
WR, but we are willing to accept patches to provide more hooks as
needed.
WR and L1Sync, but it can be easily expanded if more hooks are needed.
If you plan to write your own protocol extension within PPSi, please
refer to how @i{proto-ext-whiterabbit} is implemented.
The implementation of @i{proto-ext-whiterabbit} can act as a good reference
for future implementations of protocol extension.
@c ==========================================================================
@node Time Functions and Network Operations
@section Time Functions and Network Operations
PPSi supports custom implementations of time functions, so you can
easily port the daemon to your own timing primitives.
PPSi supports custom implementations of time functions, so it can
easily port the daemon to a new timing primitives.
The subdirectories named @i{time-xxxx} are used to implement timing
functions; timing includes the methods that are part of two data
structures: @i{pp_time_operations} and @i{pp_network_operations}. The
former structure deals with getting and setting system time, while the
former structure deals with getting and setting system/WR time, while the
latter deals with frame tx and rx. Network operations are concerned
with timestamping the actual I/O, and that's why they are considered
part of the ``timing'' of PPSi.
......@@ -272,28 +289,21 @@ suggests Unix timing code ('@t{TIME?=unix}'). The choice for '@t{TIME=}'
is not currently selected using Kconfig, because nobody is expected
to diverge from the default choice for the architecture being built.
If you want to support a different timing engine within the Unix build
system, you can use '@t{make TIME=xyz}' to request building
To support a different timing engine within the Unix build
system, '@t{make TIME=xyz}' can be used to request building
the @i{time-xxxx} subdirectory. Please note that the Unix time
structures are built anyways for '@t{CONFIG_ARCH=unix}',
so you can piggy-back on those
functions, either within your own methods or by replacing the
so it can piggy-back on those
functions, either within own methods or by replacing the
@t{ppi->t_ops} and @t{ppi->n_ops} for the communications links that do
not include your own hardware support.
not include the hardware support.
@c ==========================================================================
@node Features
@section Features
This is a summary of current and planned features for the PPSi
package. As said, we are still working on it, so the following
list may be not up to date with software developments by the time you
read it.
The following list of features doesn't consider known bugs, which are
listed in the following sections. Please consider such bugs transient
mishaps, as we are working on them right now; anyways, it would be
unfair to hide them.
package.
@table @r
......@@ -303,93 +313,114 @@ unfair to hide them.
it detects that its peers are not able to speak the extended
protocol. Many extensions are now supported in
a single build. In a near future, the new protocol extension L1SYNC
used by the High Acurracy (@sc{HA}) profile will be released.
used by the High Accuracy (@sc{HA}) profile will be released.
@item Support both hosted and freestanding environments.
This is already supported, though we still lack a microcontroller
implementation, and our only freestanding environment is @i{wrpc},
running on an LM32 processor.
This is already supported, though PPSi still lacks a microcontroller
implementation, and the only freestanding environment is @i{wrpc},
running on an LM32 or RISCV soft-processor.
@item Support multi-link operation.
@item Support multi-PTP link operation.
The daemon manages several links at the same time, being master
slave or auto-detect independently on each link.
The @i{best master clock} algorithm is run globally,
The daemon manages several PTP links at the same time, being configured
as master/slave or auto-detecting its role on each link using
@i{best master clock algorithm} (BMCA).
The @i{BMCA} is run globally,
but communication and timeouts are managed per-link.
@item Support both @sc{udp} and raw Ethernet.
We already do that. We use the multi-link operation to
PPSi uses the multi PTP-link operation to
support both @sc{udp} and raw Ethernet on the same network
interface. Also, we support @sc{udp} in the WR switch,
to allow progressive and seamless migration to WR if you already
support @sc{ptp} in your network with a @sc{udp}-only implementation.
interface (physical port). PPSi supports @sc{udp} in the WR switch,
to allow progressive and seamless migration to WR network of devices
that already support @sc{ptp} with a @sc{udp}-only implementation.
@item Support fall-back master links.
This is needed for WR, and is being worked on.
We need to track more than one master in order to switch over
This feature is only partly implemented. With the help of BMCA it is
possible to track more than one master (other are passive).
However, the reconfiguration takes number of seconds.
The tracking of more than one master with a switch over
from one to the other within a few milliseconds and with no
time glitches.
time glitches is not available now.
@item Support hardware timestamping where available.
This is not yet implemented for the generic protocol, but we
plan to add at least @i{time-linux-tstamp} soon.
@item Support @sc{bsd} specifics.
Unfortunately the @i{hosted} part of the packages is slightly
too much Linux-dependent. We plan to support the @sc{bsd}
variants as well, hoping to get interest and patches from some
@sc{bsd} developer.
Hardware timestamping is supported in WR devices.
However, This is not yet implemented for the generic protocol.
@item Allow architectures to state their capabilities.
Currently the command-line arguments are a an all-or-nothing thing.
Currently the command-line arguments are an all-or-nothing thing.
But, for example, @i{bare} architectures don't support
@sc{udp} and other architectures may not support raw Ethernet.
We plan to allow architectures to state their capabilities to
It is planed to allow architectures to state their capabilities to
report proper errors when the user tries to set up unimplemented
configurations.
@item Support run-time enable/disable of diagnostics.
We want to allow run-time modification of diagnostics flags
with a per-link granularity. Currently we have configuration-based
It is planned to allow run-time modification of diagnostics flags
with a per-link granularity. Currently there are configuration-based
per-link diagnostic flags and global diagnostic
flags that can be changed
flags. Only some architectures allows that it can be changed
at run time (for example, arch-wrpc offers that through a shell
command). We think this feature is useful
when you run more than a pair of interfaces and have problems
on some of the links but not all of them.
command). It is believed that this feature is useful
for systems with more than a pair of interfaces and have problems
on some of the links but not all of them.
@item Access of internal structures in run-time
PPSi keeps almost all of its internal data in shared memory.
Thanks to this the internal state can be exported and monitored by
external tools. For example SNMP agent implemented on WR Switch uses
this mechanism to provide monitoring data for external tools.
The dumps of PPSi's memory (of live or crashed process) can be used to
investigate the internal state. There are tools,
@t{wrs_dump_shmem} (for WR Switch) and @t{wrpc-dump} (for WR Node) that
can translate binary dumps into user-friendly text form.
PPSi increases a special counter before and after each write to
the shared memory increases, which can ensure the data consistency.
@item Runtime re-configuration
Currently, the configuration of PPSi is provided at startup and
only some parameters on a limited number of architectures (WR node)
can be changed. It would be very useful to be able to
change some of the @sc{ptp} and extensions configuration without
the need of restarting PPSi (and resynchronizing). Such runtime
re-configuration could include ClockClass priority, packet rate
or enable/allowed extensions. Implementing full run-time reconfiguration
is on project's todo list.
@end table
@c ==========================================================================
@node Bugs
@section Bugs
As of 2013-05 the project suffers from these known bugs:
@itemize
@item All frames must be sent according to a pseudo-random distribution;
this is mostly in place but must be audited project-wide.
@item We removed @i{peer-delay} support. We plan to add it back, and
actually move White Rabbit to use @i{peer-delay} @sc{ptp} instead of
@i{end-to-end} @sc{ptp}.
@item The servo for standard-@sc{ptp} must be audited. We are doing
it now using @i{arch-sim} support,
@item @sc{udp} over @sc{IPV6} is not yet supported.
@end itemize
@c @node Bugs
@c @section Bugs
@c
@c As of 2013-05 the project suffers from these known bugs:
@c
@c @itemize
@c @item All frames must be sent according to a pseudo-random distribution;
@c this is mostly in place but must be audited project-wide.
@c @item We removed @i{peer-delay} support. We plan to add it back, and
@c actually move White Rabbit to use @i{peer-delay} @sc{ptp} instead of
@c @i{end-to-end} @sc{ptp}.
@c @item The servo for standard-@sc{ptp} must be audited. We are doing
@c it now using @i{arch-sim} support,
@c @item @sc{udp} over @sc{IPV6} is not yet supported.
@c @end itemize
@c ##########################################################################
@node Configuration
@chapter Configuration
PPSi support configuration files and individual configuration items
PPSi supports configuration files and individual configuration items
passed on the command line. Such support is currently not available
for freestanding architectures (the @i{bare} ones and @i{wrpc-sw}).
......@@ -401,16 +432,17 @@ semicolon as a separator.
If no configuration file is specified, the program reads the default
one, which is architecture-specific (thus, the default configuration
file is processed after all the command line configuration items. The
file is processed after all the command line configuration items; to change
the order use explicitly the @t{-f} parameter). The
default file name is @t{/etc/ppsi.conf}. The source tree of PPSi includes
two example configuration files in its own @t{/etc} subdirectory.
Configuration is made of global options and port-specific options.
To configure a port, use either @t{port <name>} or @t{link <name>}
followed by its options.
The parser allocates a new @sc{ptp} state machine for each new port, but
The parser allocates a new @sc{ptp} instance for each new port, but
allows changing configuration of an existing port. For instance, to
enable frame diagnostics for a specific port, you can use:
enable frame diagnostics for a specific port, the following command can be used:
@smallexample
./ppsi -f /etc/ppsi.conf -C "port eth1-raw-ptp; diagnostics 02"
......@@ -423,30 +455,26 @@ architecture-specific table and an extension-specific table.
Currently, only @i{arch-sim} has specific configuration items.
The list of global and port specific configuration items are described
in the following section but also in code source files: @t{lib/conf.c} and
in the following section but also in code source file @t{lib/conf.c} and
@t{pp_global_arglines} array.
@quotation Note
most current command-line options are going to be turned into
configuration options. This applies to the priorities, intervals and
thresholds, as well as the @i{slave-only} flag.
@end quotation
@c ==========================================================================
@node PPSi base configuration
@section PPSi base configuration
As said before, the PPSi configuration is separated into different sections.
All keywords belonging to the 'global options' can be defined anywhere in the configuration
but to increase the readability, we suggest defining them at the beginning.
The PPSi configuration is separated into different sections.
All keywords belonging to the 'global options' can be defined anywhere in
the configuration, but to increase the readability, it is suggested to define
them at the beginning.
The 'port-specific' section always begins with the keywork 'port' or 'link'. Then all
The 'port-specific' section always begins with the keyword 'port' or 'link'. Then all
following 'port-specific' keywords will be associated to this port until
a new keyword 'port' or 'link' appears.
@anchor{arg-types}
An option is a key/value(s) pair separated by at least a space character '@t{key value(s)}'. The '@t{value(s)}' entry
depends on the option type. Few types are supported by PPSi:
An option is a key/value(s) pair separated by at least a space character, e.g.: '@t{key value(s)}'. The '@t{value(s)}' entry
depends on the option type. The following value types are supported by PPSi:
@table @code
......@@ -460,7 +488,7 @@ This is a 64 bits integer value in the range from -9 223 372 036 854 775 808 to
This is an array of 2 Int16.
@item Double
This is a 64 bit floating point in the range 1.7E +/- 308 (15 digits).
A value can be expressed using this two available notations:
A value can be expressed using two available notations:
- E notation: 1.6E-1
- Decimal notation: 0.16
@item Boolean
......@@ -469,36 +497,40 @@ and '@t{f/false/0/off/n/no}' for 'False'.
@item String
This is free text.
@item TextList
The option value has to be select in a list of predefined text. For each choice we can also use different way
to refer to the same choice.
For example, the selection of the delay mechanism allows 2 choices (peer-to-peer or end-to-end) but for each choice
we are free to use a different text for the selection :
This is a list of predefined choices specified with predefined text.
For each choice, it can use more than one predefined text.
For example, the selection of the delay mechanism allows two predefined
choices (peer-to-peer or end-to-end), but for each choice it is possible to
use a number of different texts for the selection:
@example
. end-to_end: "request-response","delay","e2e"
. peer-to-peer: "peer-delay","pdelay","p2p"
end-to_end: "request-response","delay","e2e"
peer-to-peer: "peer-delay","pdelay","p2p"
@end example
@end table
For some options, multiple keyword names can be used ( e.g. "mechanism", "dm"). New keyword names have been added
to be more explicit but at the same time old key names have not been suppressed just to keep the backward compatibility.
For some options, multiple keyword names (@t{key}) can be used, e.g. "mechanism", "dm". New keyword names have been added
to be more explicit but at the same time old keyword names have not been suppressed just to keep the backward compatibility.
Some old keywords will be marked '@i{(deprecated)}', and will be removed in the future.
@heading List of global options
@heading List of global options (i.e. keywords)
@table @code
@item @b{clock-class} @i{[Int32]}
An attribute defining the TAI traceability, synchronization state and
expected performance of the time or frequency distributed by a
Boundary Clock or Ordinary Clock.
For more details please refer to the IEEE 1588 standard
@item @b{clock-accuracy} @i{[Int32]}
An attribute defining the accuracy of the Local Clock (e.g. local
oscillator) of a Boundary Clock or Ordinary Clock.
For more details please refer to the IEEE 1588 standard.
@item @b{clock-allan-variance} @i{[Int32]}
An attribute defining the stability of the Local Clock of a
Boundary Clock or Ordinary Clock.
For more details please refer to the IEEE 1588 standard
@item @b{time-source} @i{[Int32]}
The source of time used by the grandmaster (or free-running master).
......@@ -513,22 +545,25 @@ Some old keywords will be marked '@i{(deprecated)}', and will be removed in the
@item @b{priority1} @i{[Int32]}
A user configurable designation that a clock belongs to an ordered
set of PTP devices from which a PTP Master is selected.
For more details please refer to the IEEE 1588-2019 standard.
For more details please refer to the IEEE 1588 standard.
@item @b{priority2} @i{[Int32]}
A user configurable designation that provides finer grained ordering
among otherwise equivalent PTP devices.
For more details please refer to the IEEE 1588-2019 standard.
For more details please refer to the IEEE 1588 standard.
@item @b{forcePpsGen} @i{[Boolean]}
Configuration of the PPS output. By default, the PPS is generated all the time
only when the clock class is set to 6 (Grand master) or to 193 (Free Running master).
When this option is set, the PPS is generated all the time for all clock class.
Configuration of the PPS output. By default, the PPS is generated
only when the clock class is set to 6 (Grandmaster), or to 193
(Free-running master), or when the PTP device is a PTP Slave, i.e.
it is synchronized via port in Slave state to a PTP Master.
@item @b{ptpFallbackPpsGen} @i{[Boolean]}
if activated, enables the PPS generation if a slave instance
programmed to use an extension protocol (WR, L1Sync, ...) is falling back
to PTP communication only.
If set, PPS is generated even if a PTP Device with enabled
protocol extension (WR, L1Sync, ...) is synchronized using standard
PTP communication only. Note: by default, a PTP device that is a
a PTP slave and has protocol extension enabled will generate PPS
only if the protocol extension is active on the Slave port.
@item @b{ptpPpsThresholdMs} @i{[Int32]}
This option defines the threshold corresponding to the offset from the
......@@ -540,14 +575,15 @@ Some old keywords will be marked '@i{(deprecated)}', and will be removed in the
than the threshold value + 20%.
@item @b{gmDelayToGenPpsSec} @i{[Int32]}
If this option is set to a value greater than 0, it allows the PPS generation
when the device becomes Grand-Master by BMCA. The value represent a delay in seconds to respect before
to start the PPS generation.
If this option is set to a value greater than 0, it allows PPS generation
when the PTP device becomes Grandmaster by BMCA (i.e. it is configured to be
a Boundary Clock). The value represent a delay in seconds between the
moment the PTP Device becomes Grandmaster and the start of PPS generation.
@item @b{externalPortConfigurationEnabled} @i{[Boolean]}
This option is used to force the state of all port instances. The BMCA is then disabled
in PPSi.
When enabled, the port-specific option @t{desiredState} must be defined for each port instance
When enabled, the port-specific option @t{desiredState} must be defined for each port instance.
For more details please refer to the IEEE 1588-2019 (clause 17.6.2)
@item @b{slaveOnly} @i{[Boolean]}
......@@ -565,13 +601,13 @@ Some old keywords will be marked '@i{(deprecated)}', and will be removed in the
@table @code
@item @b{port} @i{[String]}
@itemx @b{link} @i{[String]}
Defines a named port instance. The argument correspond to the instance name.
Defines a named PTP port instance. The argument correspond to the instance name.
@item @b{iface} @i{[String]}
Defines the physical port interface name to use (e.g. "eth0", "wri1", ...)
@item @b{proto} @i{[TextList]}
Defines the network transport protocol to use :
Defines the network transport protocol (mapping) to use :
@example
. "raw" : Raw Ethernet
. "udp" : User Datagram Protocol
......@@ -583,6 +619,7 @@ Some old keywords will be marked '@i{(deprecated)}', and will be removed in the
@example
. "none", "ptp": Default PTP profile
. "whiterabbit", "wr": White Rabbit profile
. "highaccuracy", "ha": High Accuracy profile
@end example
@item @b{mechanism} @i{[TextList]}
......@@ -598,48 +635,55 @@ Some old keywords will be marked '@i{(deprecated)}', and will be removed in the
(refer to the IEEE 1588-2019 - clause 9.2.2.2).
This option cannot be used if the global option '@i{externalPortConfiguration}' is
enabled.
If this option is not set, then the standard BMCA algorithm will be used.
If this option is not set, then the standard BMCA algorithm is used.
@item @b{sync-interval} @i{[Int32,Unit=logarithm to the base 2]} @i{(deprecated)}
@itemx @b{logSyncInterval} @i{[Int32,Unit=logarithm to the base 2]}
The mean time interval between transmission of successive
Sync messages.
Sync messages. For more details please refer to the IEEE 1588 standard.
@item @b{announce-interval} @i{[Int32,Unit=logarithm to the base 2]} @i{(deprecated)}
@itemx @b{logAnnounceInterval} @i{[Int32,Unit=logarithm to the base 2]}
The mean time interval between transmissions of successive
Announce messages.
Announce messages. For more details please refer to the IEEE 1588 standard.
@item @b{in-delay-req-interval} @i{[Int32,Unit=logarithm to the base 2]} @i{(deprecated)}
@item @b{min-delay-req-interval} @i{[Int32,Unit=logarithm to the base 2]} @i{(deprecated)}
@itemx @b{logMinDelayReqInterval} @i{[Int32,Unit=logarithm to the base 2]}
The minDelayRequestInterval specifies the minimum permitted
mean time interval between successive Delay_Req messages.
This option as a meaning only when 'end-to-end' delay mechanism is selected.
This option is effective only when 'end-to-end' delay mechanism is selected.
For more details please refer to the IEEE 1588 standard.
@item @b{min-pdelay-req-interval} @i{[Int32,Unit=logarithm to the base 2]} @i{(deprecated)}
@itemx @b{logMinPDelayReqInterval} @i{[Int32,Unit=logarithm to the base 2]}
The minPDelayRequestInterval specifies the minimum permitted
mean time interval between successive Pdelay_Req messages.
This option as a meaning only when 'peer-to-peer' delay mechanism is selected.
This option is effective only when 'peer-to-peer' delay mechanism is selected.
For more details please refer to the IEEE 1588 standard.
@item @b{announce-receipt-timeout} @i{[Int32]} @i{(deprecated)}
@itemx @b{announceReceiptTimeout} @i{[Int32]}
The announceReceiptTimeout specifies the number of announceIntervals
that must pass without receipt of an Announce message before the
occurrence of the event ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES.
For more details please refer to the IEEE 1588 standard.
@item @b{asymmetryCorrectionEnable} @i{[Boolean]}
When enabled, it tells the servo to calculate and take the delay asymmetry into account.
This option can be forced enabled by the profile in use (white rabbit,..). The PTP
profile does not use by default this feature.
When enabled, this feature calculates delay asymmetry which is then used in the
computation of offset from master in the PTP servo.
This feature is obligatorily enabled in some profiles when used (e.g. White Rabbit,..).
In the Default PTP Profile, this feature is not used by default.
For more details please refer to the IEEE 15882-2019 standard.
@item @b{constantAsymmetry} @i{[Int64,Unit=picoseconds]}
When '@i{asymmetryCorrectionEnable}' feature is used, this option leave the possibility to define
a constant value that will be added to the calculation of the delay asymmetry.
When '@i{asymmetryCorrectionEnable}' feature is used, this parameter allows fine-adjustment
of the calculated delay asymmetry. The provided value of @i{constantAsymmetry}
will be added to the calculation of the delay asymmetry.
For more details please refer to the IEEE 15882-2019 standard.
@item @b{desiredState} @i{[TextList]}
When the option '@i{externalPortConfigurationEnabled}' is enabled, this option indicates
the PTP port state to apply :
When the option '@i{externalPortConfigurationEnabled}' is enabled, this parameter indicates
the PTP state to apply on a PTP Port :
@example
. "initializing": Initializing state
. "faulty" : Faulty state
......@@ -649,38 +693,48 @@ Some old keywords will be marked '@i{(deprecated)}', and will be removed in the
. "master" : Master state
. "passive" : Passive state
. "uncalibrated": Uncalibrated state
. "slave" : Slave state. During synchronization
with a master, the port instance can
transition to UNCALIBRATED state.
. "slave" : Slave state. During synchronization
with a master, the port instance can
transition to UNCALIBRATED state.
@end example
@item @b{egressLatency} @i{[Int64,Unit=picoseconds]}
Defines the transmission constant delays.
Defines the transmission constant delays (tx fixed delta).
For more details please refer to the IEEE 15882-2019 standard.
@item @b{ingressLatency} @i{[Int64,Unit=picoseconds]}
Defines the reception constant delays.
Defines the reception constant delays (rx fixed delata).
For more details please refer to the IEEE 15882-2019 standard.
@item @b{delayCoefficient} @i{[Double]}
When the option '@i{asymmetryCorrectionEnable}' is enabled, it defines
the asymmetry alpha delay coefficient.
Defines the relative delay coefficient (alpha parameter). When the feature
'@i{asymmetryCorrectionEnable}' is enabled, this value is used in
calculation of the delay asymmetry.
For more details please refer to the IEEE 15882-2019 standard.
@item @b{scaledDelayCoefficient} @i{[Int64,Unit=RelativeDifference]]}
When the option '@i{asymmetryCorrectionEnable}' is enabled, it defines
the asymmetry alpha delay coefficient. It overwrites the option
Defines the relative delay coefficient (alpha parameter). When the feature
'@i{asymmetryCorrectionEnable}' is enabled, this value is used in
calculation of the delay asymmetry. It overwrites the parameter
'@i{delayCoefficient}' if set by providing a value expressed with a
better resolution.
better resolution.
For more details please refer to the IEEE 15882-2019 standard.
@item @b{servo-pi} @i{[Int16[2]]}
Change the default PTP servo parameters. The first argument correspond to the
proportionnal coefficient and the second to the integral one.
If set, it overrides the default PTP servo parameters.
The first argument correspond to the
proportional coefficient and the second to the integral one.
@item @b{diagnostic} @i{[String]}
Change the diagnostic level. @xref{Diagnostics,,Diagnostics}.
@item @b{diagnostic} @i{[String]}
Change the diagnostic level. @xref{Diagnostics,,Diagnostics}.
@item @b{vlan} @i{[String]}
Specify vlans. @xref{VLAN Support,,VLAN Support}.
@end table
@c ==========================================================================
@node Extension specific configuration
@node Extension-specific configuration
@section Extension specific configuration
@subsection White Rabbit extension
......@@ -693,21 +747,20 @@ No specific options are needed when the White Rabbit profile is selected.
Configuration, for @t{arch-unix} and @t{arch-wrs}, allows to provide
some fault injection.
In particular, the program allows dropping frames, in both the TX and RX
paths. The configuration values state how many frames are dropped every
1000. Dropping is randomized, but the user can set the seed to ensure
a repeatable dropping sequence.
Dropping transmitted frames is performed by reporting success (and the
Dropping of transmitted frames is performed by reporting success (and the
timestamp), while no frame is actually sent. A diagnostic message
is generated at @t{frames} level 1, but other than that nothing
happens. Actually, @t{arch-wrs} needs to actually send a frame in
happens. Please note that @t{arch-wrs} needs to actually send a frame in
order to get a timestamp back; in this case the program modifies the
frame, to use a wrong Ethernet type or a wrong UDP port.
Dropping received frames is performed by actually receiving (and
timestamping), but returning a special error code to the caller.
Dropping of received frames is performed by actually receiving (and
timestamping) the frames, but returning a special error code to the caller.
Again, PPSi creates a diagnostic message at @t{frames} level 1.
The following configuration lines are supported:
......@@ -722,7 +775,7 @@ The following configuration lines are supported:
@end table
The randomization see can be passed by pre-setting the environment
The randomization seed can be passed by pre-setting the environment
variable @t{PPSI_DROP_SEED} to a decimal numeric value. For example:
@smallexample
......@@ -736,15 +789,15 @@ before starting the daemon.
@node Configuring the Simulator
@section Configuring the Simulator
To run the PPSi simulator you need to rely on diagnostics and specific
To run the PPSi simulator it is need to rely on diagnostics and specific
configuration items. The configuration items are defined in
@i{arch-sim/sim-conf.c} and are not individually documented here at
this point.
After building with ``@t{make sim_defconfig}'', you can look at how
After building with ``@t{make sim_defconfig}'', it can be checked how
PPSi behaves in different situation. For example, to see how the servo
works with default parameters you can activate servo messages at level
2, and only look at the offset from master:
works with default parameters activate servo messages at level
2, and only display the offset from master:
@smallexample
./ppsi -d 0002 | grep 'Offset from master'
......@@ -758,9 +811,9 @@ The simulator runs by default for one hour of simulated time (in a
fraction of a second of running time), and the initial offset from
master to slave is 0.9 seconds.
To pass configuration options, you can use the @t{-C} command line option.
so, for example, to start with 0.1 seconds of offset and 1000 ns of
transmission jitter, you can run like this:
To pass configuration options, @t{-C} command line option can be used.
For example, to start with 0.1 seconds of offset and 1000 ns of
transmission jitter:
@smallexample
./ppsi -d 0002 -C "sim_init_master_time .1; sim_jit_ns 1000"
......@@ -771,7 +824,7 @@ transmission jitter, you can run like this:
@node VLAN Support
@chapter VLAN Support
PPSi can support vlans, or use support the Operating System offers.
PPSi can support vlans, or use the support offered by the Operating System.
@c ==========================================================================
@node OS VLAN
......@@ -791,87 +844,88 @@ both raw Ethernet and UDP can be used.
Freestanding architectures, like the WR PTP Core (@t{arch-wrpc}) can't
rely on the underlying Operating System, so the daemon must read and
write vlan Ethernet headers by itself -- in this situation UDP is not
supported, unless your own architecture's network operations build and
supported, unless an architecture's network operations build and
decode IP and UDP headers (in official PPSi no such support is there).
Another situation where PPSi should deal with vlans directly is when
you want a port to be master on several vlans at the same time, but
a port it to be a master on several vlans at the same time, but
this is only supported for @i{mandated} masters, at this point in
time. A mandated master is a port configured either as '@t{master}'
(externalPortConfiguration enabled) or as '@t{masterOnly}'
in the configuration file. If you want to run multiple vlans on the
same physical ports, without forcing the port to be a mandated master,
you can create multiple PTP interfaces, one per vlan, all relying on
in the configuration file. To run multiple vlans on the
same physical port, without forcing the port to be a mandated master,
create multiple PTP interfaces, one per vlan, all relying on
the same physical port (or different OS-specific vlan ports).
When running a fully-PTP network in end-to-end mode, you won't usually
When running a fully-PTP network in end-to-end mode, it won't usually
need to configure multiple vlans on a single port. In particular, this
never happens in a White Rabbit network, because each link connects
two clocks, without any non-compliant switches in the middle.
However, if you have
transparent clocks or normal switches, you may want to behave
as a master for the whole network connected to your port, which may
two WR-PTP devices, without any non-compliant switches in the middle.
However, for
transparent clocks or normal switches, it is possible to have
a master for the whole network connected to a given port, which may
be split in several vlans. Clearly this only applies to a @i{trunk}
port in your PTP switch or workstation.
port in PTP switch or workstation.
To support this we rely on @i{Kconfig} and architecture-specific
The support of VLANs rely on @i{Kconfig} and architecture-specific
code, in the following way.
@itemize @bullet
@item Each architecture states, in @t{Kconfig}, whether it supports
vlans (@t{SUPPORT_VLAN}) and multiple vlans (@t{SUPPORT_MULTIPLE_VLAN}).
vlans (@t{ARCH_SUPPORT_VLAN}) and multiple vlans (@t{ARCH_SUPPORT_MULTIPLE_VLAN}).
@item The configuration parser (@t{lib/conf.c}) accepts a @t{vlan}
keyword, specifying one or more vlans. If several, they are
comma-separated.
@item Configuration fails (and PPSi refuses to start) if the architecture
has no vlan support, or of multiple vlans are specified for an
architecture that supports one vlan only.
has no vlan support and vlan is specified, or multiple vlans are specified
for an architecture that supports one vlan only.
@item Configuration fails also if several vlans are specified for
a port that is not a mandated master.
a port that is not a @i{mandated} master.
@end itemize
When only one vlan is specified, the network operations for the
architecture are responsible: they must do the right thing. Currently,
@t{wrpc} builds and decodes Ethernet frames (FIXME: NOT YET), ignoring
architecture are responsible to handle it in a proper way. Currently,
@t{wrpc} builds and decodes Ethernet frames, ignoring
any received frame not belonging to the proper vlan. Code for @t{wrs} and
@t{unix} handles a single vlan like multiple ones; I thought
about automatically creating the vlan-specific interface, but that
would be very Linux-specific and I see no real need for it.
@t{unix} handles a single vlan like multiple ones (NOTE:
automatically creating the vlan-specific interface was considered, but that
would be very Linux-specific and there was no real need for it).
When multiple vlans are specified for a master port, current code
(i.e. @t{arch-wrs} and @t{arch-unix}) binds to @t{ETH_P_ALL}, in order
to receive all frames from that interface, and thus be able to tell
which vlan they belong to. A multiple-vlan master sends announce and
sync (plus follow-up) to all vlans at the same time, and will reply to
delay requests using the same vlan it receives it from. Frames from
delay requests using the same vlan it receives it from, limited to the
list of configured vlans. Frames from
other vlans, as well as non-PTP frames, are ignored.
Because of the @t{ETH_P_ALL} binding, a multiple-vlan master port will
receive all the non-PTP traffic that flows on the interface. Please be
warned that this may increase the load on your PPSi process. With the
warned that this may increase the load on the PPSi process. With the
current release of the White Rabbit Switch this is not a problem,
because the switching core routes only PTP frames to the CPU. This
applies to single-vlan ports, because PPSi is not creating the
Linux-specific interface to have the kernel select traffic for us.
Linux-specific interface to have the kernel select traffic.
@c ==========================================================================
@node Note about vlans in Linux
@section Note about vlans in Linux
The choices described above depend on how vlans work in Linux (the
architecture we use in the White Rabbit Switch, and the one we support
architecture that is used in the White Rabbit Switch, and the one supported
in @t{arch-unix}).
If a packet socket is bound to a specific Ethernet protocol (for
example, the PTP Ethernet type, 0x88f7), on a generic Ethernet port
like @t{eth0}, it receives all frames for that @i{ethertype}, whether
or not they are tagged on the wire. To our knowledge there is no way,
in this situation, to tell whether the frame was tagged, and which tag
or not they are tagged on the wire. To authors' knowledge in this situation,
it is not possible to tell whether the frame was tagged, and which tag
were there if any. Only traffic to vlan-specific ports, like
@t{eth0.20}, si guaranteed to belong to vlan 20 (or a double-tagged
@t{eth0.20}, is guaranteed to belong to vlan 20 (or a double-tagged
frame, whose external tag is 20).
Only a socket bound to all @i{ethertypes} (i.e. @t{ETH_P_ALL}) is able
......@@ -879,11 +933,11 @@ to receive auxiliary metadata that reports whether the frame was
tagged and which tag it was carrying.
The behavior above depends on how hardware acceleration for tags work,
and even if it is suboptimal for this use case, we don't know about
and even if it is suboptimal for this use case, authors don't know about
alternatives. Thus, a PPSi port configured for vlan frames, is bound
to the base ethernet port, but it must receive all @i{ethertypes}.
If this is not ok for your configuration, you can create your own
If this is not ok for an configuration, it is advised to create a new
vlan-aware Linux port and bind to it. It works correctly with smaller
CPU overhead, but more administrative work.
......@@ -892,8 +946,10 @@ CPU overhead, but more administrative work.
@chapter PTP Clock Class
The clock class value (@t{clockClass}), a field of the `clock quality'
structure, can be specified in the configuration file for the architectures
that support such a file.
structure defined by the IEEE1588 standard, can be specified in
the configuration file for the architectures
that support such a file (e.g. White Rabbit Switch) or be set in run-time (e.g.
White Rabbit Node).
@c ==========================================================================
@node Default device attributes
......@@ -998,13 +1054,13 @@ timePropertiesDS.timeTraceable = FALSE
@node Clock class degradation
@section Clock class degradation
PPSi manage clock class degradation for a set of clock classes and update accordently
clock and time property field.
As certain clock and time properties may be set in the PPSi configuration, so when a clock class
PPSi manages clock class degradation for a set of clock classes and updates accordingly
clock & time property field.
As certain clock & time properties may be set in the PPSi configuration, so when a clock class
is degraded, all updated clock and time fields are changed in a way to never set them to a better
value than their configured one. In such a case, they will remain unchanged.
The following table show how a clock class is degraded when the PLL is in holdhover or unlocked:
The following table show how a clock class is degraded when the PLL is in holdover or unlocked:
@table @code
@item @b{PTP_GM_LOCKED(6)} - PLL holdover detected
......@@ -1117,9 +1173,7 @@ a clock that may be a slave of another clock.
@node Diagnostics
@chapter Diagnostics
During development of PPSi, diagnostic support used several
techniques, but finally we converged on the one described here, that
is here to stay. The idea is that we need to add verbosity
The PPSi verbosity can be controlled
per-feature and per-port. This fine-grained control is expected to be
important while developing features or while diagnosing problems on
new architectures.
......@@ -1138,8 +1192,8 @@ macros use the logical OR of both flags, so developers can activate
diagnostics on either a single link or globally.
The diagnostic flags are split into topics (called @i{things}). For
each diagnostic thing the header defines a few bits; so we can have
diagnostic levels for each of them, but we suggest only using level 1
each diagnostic thing the header defines a few bits; there is
diagnostic levels for each of them, but it is suggested to use only level 1
and 2 -- the rationale is in the header itself.
The @i{things} currently defined are:
......@@ -1162,7 +1216,7 @@ addition of new masters as well.
@item Extensions: extension-specific information.
@item Configuration: at level 1 PPSi reports errors, at level 2 all
configuration items being parsed (from either files or command line).
configuration items being parsed (from either file or command line).
@end itemize
......@@ -1186,8 +1240,8 @@ of the @i{pp_diag} function:
@end example
The function acts like @i{printf}, with the leading arguments @t{ppi},
@t{thing} (which is one of the names fsm, time, frames, servo, bmc,
ext) and @t{level}, which should be 1 or 2. For example, the code
@t{thing} (which is one of the names @i{fsm}, @i{time}, @i{frames}, @i{servo},
@i{bmc}, @i{ext}) and @t{level}, which should be 1 or 2. For example, the code
setting system time includes this diagnostic line:
@example
......@@ -1195,9 +1249,9 @@ setting system time includes this diagnostic line:
tp.tv_sec, tp.tv_nsec);
@end example
Finally, if you need to shrink the size of your binary file, you can
build PPSi with no diagnostic code at all (i.e., the compiler won't
even generate the function calls), you can define @t{PPSI_NO_DIAG} in
Finally, to shrink the size of binary file, PPSi can be
build with no diagnostic code at all (i.e., the compiler won't
even generate the function calls), in this case define @t{PPSI_NO_DIAG} in
@t{CFLAGS} while building. This can be achieved by setting
@t{USER_CFLAGS}:
......@@ -1210,12 +1264,12 @@ commented.
@c ==========================================================================
@node Older Diagnostics
@section Older Diagnostics
We introduced the diagnostic macros described above at the beginning
of March 2013. Earlier code used a less-structured approach, which
has later been removed. If you used @t{PP_PRINTF}, it's gone by now.
@c @node Older Diagnostics
@c @section Older Diagnostics
@c
@c We introduced the diagnostic macros described above at the beginning
@c of March 2013. Earlier code used a less-structured approach, which
@c has later been removed. If you used @t{PP_PRINTF}, it's gone by now.
@c ==========================================================================
@node Printf
......@@ -1229,15 +1283,16 @@ in its own subdirectory. Please check @i{pp_printf/README} for more
details about the size of this implementation and the different
implementation choices.
By avoiding calls to the real @i{printf} function we allow the PPSi
code base to be built for freestanding implementations without ugly
@t{#ifdef} tricks in the code. Please note that @i{pp_printf} and
By avoiding calls to the real @i{printf} function
the code base can be built for freestanding implementations without ugly
@t{#ifdef} tricks in the code.
Please note that @i{pp_printf} and
@i{printf} can coexist: for example the hosted version of PPSi links
with the standard library without any problem; in that case
@i{pp_printf} relies on @i{fputs} to write to @i{stdout}.
If your run-time environment already includes an implementation
of @i{pp_printf}, you can build with @t{CONFIG_NO_PRINTF} set. For
If a run-time environment already includes an implementation
of @i{pp_printf}, it can build with @t{CONFIG_NO_PRINTF} set. For
example:
@example
......@@ -1246,18 +1301,11 @@ example:
The resulting @t{ppsi.o} will include undefined references to the
@t{pp_printf} symbol, which must be provided externally. This is how
we build for @i{arch-wrpc}, which already includes its own
implementation if @i{pp_printf}. In that specific situation we still
link the @i{libc} provided by the compiler, but we don't want to lift
the build for @i{arch-wrpc} is done, which already includes its own
implementation of @i{pp_printf}. In that specific situation
the @i{libc} is provided by the compiler, but it is not using
its own @i{printf} which would bring in most of @i{newlib} and would
overflow our available RAM by a huge amount.
If your freestanding environment provides a @i{printf} that you want
to use, and which is not called @i{pp_printf}, you may use the
@t{PROVIDE} keyword in your linker script. You can find an example in
the @i{wrpc-sw} package, which maps @i{mprintf} to @i{pp_printf} at
link time, in order to accept external code that calls @i{mprintf},
which we don't provide any more.
overflow the available RAM by a huge amount.
@c ##########################################################################
@node Tools
......@@ -1341,8 +1389,8 @@ refers to a parallel port. When passed a pathname, the program assumes
it is a serial port and it toggles the DTR and RTS modem control signals
(on pins 4 and 7 of the DB9 male connector).
By setting the @t{VERBOSE} environment variable you ask the program
to report how late it was before and after generating the rising
By setting the @t{VERBOSE} environment variable the program
reports how late it was before and after generating the rising
edge:
@example
......@@ -1356,7 +1404,7 @@ edge:
@t{pps-out} can be used to verify on a scope the level of
synchronization of two or more computers, but please note that the
user-space software-only approach shows some jitter; on my systems the
user-space software-only approach shows some jitter; on example systems the
delay is usually a few microseconds, up to around a dozen (in general,
use of the parallel port has less delay and less jitter). In any case
this offers a second source to check what NTP or @sc{ptp} daemons report.
......@@ -1388,9 +1436,8 @@ that are bigger than 0.5ms, to avoid excessive reporting of false
positives that are simply due to process latencies induced by the
system workload.
By running this program you can see the effect of @i{tools/jmptime},
or the insertion of a leap second (which is why I wrote this program
in June 2012).
By running this program the user can see the effect of @i{tools/jmptime},
or the insertion of a leap second.
For example, this is what @i{chktime} reports when running
``@t{jmptime .002}''. The program doesn't need superuser privileges:
......@@ -1416,11 +1463,11 @@ Adjustments requested by this program cannot be reported by
than half a millisecond, because the change in clock speed affects
both @t{CLOCK_REALTIME} and @t{CLOCK_MONOTONIC}.
You can see adjustment in one host by comparing with the time of another
host, for example using @i{tools/mtp}, described next.
The adjustment can be seen in one host by comparing with the time of another
host, for example using @i{tools/mtp}, described in the next section.
The following example shows how on my host the kernel adjusts the time by
15ms every 30s (i.e. 0.05%):
The following example shows how on an example host the kernel adjusts the time
by 15ms every 30s (i.e. 0.05%):
@example
# ./tools/adjtime .15; sleep 30; ./tools/adjtime 0
......@@ -1440,7 +1487,7 @@ being used in the core PPSi program). It is meant to check adjustment
and get acquainted with the involved values.
The numerical argument of the system call is parts-per-million scaled
by 16 bits. So for example half @i{ppm} is passed as 32768.
by 16 bits. For example half @i{ppm} is passed as 32768.
The following are example uses of the program on an ntp-driven host:
......@@ -1460,20 +1507,21 @@ The following are example uses of the program on an ntp-driven host:
@node mtp
@section mtp
The directory @i{tools/mtp} includes a few example programs I wrote for
The directory @i{tools/mtp} includes a few example programs written by
Alessandro for
an article about time synchronization. MTP means ``mini time protocol'';
it uses the T1, T2, T3, T4 idea to report the time difference between
two hosts. The program comes in two flavors: UDP and raw Ethernet.
To run a listening server on one host, you can run the program in
To run a listening server on one host, run the program in
@i{listen} mode:
@example
tornado% ./tools/mtp/mtp_udp -l
@end example
On the other host, you can run the client that reports the time
difference it measures, you can pass either an IP address or an host
On the other host, run the client that reports the time
difference it measures, pass either an IP address or an host
name:
@example
......@@ -1481,8 +1529,8 @@ name:
0: rtt 0.000459000 delta 0.099351500
@end example
You can continuously monitor the difference by running the program in a
loop:
It is possible to continuously monitor the difference by running the program in
a loop:
@example
morgana% while true; do ./tools/mtp/mtp_udp tornado; sleep 0.1; done
......@@ -1500,9 +1548,7 @@ The @i{MAKEALL} script, in the top-level directory of PPSi builds the
program for all known configurations, picking them from @t{configs/}.
Developers are urged to run it
before committing each patch, to ensure they are not breaking the
program for configurations they are not using -- but sometimes I
forgot to do that myself and committed trivially-incomplete changes.
program for configurations they are not using.
It may happen, however, that some developers experience errors or
warnings that others didn't notice, because of differences in compiler
version or library versions.
......@@ -1537,8 +1583,8 @@ whatever it needs. Similarly, @t{CROSS_COMPILE} may be set by sub-Makefiles
but please let the environment override it (as no custom pathnames
should be edited before building and the pristine package can be used).
The basic state machine is in @i{./fsm.c}. It's a simple file released in
the public domain as we'd like the idea to be reused and the code
The basic state machine is in @i{./fsm.c}. It is a simple file released in
the public domain as authors would like the idea to be reused and the code
itself is not worth copylefting -- even thought the file is not completely
independent from PPSi itself.
......@@ -1548,8 +1594,8 @@ Additionally, "@t{CONFIG_PRINTF_XINT}" or one of the other @i{pp_printf}
configurations can be set to override the default. By default PPSi
builds the ``full'' implementation.
This state-machine source refers to a specific state machine by the
name @i{pp_state_table}. The table is picked from a
The state-machine source (i.e.@i{./fsm.c}) refers to a specific state machine
by the name @i{pp_state_table}. The table is picked from a
library: either from the extension being selected or the @i{proto-standard} one.
The table includes pointers to functions, and such names
will select which other object files are picked up from the libraries.
......@@ -1562,13 +1608,13 @@ leaving the final link to the chosen architecture, so for example
@i{arch-unix} adds @t{ppsi} to the @t{all} target.
Since code and data space is a problem in the freestanding world (for
example, the whole ptp may need to fit in 64kB RAM including data and
example, the whole PPSi may need to fit in 64kB RAM including data and
stack), each state in the state machine of the standard protocol must
be implemented as a separate file. This allows an extension not using
that particular function to save the overhead of binary size.
Clearly an extension may implement several functions in the same file,
if they are known to be all used in the final binary or of it uses
@t{-ffunction-sections} and @t{-fdata-sections}).
@t{-ffunction-sections} and @t{-fdata-sections}.
@c ##########################################################################
......@@ -1576,22 +1622,22 @@ if they are known to be all used in the final binary or of it uses
@chapter Licensing
The code is licensed according to the GNU LGPL, version 2.1 or later.
Some files are individually released to the public domain, when we
think they are especially simple or generic.
Some files are individually released to the public domain, when authors
thought they are especially simple or generic.
Both the full and the partial printf code is distributed according to
the GPL-2, as it comes from the Linux kernel. This means that any
code using our diagnostics fall under the GPL requirements; you may
compile and use the diagnostic code internally with your own
proprietary code but you can't distribute binaries with diagnostics
without the complete source code and associated rights. You may avoid
the GPL requirements by using different printf implementations; if so
we'd love to have them contributed back in the package.
code using PPSi's diagnostics fall under the GPL requirements; one may
compile and use the diagnostic code internally with own
proprietary code but it can not distribute binaries with diagnostics
without the complete source code and associated rights. One may avoid
the GPL requirements by using different printf implementations; in such case
please contribute back this into the package.
The same issue about the GPL license applies to the @i{div64_32}
function. We need this implementation in our @i{wrpc} code base
because the default @i{libgcc} division is very big, and we are always
tight with our in-FPGA memory space.
function. This implementation is needed in @i{wrpc} code base
because the default @i{libgcc} division is very big, and @i{wrpc} is always
tight with in-FPGA memory space.
For binaries without diagnostic code and the size-optimized division,
the LGPL applies, as detailed below.
......@@ -1601,9 +1647,9 @@ For licensing purposes, any `arch-name' or `time-name' subdirectory
themselves" (quoting the LPGL text).
Code in the directories provided here is all LGPL, and
you may add your own drop-in subdirectories. The LGPL requirements for
one may add own drop-in subdirectories. The LGPL requirements for
source distribution and associated permissions won't apply to any such
subdirectory that you may add, even if technically such code is not
subdirectory that might be added, even if technically such code is not
linked as a library.
@c ##########################################################################
......@@ -1613,7 +1659,7 @@ linked as a library.
The coding style is the one inherited from Linux kernel project (see
@i{Documentation/CodingStyle} in the kernel sources). However,
structures, constants and field names defined by @sc{ieee} 1588 are kept in
the suggested "CamelCase" form. Similarly, the typedefs are left, even
the suggested "camelCase" form. Similarly, the typedefs are left, even
if they are really a pain to deal with. Most of this stuff is in
include/ppsi/ieee1588_types.h file.
......@@ -1625,7 +1671,7 @@ Some prefixes to the @sc{ieee} naming are added, in order to improve
readability:
@t{EN} means "enumeration type". For instance, Enumeration Time Source
(defined in the spec at table 7, page 57) becomes @t{ENTimeSource}.
(defined in IEEE 1588-2008 at table 7, page 57) becomes @t{ENTimeSource}.
@t{PPM_} means "ppsi message", and is used for message types.
......@@ -1636,7 +1682,7 @@ definition.
@t{DS} means "data set", and is used for the standard Data Sets (e.g.
@i{DSCurrent} is the "Current Data Set"). The concept of data sets is
defined in the specification at chapter 8, page 63.
defined in IEEE 1588-2008 in chapter 8, page 63.
@c ##########################################################################
@node Command Line
......@@ -1651,17 +1697,12 @@ The command:
./ppsi --help
@end example
will print help about command line options (we also support the
will print help about command line options (it also support the
question-mark like the original ptp, but it's a bad choice because it
is a shell wildcard that should be escaped). Actually, all multi-char
options will print the help at this point in time, because we only
support since-char options; we don't want to rely on @i{getopt} which
is not available for all architectures, nor we want to implement
complex parsing.
@b{Note:} most current command-line options are going to be turned into
configuration options. This applies to the priorities, intervals and
thresholds, as well as the @i{slave-only} flag.
options will print the help at this point in time, because only
since-char options are supported. It is intended to avoid dependency on
@i{getopt} which is not available for all architectures.
For standard operation, simply run @t{./ppsi} with no options. It will
work like the PTPd executable, with the automatic choice of
......@@ -1683,16 +1724,17 @@ a list of the other ones please see the help message.
Pass a single configuration item, or several of them using
the semicolon as separator. See @ref{Configuration} for details.
@item -d
@item -d <string>
Diagnostics. This options receives the string of diagnostic
levels for fsm, time, frames, servo, bmc, extension (in that order).
See @ref{Diagnostic Macros} for details.
@item -e
@item -t
Do not adjust the system clock.
Run in Ethernet mode (by default PPSi uses UDP if the architecture
supports it).
@item -w NUMBER
specify meanDelay filter stiffness.
@item -g
......
/*
* Macros for diagnostic prints.
*
* Copyright (C) 2011 CERN (www.cern.ch)
* Licenses: (LGPL-2.1 & PPSI-LGPL-Exception-1.1 | LGPL-3.0)
*/
......
......@@ -310,6 +310,6 @@ char *relative_interval_to_string(RelativeDifference time)
sub_yocto += bitWeight;
bitWeight /= 2;
}
pp_sprintf(time_as_string,"%c%"PRId32".%018Ld", sign, nsecs, sub_yocto);
pp_sprintf(time_as_string,"%c%"PRId32".%018"PRId64, sign, nsecs, sub_yocto);
return time_as_string;
}
......@@ -335,8 +335,6 @@ static int wr_extension_state_changed( struct pp_instance * ppi) {
static int wr_new_slave (struct pp_instance *ppi, void *buf, int len) {
if ( ppi->extState==PP_EXSTATE_ACTIVE ) {
struct wr_dsport *wrp = WR_DSPOR(ppi);
wr_servo_init(ppi);
/* To avoid comparison of sequenceId with parentAnnSequenceId
......
......@@ -147,6 +147,29 @@ static unsigned long bare_calc_timeout(struct pp_instance *ppi, int millisec)
return now_ms + millisec;
}
static int bare_get_GM_lock_state(struct pp_globals *ppg,
pp_timing_mode_state_t *state)
{
*state = PP_TIMING_MODE_STATE_LOCKED;
return 0;
}
static int bare_enable_timing_output(struct pp_globals *ppg, int enable)
{
static int prev_enable = 0;
if (prev_enable != enable) {
pp_diag(NULL, time, 2, "%s dummy timing output\n",
enable ? "enable" : "disable");
prev_enable = enable;
return 0;
}
return 0;
}
struct pp_time_operations bare_time_ops = {
.get_utc_time = bare_time_get_utc_time,
.get_utc_offset = bare_time_get_utc_offset,
......@@ -158,4 +181,6 @@ struct pp_time_operations bare_time_ops = {
.adjust_offset = bare_time_adjust_offset,
.adjust_freq = bare_time_adjust_freq,
.calc_timeout = bare_calc_timeout,
.get_GM_lock_state = bares_get_GM_lock_state,
.enable_timing_output = bare_enable_timing_output
};
......@@ -142,6 +142,29 @@ static unsigned long sim_calc_timeout(struct pp_instance *ppi, int millisec)
return millisec + SIM_PPI_ARCH(ppi)->time.current_ns / 1000LL / 1000LL;
}
static int sim_get_GM_lock_state(struct pp_globals *ppg,
pp_timing_mode_state_t *state)
{
*state = PP_TIMING_MODE_STATE_LOCKED;
return 0;
}
static int sim_enable_timing_output(struct pp_globals *ppg, int enable)
{
static int prev_enable = 0;
if (prev_enable != enable) {
pp_diag(NULL, time, 2, "%s dummy timing output\n",
enable ? "enable" : "disable");
prev_enable = enable;
return 0;
}
return 0;
}
struct pp_time_operations sim_time_ops = {
.get_utc_time = sim_time_get_utc_time,
.get_utc_offset = sim_time_get_utc_offset,
......@@ -154,4 +177,6 @@ struct pp_time_operations sim_time_ops = {
.adjust_freq = sim_adjust_freq,
.init_servo = sim_init_servo,
.calc_timeout = sim_calc_timeout,
.get_GM_lock_state = sim_get_GM_lock_state,
.enable_timing_output = sim_enable_timing_output
};
......@@ -22,7 +22,7 @@
#include <ppsi/ppsi.h>
#include "ptpdump.h"
#include "../arch-unix/ppsi-unix.h"
#include "../arch-unix/include/ppsi-unix.h"
/* unix_recv_msg uses recvmsg for timestamp query */
static int unix_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
......
......@@ -11,6 +11,7 @@
#include <time.h>
#include <sys/timex.h>
#include <ppsi/ppsi.h>
#include "../arch-unix/include/ppsi-unix.h"
#ifndef MOD_TAI
#define MOD_TAI 0x80
......@@ -280,6 +281,29 @@ static unsigned long unix_calc_timeout(struct pp_instance *ppi, int millisec)
return now_ms + millisec;
}
static int unix_get_GM_lock_state(struct pp_globals *ppg,
pp_timing_mode_state_t *state)
{
*state = PP_TIMING_MODE_STATE_LOCKED;
return 0;
}
static int unix_enable_timing_output(struct pp_globals *ppg, int enable)
{
static int prev_enable = 0;
if (prev_enable != enable) {
pp_diag(NULL, time, 2, "%s dummy timing output\n",
enable ? "enable" : "disable");
prev_enable = enable;
return 0;
}
return 0;
}
struct pp_time_operations unix_time_ops = {
.get_utc_time = unix_time_get_utc_time,
.get_utc_offset = unix_time_get_utc_offset,
......@@ -291,5 +315,6 @@ struct pp_time_operations unix_time_ops = {
.adjust_freq = unix_time_adjust_freq,
.init_servo = unix_time_init_servo,
.calc_timeout = unix_calc_timeout,
.get_GM_lock_state = unix_get_GM_lock_state,
.enable_timing_output = unix_enable_timing_output
};
......@@ -169,7 +169,8 @@ static int wr_dump_tlv(char *prefix, struct ptp_tlv *tlv, int totallen)
/* the field includes 6 bytes of the header, ecludes 4 of them. Bah! */
int explen = ntohs(tlv->len) + 4;
if ( CONFIG_HAS_PROFILE_WR ) {
#ifdef CONFIG_PROFILE_WR
{
static char *wr_message_name[] = {
"SLAVE_PRESENT",
"LOCK",
......@@ -283,8 +284,11 @@ static int wr_dump_tlv(char *prefix, struct ptp_tlv *tlv, int totallen)
}
}
return explen;
} else
}
#else
return explen > totallen ? totallen : explen;
#endif
}
static int l1sync_dump_tlv(char *prefix, struct l1sync_tlv *tlv, int totallen)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment