Commit 48e651b1 authored by Aurelio Colosimo's avatar Aurelio Colosimo Committed by Alessandro Rubini

pps_gen_ functions renamed to shw_pps_gen_

Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent 9f54cfb1
......@@ -240,7 +240,7 @@ int minic_rx_frame(uint8_t * hdr, uint8_t * payload, uint32_t buf_size,
payload_size + 4, 2);
EXPLODE_WR_TIMESTAMP(raw_ts, counter_r, counter_f);
pps_gen_get_time(&sec, &counter_ppsg);
shw_pps_gen_get_time(&sec, &counter_ppsg);
if (counter_r > 3 * REF_CLOCK_FREQ_HZ / 4
&& counter_ppsg < 250000000)
......@@ -351,7 +351,7 @@ int minic_tx_frame(uint8_t * hdr, uint8_t * payload, uint32_t size,
}
EXPLODE_WR_TIMESTAMP(raw_ts, counter_r, counter_f);
pps_gen_get_time(&sec, &nsec);
shw_pps_gen_get_time(&sec, &nsec);
if (counter_r > 3 * REF_CLOCK_FREQ_HZ / 4 && nsec < 250000000)
sec--;
......
......@@ -29,7 +29,7 @@
#define ppsg_read(reg) \
*(volatile uint32_t *) (BASE_PPS_GEN + (offsetof(struct PPSG_WB, reg)))
void pps_gen_init()
void shw_pps_gen_init()
{
uint32_t cr;
......@@ -47,7 +47,7 @@ void pps_gen_init()
}
/* Adjusts the nanosecond (refclk cycle) counter by atomically adding (how_much) cycles. */
int pps_gen_adjust(int counter, int64_t how_much)
int shw_pps_gen_adjust(int counter, int64_t how_much)
{
TRACE_DEV("Adjust: counter = %s [%c%d]\n",
counter == PPSG_ADJUST_SEC ? "seconds" : "nanoseconds",
......@@ -70,7 +70,7 @@ int pps_gen_adjust(int counter, int64_t how_much)
}
/* Sets the current time */
void pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds)
void shw_pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds)
{
ppsg_write(ADJ_UTCLO, (uint32_t) (seconds & 0xffffffffLL));
ppsg_write(ADJ_UTCHI, (uint32_t) (seconds >> 32) & 0xff);
......@@ -95,7 +95,7 @@ uint64_t pps_get_utc(void)
return out;
}
void pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds)
void shw_pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds)
{
uint32_t ns_cnt;
uint64_t sec1, sec2;
......@@ -115,14 +115,14 @@ void pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds)
}
/* Returns 1 when the adjustment operation is not yet finished */
int pps_gen_busy()
int shw_pps_gen_busy()
{
uint32_t cr = ppsg_read(CR);
return cr & PPSG_CR_CNT_ADJ ? 0 : 1;
}
/* Enables/disables PPS output */
int pps_gen_enable_output(int enable)
int shw_pps_gen_enable_output(int enable)
{
uint32_t escr = ppsg_read(ESCR);
if (enable)
......
......@@ -7,21 +7,21 @@
#define PPSG_ADJUST_NSEC 0x2
/* Initializes the PPS Generator. 0 on success, negative on failure. */
void pps_gen_init(void);
void shw_pps_gen_init(void);
/* Adjusts the <counter> (PPSG_ADJUST_SEC/NSEC) by (how_much) seconds/nanoseconds */
int pps_gen_adjust(int counter, int64_t how_much);
int shw_pps_gen_adjust(int counter, int64_t how_much);
/* Returns 1 when the PPS is busy adjusting its time counters, 0 if PPS gen idle */
int pps_gen_busy(void);
int shw_pps_gen_busy(void);
/* Enables/disables PPS Generator PPS output */
int pps_gen_enable_output(int enable);
int shw_pps_gen_enable_output(int enable);
/* Reads the current time and stores at <seconds,nanoseconds>. */
void pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds);
void shw_pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds);
/* Sets the time to <seconds,nanoseconds>. */
void pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds);
void shw_pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds);
#endif
......@@ -44,7 +44,7 @@ void wrc_mon_gui(void)
pcprintf(1, 1, C_BLUE, "WR PTP Core Sync Monitor v 1.0");
pcprintf(2, 1, C_GREY, "Esc = exit");
pps_gen_get_time(&sec, &nsec);
shw_pps_gen_get_time(&sec, &nsec);
cprintf(C_BLUE, "\n\nTAI Time: ");
cprintf(C_WHITE, "%s", format_time(sec));
......@@ -175,7 +175,7 @@ int wrc_log_stats(uint8_t onetime)
last = timer_get_tics();
pps_gen_get_time(&sec, &nsec);
shw_pps_gen_get_time(&sec, &nsec);
halexp_get_port_state(&ps, NULL);
minic_get_stats(&tx, &rx);
mprintf("lnk:%d rx:%d tx:%d ", ps.up, rx, tx);
......
ptp-noposix @ d0923675
Subproject commit 4864f12fab7336789ea28e851136ecc21e185610
Subproject commit d09236750dde5346ca38646a9ae7b1124e9e1abd
......@@ -29,11 +29,11 @@ int cmd_time(const char *args[])
uint64_t sec;
uint32_t nsec;
pps_gen_get_time(&sec, &nsec);
shw_pps_gen_get_time(&sec, &nsec);
if (args[2] && !strcasecmp(args[0], "set")) {
if (wrc_ptp_get_mode() != WRC_MODE_SLAVE) {
pps_gen_set_time((uint64_t) atoi(args[1]),
shw_pps_gen_set_time((uint64_t) atoi(args[1]),
atoi(args[2]));
return 0;
} else
......
......@@ -75,7 +75,7 @@ static void wrc_initialize()
ep_enable(1, 1);
minic_init();
pps_gen_init();
shw_pps_gen_init();
wrc_ptp_init();
#ifdef CONFIG_ETHERBONE
......
......@@ -122,7 +122,7 @@ int wrc_ptp_set_mode(int mode)
mprintf("Locking PLL");
pps_gen_enable_output(0);
shw_pps_gen_enable_output(0);
while (!spll_check_lock(0) && lock_timeout) {
timer_delay(TICS_PER_SECOND);
......@@ -137,7 +137,7 @@ int wrc_ptp_set_mode(int mode)
}
if (mode == WRC_MODE_MASTER || mode == WRC_MODE_GM)
pps_gen_enable_output(1);
shw_pps_gen_enable_output(1);
mprintf("\n");
ptp_mode = mode;
......
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