Commit 02702ff6 authored by Adam Wujek's avatar Adam Wujek

time-*: add function enable_timing_output

It is not checked in other parts of PPSi whether the pointer to
enable_timing_output is not NULL. To avoid crashes add dummy function.
Signed-off-by: 's avatarAdam Wujek <dev_public@wujek.eu>
parent 89b46691
......@@ -147,6 +147,21 @@ static unsigned long bare_calc_timeout(struct pp_instance *ppi, int millisec)
return now_ms + millisec;
}
static int bare_enable_timing_output(struct pp_globals *ppg, int enable)
{
static int prev_enable = 0;
if (prev_enable != enable) {
pp_diag(NULL, time, 2, "%s dummy timing output\n",
enable ? "enable" : "disable");
prev_enable = enable;
return 0;
}
return 0;
}
struct pp_time_operations bare_time_ops = {
.get_utc_time = bare_time_get_utc_time,
.get_utc_offset = bare_time_get_utc_offset,
......@@ -158,4 +173,5 @@ struct pp_time_operations bare_time_ops = {
.adjust_offset = bare_time_adjust_offset,
.adjust_freq = bare_time_adjust_freq,
.calc_timeout = bare_calc_timeout,
.enable_timing_output = bare_enable_timing_output
};
......@@ -142,6 +142,22 @@ static unsigned long sim_calc_timeout(struct pp_instance *ppi, int millisec)
return millisec + SIM_PPI_ARCH(ppi)->time.current_ns / 1000LL / 1000LL;
}
static int sim_enable_timing_output(struct pp_globals *ppg, int enable)
{
static int prev_enable = 0;
if (prev_enable != enable) {
pp_diag(NULL, time, 2, "%s dummy timing output\n",
enable ? "enable" : "disable");
prev_enable = enable;
return 0;
}
return 0;
}
struct pp_time_operations sim_time_ops = {
.get_utc_time = sim_time_get_utc_time,
.get_utc_offset = sim_time_get_utc_offset,
......@@ -154,4 +170,5 @@ struct pp_time_operations sim_time_ops = {
.adjust_freq = sim_adjust_freq,
.init_servo = sim_init_servo,
.calc_timeout = sim_calc_timeout,
.enable_timing_output = sim_enable_timing_output
};
......@@ -11,6 +11,7 @@
#include <time.h>
#include <sys/timex.h>
#include <ppsi/ppsi.h>
#include "../arch-unix/include/ppsi-unix.h"
#ifndef MOD_TAI
#define MOD_TAI 0x80
......@@ -280,6 +281,21 @@ static unsigned long unix_calc_timeout(struct pp_instance *ppi, int millisec)
return now_ms + millisec;
}
static int unix_enable_timing_output(struct pp_globals *ppg, int enable)
{
static int prev_enable = 0;
if (prev_enable != enable) {
pp_diag(NULL, time, 2, "%s dummy timing output\n",
enable ? "enable" : "disable");
prev_enable = enable;
return 0;
}
return 0;
}
struct pp_time_operations unix_time_ops = {
.get_utc_time = unix_time_get_utc_time,
.get_utc_offset = unix_time_get_utc_offset,
......@@ -291,5 +307,5 @@ struct pp_time_operations unix_time_ops = {
.adjust_freq = unix_time_adjust_freq,
.init_servo = unix_time_init_servo,
.calc_timeout = unix_calc_timeout,
.enable_timing_output = unix_enable_timing_output
};
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