Commit ef25541c authored by Alessandro Rubini's avatar Alessandro Rubini

Merge branch 'split-time-directories'

This patch-set creates the "time-" directory set, allowing different
time engines to be used for the unix architectures. This also
allows to cleanly create arch-wrs and time-wrs, done by Aurelio
in the next commits.
parents c3e5f1c6 e64e6194
......@@ -53,10 +53,16 @@ ifdef PROTO_EXT
endif
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
CFLAGS += -DDEFAULT_TIME_OPS=$(TIME)_time_ops
CFLAGS += -DDEFAULT_NET_OPS=$(TIME)_net_ops
export CFLAGS
# And this is the rule to build our target.o file. The architecture may
......
......@@ -18,15 +18,17 @@ LIBARCH := $A/libarch.a
OBJ-libarch := $L/bare-startup.o \
$L/main-loop.o \
$L/bare-socket.o \
$L/bare-io.o \
$L/bare-time.o \
$A/syscalls.o \
lib/libc-functions.o \
lib/dump-funcs.o \
lib/cmdline.o \
lib/div64.o
# We only support "bare" time operations
TIME := bare
include time-bare/Makefile
$(LIBARCH): $(OBJ-libarch)
$(AR) r $@ $^
......
......@@ -18,9 +18,7 @@ LIBARCH := $A/libarch.a
OBJ-libarch := $L/bare-startup.o \
$L/main-loop.o \
$L/bare-socket.o \
$L/bare-io.o \
$L/bare-time.o \
$A/syscall.o \
$A/syscalls.o \
lib/libc-functions.o \
......@@ -28,6 +26,10 @@ OBJ-libarch := $L/bare-startup.o \
lib/cmdline.o \
lib/div64.o
# We only support "bare" time operations
TIME := bare
include time-bare/Makefile
$(LIBARCH): $(OBJ-libarch)
$(AR) r $@ $^
......
......@@ -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 \
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)
$(AR) r $@ $^
......
......@@ -14,6 +14,3 @@ struct unix_arch_data {
extern int unix_net_check_pkt(struct pp_globals *ppg, int delay_ms);
extern void unix_main_loop(struct pp_globals *ppg);
extern struct pp_network_operations unix_net_ops;
extern struct pp_time_operations unix_time_ops;
......@@ -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)
exit(__LINE__);
......
......@@ -28,15 +28,18 @@ LIBARCH := $A/libarch.a
LIBS += -L$A -larch
OBJ-libarch := $A/wrpc-socket.o \
OBJ-libarch := \
$A/wrpc-io.o \
$A/wrpc-time.o \
$A/wrpc-spll.o \
$A/wrpc-calibration.o \
$A/wrc_ptp_ppsi.o \
lib/dump-funcs.o \
lib/div64.o
# We only support "wrpc" time operations
TIME := wrpc
include time-wrpc/Makefile
$(LIBARCH): $(OBJ-libarch)
$(AR) r $@ $^
......
This diff is collapsed.
......@@ -141,6 +141,9 @@ struct pp_network_operations {
TimeInternal *t, int chtype, int use_pdelay_addr);
};
/* These can be liked and used as fallback by a different timing engine */
extern struct pp_network_operations unix_net_ops;
/*
* Time operations, like network operations above, are encapsulated.
......@@ -159,6 +162,10 @@ struct pp_time_operations {
unsigned long (*calc_timeout)(struct pp_instance *ppi, int millisec);
};
/* These can be liked and used as fallback by a different timing engine */
extern struct pp_time_operations unix_time_ops;
/* FIXME this define is no more used; check whether it should be
* introduced again */
#define PP_ADJ_NS_MAX (500*1000)
......
# Alessandro Rubini for CERN, 2013 -- public domain
# This Makefile in included by architectures that select time-bare
# Object files are added to libarch, so they are picked on demand.
OBJ-libarch += \
time-bare/bare-time.o \
time-bare/bare-socket.o
# 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 @@
#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,
......
# Alessandro Rubini for CERN, 2013 -- public domain
# This Makefile in included by arch-wrpc.
# Object files are added to libarch, so they are picked on demand.
OBJ-libarch += \
time-wrpc/wrpc-time.o \
time-wrpc/wrpc-socket.o
......@@ -2,7 +2,6 @@
* Alessandro Rubini for CERN, 2011 -- GNU LGPL v2.1 or later
*/
#include <ppsi/ppsi.h>
#include "wrpc.h"
#include "ptpdump.h"
#include <ptpd_netif.h> /* wrpc-sw */
......
......@@ -3,7 +3,6 @@
* (Mostly code by Tomasz Wlostowski in wrpc-sw)
*/
#include <ppsi/ppsi.h>
#include "wrpc.h"
#include "pps_gen.h" /* in wrpc-sw */
#include "syscon.h" /* in wrpc-sw */
......
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