Commit aa2dd48e authored by Alessandro Rubini's avatar Alessandro Rubini

softpll-unify: header changes

softpll is built for both wrc and wrs; since it includes wrc.h and
syscon.h, we must make them suitable for both environments.

Waiting for the time and energies for a better merge, this uses ifdef
to differentiate the two cases: the timer code is different (different
prototypes) and the clock frequency is different as well (125 vs 62.5
MHz).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent f33e4302
......@@ -4,6 +4,16 @@
#include <inttypes.h>
#include <sys/types.h>
#ifdef CONFIG_WR_SWITCH
#define TICS_PER_SECOND 100000
uint32_t timer_get_tics();
void timer_delay(uint32_t how_long);
int timer_expired(uint32_t t_start, uint32_t how_long);
#else /* CONFIG_WR_NODE */
#include "board.h"
#undef PACKED /* if we already included a regs file, we'd get a warning */
#include <hw/wrc_syscon_regs.h>
......@@ -68,4 +78,5 @@ static inline int sysc_get_memsize()
return (SYSC_HWFR_MEMSIZE_R(syscon->HWFR) + 1) * 16;
}
#endif /* CONFIG_WR_NODE */
#endif
......@@ -24,9 +24,15 @@ void shell_init(void);
int wrc_log_stats(uint8_t onetime);
void wrc_debug_printf(int subsys, const char *fmt, ...);
/* Default width (in 8ns units) of the pulses on the PPS output */
#define PPS_WIDTH (10 * 1000 * 1000 / 8) /* 10ms */
/* This header is included by softpll: manage wrc/wrs difference */
#ifdef CONFIG_WR_NODE
#define NS_PER_CLOCK 8
#else /* CONFIG_WR_SWITCH */
#define NS_PER_CLOCK 16
#endif
/* Default width (in 8ns/16ns units) of the pulses on the PPS output */
#define PPS_WIDTH (10 * 1000 * 1000 / NS_PER_CLOCK) /* 10ms */
/* This is in the library, somewhere */
extern int abs(int val);
......
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