Commit c0b2a8ad authored by Alessandro Rubini's avatar Alessandro Rubini

warnings: kill all warnings in pps_gen.[ch]

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 1459a6d5
#include <wrc.h>
#include "board.h" #include "board.h"
#include "pps_gen.h" #include "pps_gen.h"
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
#define ppsg_read(reg) \ #define ppsg_read(reg) \
*(volatile uint32_t *) (BASE_PPS_GEN + (offsetof(struct PPSG_WB, reg))) *(volatile uint32_t *) (BASE_PPS_GEN + (offsetof(struct PPSG_WB, reg)))
int pps_gen_init() void pps_gen_init()
{ {
uint32_t cr; uint32_t cr;
...@@ -38,8 +39,6 @@ int pps_gen_init() ...@@ -38,8 +39,6 @@ int pps_gen_init()
/* Adjusts the nanosecond (refclk cycle) counter by atomically adding (how_much) cycles. */ /* Adjusts the nanosecond (refclk cycle) counter by atomically adding (how_much) cycles. */
int pps_gen_adjust(int counter, int64_t how_much) int pps_gen_adjust(int counter, int64_t how_much)
{ {
uint32_t cr;
TRACE_DEV("Adjust: counter = %s [%c%d]\n", TRACE_DEV("Adjust: counter = %s [%c%d]\n",
counter == PPSG_ADJUST_SEC ? "seconds" : "nanoseconds", counter == PPSG_ADJUST_SEC ? "seconds" : "nanoseconds",
how_much < 0 ? '-' : '+', (int32_t) abs(how_much)); how_much < 0 ? '-' : '+', (int32_t) abs(how_much));
...@@ -61,10 +60,8 @@ int pps_gen_adjust(int counter, int64_t how_much) ...@@ -61,10 +60,8 @@ int pps_gen_adjust(int counter, int64_t how_much)
} }
/* Sets the current time */ /* Sets the current time */
int pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds) void pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds)
{ {
uint32_t cr;
ppsg_write(ADJ_UTCLO, (uint32_t) (seconds & 0xffffffffLL)); ppsg_write(ADJ_UTCLO, (uint32_t) (seconds & 0xffffffffLL));
ppsg_write(ADJ_UTCHI, (uint32_t) (seconds >> 32) & 0xff); ppsg_write(ADJ_UTCHI, (uint32_t) (seconds >> 32) & 0xff);
ppsg_write(ADJ_NSEC, ppsg_write(ADJ_NSEC,
...@@ -72,7 +69,6 @@ int pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds) ...@@ -72,7 +69,6 @@ int pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds)
(int64_t) REF_CLOCK_PERIOD_PS)); (int64_t) REF_CLOCK_PERIOD_PS));
ppsg_write(CR, (ppsg_read(CR) & 0xfffffffb) | PPSG_CR_CNT_SET); ppsg_write(CR, (ppsg_read(CR) & 0xfffffffb) | PPSG_CR_CNT_SET);
return 0;
} }
uint64_t pps_get_utc(void) uint64_t pps_get_utc(void)
......
...@@ -7,21 +7,21 @@ ...@@ -7,21 +7,21 @@
#define PPSG_ADJUST_NSEC 0x2 #define PPSG_ADJUST_NSEC 0x2
/* Initializes the PPS Generator. 0 on success, negative on failure. */ /* Initializes the PPS Generator. 0 on success, negative on failure. */
int shw_pps_gen_init(); void pps_gen_init(void);
/* Adjusts the <counter> (PPSG_ADJUST_SEC/NSEC) by (how_much) seconds/nanoseconds */ /* Adjusts the <counter> (PPSG_ADJUST_SEC/NSEC) by (how_much) seconds/nanoseconds */
int shw_pps_gen_adjust(int counter, int64_t how_much); int 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 */ /* Returns 1 when the PPS is busy adjusting its time counters, 0 if PPS gen idle */
int shw_pps_gen_busy(); int pps_gen_busy(void);
/* Enables/disables PPS Generator PPS output */ /* Enables/disables PPS Generator PPS output */
int shw_pps_gen_enable_output(int enable); int pps_gen_enable_output(int enable);
/* Reads the current time and stores at <seconds,nanoseconds>. */ /* Reads the current time and stores at <seconds,nanoseconds>. */
void shw_pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds); void pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds);
/* Sets the time to <seconds,nanoseconds>. */ /* Sets the time to <seconds,nanoseconds>. */
void shw_pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds); void pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds);
#endif #endif
...@@ -12,6 +12,10 @@ int mprintf(char const *format, ...) ...@@ -12,6 +12,10 @@ int mprintf(char const *format, ...)
int wrc_mon_gui(void); int wrc_mon_gui(void);
/* This is in the library, somewhere */
extern int abs(int val);
/* The following from ptp-noposix */ /* The following from ptp-noposix */
extern void wr_servo_reset(void); extern void wr_servo_reset(void);
......
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