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
well.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 7909e33c
...@@ -53,10 +53,16 @@ ifdef PROTO_EXT ...@@ -53,10 +53,16 @@ ifdef PROTO_EXT
endif endif
include proto-standard/Makefile 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 CFLAGS += -Iarch-$(ARCH)/include
# Include arch code. Each arch chooses its own time directory..
include arch-$(ARCH)/Makefile include arch-$(ARCH)/Makefile
# ...and the TIME choice sets the default operations
CFLAGS += -DDEFAULT_TIME_OPS=$(TIME)_time_ops
CFLAGS += -DDEFAULT_NET_OPS=$(TIME)_net_ops
export CFLAGS export CFLAGS
# And this is the rule to build our target.o file. The architecture may # And this is the rule to build our target.o file. The architecture may
......
...@@ -10,15 +10,21 @@ LIBARCH := $A/libarch.a ...@@ -10,15 +10,21 @@ LIBARCH := $A/libarch.a
OBJ-libarch := $A/unix-startup.o \ OBJ-libarch := $A/unix-startup.o \
$A/main-loop.o \ $A/main-loop.o \
$A/unix-socket.o \
$A/unix-io.o \ $A/unix-io.o \
$A/unix-time.o \
lib/cmdline.o \ lib/cmdline.o \
lib/conf.o \ lib/conf.o \
lib/libc-functions.o \ lib/libc-functions.o \
lib/dump-funcs.o \ lib/dump-funcs.o \
lib/div64.o lib/div64.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) $(LIBARCH): $(OBJ-libarch)
$(AR) r $@ $^ $(AR) r $@ $^
......
...@@ -110,8 +110,10 @@ int main(int argc, char **argv) ...@@ -110,8 +110,10 @@ int main(int argc, char **argv)
/* FIXME set ppi ext enable as defined in its pp_link */ /* FIXME set ppi ext enable as defined in its pp_link */
ppi->portDS = calloc(1, sizeof(*ppi->portDS)); 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) if (!ppi->portDS)
exit(__LINE__); exit(__LINE__);
......
# 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 \
time-unix/unix-socket.o
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <ppsi/ppsi.h> #include <ppsi/ppsi.h>
#include "ptpdump.h" #include "ptpdump.h"
#include "ppsi-unix.h" #include "../arch-unix/ppsi-unix.h"
/* unix_recv_msg uses recvmsg for timestamp query */ /* unix_recv_msg uses recvmsg for timestamp query */
static int unix_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len, 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