Link it all together, but in slave-only mode.

Since the master implementation is still lacking, we will just keep
the slave-only flag hard coded for now.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2011-11-13 12:39:49 +01:00
parent dae76b951a
commit ebd353aff6
5 changed files with 16 additions and 2 deletions

View File

@ -334,6 +334,11 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx,
pr_debug("path delay %10lld", c->path_delay); pr_debug("path delay %10lld", c->path_delay);
} }
int clock_slave_only(struct clock *c)
{
return c->dds.slaveOnly;
}
void clock_synchronize(struct clock *c, void clock_synchronize(struct clock *c,
struct timespec ingress_ts, struct timestamp origin_ts, struct timespec ingress_ts, struct timestamp origin_ts,
Integer64 correction1, Integer64 correction2) Integer64 correction1, Integer64 correction2)

View File

@ -126,6 +126,13 @@ void clock_path_delay(struct clock *c, struct timespec req, struct timestamp rx,
*/ */
int clock_poll(struct clock *c); int clock_poll(struct clock *c);
/**
* Obtain the slave-only flag from a clock's default data set.
* @param c The clock instance.
* @return The value of the clock's slave-only flag.
*/
int clock_slave_only(struct clock *c);
/** /**
* Provide a data point to synchronize the clock. * Provide a data point to synchronize the clock.
* @param c The clock instance to synchronize. * @param c The clock instance to synchronize.

View File

@ -135,6 +135,7 @@ int main(int argc, char *argv[])
phc = NULL; phc = NULL;
} }
ds.slaveOnly = TRUE; // TODO - make this programmable.
ds.priority1 = 128; ds.priority1 = 128;
ds.clockQuality.clockClass = 248; ds.clockQuality.clockClass = 248;
ds.clockQuality.clockAccuracy = 0xfe; ds.clockQuality.clockAccuracy = 0xfe;

View File

@ -32,7 +32,7 @@ DEPEND = $(OBJ:.o=.d)
srcdir := $(dir $(lastword $(MAKEFILE_LIST))) srcdir := $(dir $(lastword $(MAKEFILE_LIST)))
VPATH = $(srcdir) VPATH = $(srcdir)
all: $(OBJ) all: linuxptp
linuxptp: $(OBJ) linuxptp: $(OBJ)

3
port.c
View File

@ -584,7 +584,8 @@ struct foreign_clock *port_compute_best(struct port *p)
void port_dispatch(struct port *p, enum fsm_event event) void port_dispatch(struct port *p, enum fsm_event event)
{ {
enum port_state next = ptp_fsm(p->state, event); enum port_state next = clock_slave_only(p->clock) ?
ptp_slave_fsm(p->state, event) : ptp_fsm(p->state, event);
if (PS_INITIALIZING == next) { if (PS_INITIALIZING == next) {
/* /*