PPSi:c70c124a45fbec6d9d772f93349f13909d1aa616 commitshttps://ohwr.org/project/ppsi/commits/c70c124a45fbec6d9d772f93349f13909d1aa6162014-03-21T12:55:48Zhttps://ohwr.org/project/ppsi/commit/c70c124a45fbec6d9d772f93349f13909d1aa616arch-sim: added config option "sim_duration_sec"2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
It sets how much time the simulator should simulate. The default value
is set to 3600 so that running the simulator without specifying the
sim_duration_sec option will result in a simulation representing an hour
of real timehttps://ohwr.org/project/ppsi/commit/3d49a8c96c2edcce62c5608acac3f77751e2a235time-sim: simplified sim_time_get()2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/bd326eefc2725fd6c747e89c2e3c05ab93a972fdarch-sim: sim-startup.c init refactorization2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/b07673a4fc75931b6001f2d020b72e2ae0457974arch-sim: refactorized net_ops2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/7cd3719d1775d73a82983ae7802bf4265b2cc5e7arch-sim: new standard names for the ifaces2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
This makes the diagnostics easier to understand, printing MASTER and SLAVE
for every messagehttps://ohwr.org/project/ppsi/commit/57c21fd11d0154574a4424407e3000c8cf12e4ccarch-sim: removed iface dependencies from net_ops2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
Now you can assign the name you want to the interfaces, because it
doesn't really look for a physical interface with that name. This
can be useful to make the diagnostics easier to understandhttps://ohwr.org/project/ppsi/commit/dc463c455fed9f6813aa9789aee3a763f57d85d9arch-sim: changed ports used by the slave2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
so that you don't need to be administrator to run the simulator and
you don't have conflicts if there is already a PTP instance running on
the standard portshttps://ohwr.org/project/ppsi/commit/dcddecbc67ab69ff50852199ee990ff4d97aa593arch-sim: network operations and main loop2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
New struct sim_pending_pkt is introduced to hold information on pakets still in
fly. An array of such structures is stored in ppg->arch_data. This array is
written by every send. The insertion is designed to sort automatically the
packets so that the first element of the array after an insertion is always
the first packet that will be received. Function sim_fast_forward_ns is changed
to update also the reception times into this array, so that when you fast
forward, also the pending packets are fast_forwarded.
The main loop works in this way:
- if there are packets to be received check when
- if the first packet to be received is coming before the state machine
timestamps expire, then fast forward till it's time to receive it.
Then receive it and call the state machine of the receiver
- if there are no packet pending or the first pending packet is coming
after a timeout, then fast forward till the timeout expires and
run all the state machineshttps://ohwr.org/project/ppsi/commit/d53137e527e659a69fd02b2ebec923a89eeeb1daarch-sim: config options for net delay2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/02bf7e83096a23020cd7df94979a9835239fa97etime-sim: added sim_fast_forward_ns2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
It will be used to jump ahead in time when no machine is executing.https://ohwr.org/project/ppsi/commit/202f3e82473ca1dc22b2813176ab2c6f93891fc1arch-sim: added sim_defconfig2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/8ba0d7467ceb5f36870e348fb1ad3127d402d36earch-sim: added struct pp_sim_net_delay2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
This structure represents all the delays on the outgoing link of
the pp_instance. It will be used by the network operationshttps://ohwr.org/project/ppsi/commit/17a47301f9b11f615641af7b035768fbc27f5743arch-sim: added per-arch config options2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
startup is changed, because we need to set the initial time for the
master before we set the initial offset from master fo the slave.
In this way the diagnostics cannot be turned on to print out the
config for the master. This is not a problem, because the master
it's not meant to be configurablehttps://ohwr.org/project/ppsi/commit/54eb55bebb8e6b1b57566f52d9237855a5b92f98arch-sim: new inline functions to select instances2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
pp_sim_get_master(ppg) always returns a pointer to master pp_instance.
pp_sim_get_slave(ppg) always returns a pointer to slave pp_instance.
pp_sim_is_master(ppi) and pp_sim_is_slave(ppi) are test for obvious
conditions. these last two can be used only if ppi->glbs != NULL,
so only if a ppi has been fully initialized.https://ohwr.org/project/ppsi/commit/c2c1231b9228988df27dc10080ab28dc09821c81arch-sim: initialization code for master and slave2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/16b4b4e3f68e2473f488d77bf96103bea5e41a5darch-sim: fields added to struct sim_ppi_arch_data2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
These are namely Data Sets, runtime options, servo and TimeProperties.
We need them in every instance because we have two ppi (master and slave)
acting like two different machines, so they need different copies of
these variables. We just put the per-instance stuff in the arch_data.
Then we'll change the pointers in the ppg directly in the net operations,
according to our needs.https://ohwr.org/project/ppsi/commit/aea3aa29d6aab9e5784a856d45f940bd01b926f4time-sim: added time operations2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
They're designed to be used for both the instances, master and slave.
This is possible because the new data structure pp_sim_time_instance
holding all the information about the time of a single instance is
placed inside the ppi arch_datahttps://ohwr.org/project/ppsi/commit/44e736974813316565d1be5c8f106894fbb5140darch-sim: new prototype for global arch_data2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
For now it's the same as arch-unix but it will change
when we will add more configuration parameters for the
simulator. So it's better to change its name, from the
beginninghttps://ohwr.org/project/ppsi/commit/8d8989888e2c76b4e5a93232727161f7041d5779arch-sim: initial commit with directory tree2014-03-21T12:55:48ZPietro Fezzardipietrofezzardi@gmail.com
Kconfig is updated with new arch.
It compiles but it's actually doing nothinghttps://ohwr.org/project/ppsi/commit/899ab83e1f2f29ed6602898444c1d1791a4183c3config: removed global variables current_ppg and current_ppi2014-03-21T12:53:33ZPietro Fezzardipietrofezzardi@gmail.com
New prototype for cfg_handler to remove the global variable *current_ppg.
The current ppg is now passed as argument to the cfg handler as follows:
typedef int (*cfg_handler)(int lineno, struct pp_globals *ppg,
union pp_cfg_arg *arg);
New variable added in include/ppsi/pp-instance.h:
struct pp_globals_cfg {
int cfg_items;
int cur_ppi_n;
};
Now struct pp_globals has a new field:
struct pp_globals {
[...]
struct pp_globals_cfg cfg;
[...]
};
The field cfg_items has been moved from pp_globals
to pp_globals_cfg. The configuration routine uses the field
cur_ppi_n inside pp_globals_cfg to store the current ppi being
configured. So neither the global variable *current_ppi is needed
anymore.
The helper inline function CUR_PPI has been defined to make
accesses to current ppi more readable.https://ohwr.org/project/ppsi/commit/6b84951e03e44c790816d8b61f188eb547d1fa43arch-wrs: try connecting to HAL multiple times2014-03-21T12:43:59ZGrzegorz Danilukgrzegorz.daniluk@cern.ch
As it was done also in ptp-noposix. We need to try multiple times
because sometimes it takes time for HAL to become ready (especially in
the GrandMaster mode when it has to lock SoftPLL to an ext clock).https://ohwr.org/project/ppsi/commit/0a8e929e1943b8d346b7b2e98640c46ed655f209use INST() to access instances everywhere2014-03-21T12:31:15ZPietro Fezzardipietrofezzardi@gmail.com
given that INTS() is defined as inline it should not affect
the performance even in time-critical cases.https://ohwr.org/project/ppsi/commit/85e1aa6af096bd46981e7759aaa1c0172aa3874dnew inline function to get ppi from ppg2014-03-02T15:14:15ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/0e2f8cb21c19875b57189c5590bee606db7af5bcconfig: fixed some error detection and printouts2014-03-02T14:31:51ZPietro Fezzardipietrofezzardi@gmail.com
previously one could use config options without arguments, or
config options with wrong names, and the program did not complain.
now you have to use correct names for config options and only
options with type ARG_NONE can be without arguments.
hardcoded default config file and config string are supposed
always correct so there's still no error check on their parsing.
however for any config options passed from command line with -f or
-C all the checks are enabled. if there are some syntax errors or
options without value the process exits with errors, printing
informations on all the found configuration errors.https://ohwr.org/project/ppsi/commit/e6748f4c1c1c060bce9d458681950befd3b20b5ewrs-time.c: changed exit(-1) to exit(1)2014-03-02T14:31:51ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/8126efa2f8400de57161659766dea903606065c7trivial: add and fix comments2014-03-02T14:31:51ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/e78c5d6a91f48999cc00eb319ca9bd1b1c92b4e4trivial: change old one-way delay to meanPathDelay2014-03-02T14:31:51ZPietro Fezzardipietrofezzardi@gmail.com
both in comments and in diagnosticshttps://ohwr.org/project/ppsi/commit/0a440eb3d1ffc6e7abe322cfb6f30fa16c960c46proto-standard/arith.c: used PP_NSEC_PER_SEC2014-03-02T14:31:51ZPietro Fezzardipietrofezzardi@gmail.com
instead of bare numbershttps://ohwr.org/project/ppsi/commit/d757678ae3b24b4d17671caf65a7d972661a4953trivial: servo: typo and whitespace2014-03-02T14:31:51ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/521ba96371f7caba5f61c7032805e1319a0f3241general: pp_open_globals renamed to pp_init globals2014-03-02T14:31:51ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/ff6d47bbd486cf85ab5c8b9ae16520579f42add6general: changed prototype of pp_open_globals2014-03-02T14:31:51ZPietro Fezzardipietrofezzardi@gmail.com
now it reflects the definition in pp_ext_hooks. With this new prototype
you can always choose a different pp_runtime_opts to be used for the
initializationhttps://ohwr.org/project/ppsi/commit/99c0d78e5fd06f15a218bee5618bdd13bfe12936lib/conf.c: trivial: use builtin blank() function2014-03-02T14:31:51ZPietro Fezzardipietrofezzardi@gmail.com
instead to rewrite every time the checks for the parserhttps://ohwr.org/project/ppsi/commit/961deb82b661790abe34f066256d28df2436b31bMakefile: make clean doesn't remove kconfig stuff2013-12-02T15:19:09ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/cd75d6f0fab87e5eb8fd991aa178b48f5967444blib/conf.c: fix ARG_NONE, factorize code2013-12-02T15:19:09ZPietro Fezzardipietrofezzardi@gmail.com
Every case of the switch was colling the cfg_handler out of the
switch construct, avery time with the same arguments.
The only case not calling the config function was case ARG_NONE.
But this doesn't make sense, because if a configuration option
does not do anything, then it should not be there, even without
arguments.
So the call to config function is now made from every case, even
ARG_NONE, then it should not stay inside the switch.https://ohwr.org/project/ppsi/commit/35456ab1589f5836e79e0d77a258e1047f395fb8configuration: added ARG_TIME config argument2013-12-02T15:19:09ZPietro Fezzardipietrofezzardi@gmail.com
and all the data structures needed to set configuration options
about time.
In ppsi.h added struct pp_cfg_time a platform independent timespec-like
data structure.
union pp_cfg_arg is extended with a pp_cfg_time field.
enum pp_argtype is extended with ARG_TIME.
In lib/conf.c a case ARG_TIME is added to handle it.https://ohwr.org/project/ppsi/commit/eac7e3703444c08b8bee770d7ca5ba655a435447conf: fix ARG_STR error in skipping leading blanks2013-11-26T14:32:04ZPietro Fezzardipietrofezzardi@gmail.comhttps://ohwr.org/project/ppsi/commit/f68e4b71281d72a2c2b12e9f381508b6e9079c09configuration: new prototype for cfg_handler2013-11-26T14:32:04ZPietro Fezzardipietrofezzardi@gmail.com
in ppsi.h. This allows to pass only a single argument to cfg_handlers
configuration functions.
Definitions of functions and arguments have been updated in lib/conf.c to
follow this changes.https://ohwr.org/project/ppsi/commit/7c298149551db709e8fdbf2c105f798680eb2bc4MAKEALL: some improvements2013-11-18T14:27:19ZPietro Fezzardipietrofezzardi@gmail.com
- backup the existing .config file, if present, and restore it before exiting
- make clean before exitinghttps://ohwr.org/project/ppsi/commit/51e03c4921870f9a36aa40707848aea0ba2332e8general: check_packet is a network operation2013-11-15T08:32:21ZAlessandro Rubinirubini@gnudd.com
Since check_packet is using network channels (file descriptors), it is
better declared as a network operations. This allows, for example,
to make a simulator using ARCH=unix and only changing TIME= .
Signed-off-by: <span data-trailer="Signed-off-by:" data-user="9028"><a href="https://ohwr.org/rubini" title="rubini@gnudd.com"><img alt="Alessandro Rubini's avatar" src="https://secure.gravatar.com/avatar/18e4fb369cda4873020839db5911d1d1?s=32&d=identicon" class="avatar s16 avatar-inline" title="Alessandro Rubini"></a><a href="https://ohwr.org/rubini" title="rubini@gnudd.com">Alessandro Rubini</a> <<a href="mailto:rubini@gnudd.com" title="rubini@gnudd.com">rubini@gnudd.com</a>></span>https://ohwr.org/project/ppsi/commit/84df88906b6df93715e40538555035a15ebb511fbuild: avoid libraries: arch and protocols include OBJ-y instead2013-11-15T08:32:14ZAlessandro Rubinirubini@gnudd.com
This simplifies the build system, by relying in weak symbols instead
of the link order. We need weak symbols anyways for configuration, so
we can get rid of the libraries. The size of binaries returned at
build time is increased, because arch/ and lib/ stuff is not part of
ppsi.o (as it actually should).
Signed-off-by: <span data-trailer="Signed-off-by:" data-user="9028"><a href="https://ohwr.org/rubini" title="rubini@gnudd.com"><img alt="Alessandro Rubini's avatar" src="https://secure.gravatar.com/avatar/18e4fb369cda4873020839db5911d1d1?s=32&d=identicon" class="avatar s16 avatar-inline" title="Alessandro Rubini"></a><a href="https://ohwr.org/rubini" title="rubini@gnudd.com">Alessandro Rubini</a> <<a href="mailto:rubini@gnudd.com" title="rubini@gnudd.com">rubini@gnudd.com</a>></span>