Commit b6eb1385 authored by Alessandro Rubini's avatar Alessandro Rubini

time-unix: new directory, selected by arch-unix

This is the first implementation of the concept ot "TIME=" on the
configuration of ppsi.  Time-related code that used to live in arch-unix
is now split into its own directory. If you have special timing hardware,
you can write your own pp_network_operations and pp_time_operations
in your own directory and select them using TIME= .

We'll do Linux-specific hardware timestamping soon, and WhiteRabbit as
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <>
parent 7909e33c
......@@ -53,10 +53,16 @@ ifdef PROTO_EXT
include proto-standard/Makefile
# Include arch code
# we need this -I so <arch/arch.h> can be found
# We need this -I so <arch/arch.h> can be found
CFLAGS += -Iarch-$(ARCH)/include
# Include arch code. Each arch chooses its own time directory..
include arch-$(ARCH)/Makefile
# ...and the TIME choice sets the default operations
export CFLAGS
# And this is the rule to build our target.o file. The architecture may
......@@ -10,15 +10,21 @@ LIBARCH := $A/libarch.a
OBJ-libarch := $A/unix-startup.o \
$A/main-loop.o \
$A/unix-socket.o \
$A/unix-io.o \
$A/unix-time.o \
lib/cmdline.o \
lib/conf.o \
lib/libc-functions.o \
lib/dump-funcs.o \
# The user can set TIME=, but we pick unix time by default
TIME ?= unix
include time-$(TIME)/Makefile
# Unix time operations are always included as a fallback
include time-unix/Makefile
$(LIBARCH): $(OBJ-libarch)
$(AR) r $@ $^
......@@ -110,8 +110,10 @@ int main(int argc, char **argv)
/* FIXME set ppi ext enable as defined in its pp_link */
ppi->portDS = calloc(1, sizeof(*ppi->portDS));
ppi->n_ops = &unix_net_ops;
ppi->t_ops = &unix_time_ops;
/* The following default names depend on TIME= at build time */
ppi->n_ops = &DEFAULT_NET_OPS;
ppi->t_ops = &DEFAULT_TIME_OPS;
if (!ppi->portDS)
# Alessandro Rubini for CERN, 2013 -- public domain
# This Makefile in included by architectures that select time-unix
# as a default, or by builds with explicit TIME=unix.
# Object files are added to libarch, so they are picked on demand.
OBJ-libarch += \
time-unix/unix-time.o \
......@@ -18,7 +18,7 @@
#include <ppsi/ppsi.h>
#include "ptpdump.h"
#include "ppsi-unix.h"
#include "../arch-unix/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,
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