Commit 52300c09 authored by Adam Wujek's avatar Adam Wujek

arch-wrpc: add setting of an offset

Signed-off-by: 's avatarAdam Wujek <adam.wujek@creotech.pl>
parent 2dbbf69c
......@@ -121,8 +121,6 @@ int wrc_ptp_init()
pp_printf("PPSi for WRPC. Commit %s, built on " __DATE__ "\n",
PPSI_VERSION);
ppg->timePropertiesDS->currentUtcOffset = CONFIG_LEAP_SECONDS_VAL;
/* copy default ppi config */
memcpy(&ppi->cfg, &__pp_default_instance_cfg, sizeof(__pp_default_instance_cfg));
ppi->ext_hooks =&pp_hooks; /* default value */
......@@ -410,3 +408,17 @@ int wrc_pps_force(wrpc_pps_force_t action)
wrpc_enable_timing_output(ppg, 2);
return action & 1;
}
void wrc_ptp_set_leapsec(int leapsec)
{
TOPS(INST(ppg, 0))->set_utc_offset(NULL, leapsec, 0, 0);
}
void wrc_ptp_get_leapsec(int *ptp, int *system)
{
int tmp;
*ptp = ppg->timePropertiesDS->currentUtcOffset;
TOPS(INST(ppg, 0))->get_utc_offset(NULL, system, &tmp, &tmp);
return;
}
......@@ -72,6 +72,10 @@ int wrc_ptp_bmc_update(void);
int wrc_ptp_link_down(void);
int wrc_pps_force(wrpc_pps_force_t action);
int wrpc_get_GM_lock_state(struct pp_globals *ppg, pp_timing_mode_state_t *state);
void wrc_ptp_set_leapsec(int leapsec);
void wrc_ptp_get_leapsec(int *ptp, int *system);
/* wrpc-calibration.c */
......
......@@ -10,6 +10,8 @@
#include "dev/syscon.h" /* in wrpc-sw */
#include "../arch-wrpc/wrpc.h"
static int utcOffset = CONFIG_LEAP_SECONDS_VAL;
static int wrpc_time_get_utc_time(struct pp_instance *ppi, int *hours, int *minutes, int *seconds)
{
/* no UTC time */
......@@ -21,17 +23,16 @@ static int wrpc_time_get_utc_time(struct pp_instance *ppi, int *hours, int *minu
static int wrpc_time_get_utc_offset(struct pp_instance *ppi, int *offset, int *leap59, int *leap61)
{
/* no UTC offset */
*leap59 = 0;
*leap61 = 0;
*offset = 0;
return -1;
*offset = utcOffset;
return 0;
}
static int wrpc_time_set_utc_offset(struct pp_instance *ppi, int offset, int leap59, int leap61)
{
/* no UTC offset */
return -1;
utcOffset = offset;
return 0;
}
static int wrpc_time_get(struct pp_instance *ppi, struct pp_time *t)
......
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