Commit 8103ed49 authored by Alessandro Rubini's avatar Alessandro Rubini

softpll: trivial header cleanup (needed for next commit)

This commit has no effect on the final binary file.

The state structures for softpll_ng must be accessed by tools/wrpc-dump,
so we need them in an header (not in sofpll_mg.c itself).

Unfortunately, struct softpll_state includes a lot of other structures,
so all dependent headers must be included by softpll_ng.h.  Thus,
all C files should now include softpll_ng.h alone, not the other ones.

I also had to remove inclusion of unneeded <stdint.h> and <stdlib.h>
from spll_common.h, because stdlib pulled the prototype for abs()
which is #defined in ppsi (my bad!), and we would have a build error.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 5aaedcc5
......@@ -28,19 +28,7 @@ volatile struct PPSG_WB *PPSG;
int spll_n_chan_ref, spll_n_chan_out;
/*
* The includes below contain code (not only declarations) to enable
* the compiler to inline functions where necessary and save some CPU
* cycles
*/
#include "spll_defs.h"
#include "spll_common.h"
#include "spll_debug.h"
#include "spll_helper.h"
#include "spll_main.h"
#include "spll_ptracker.h"
#include "spll_external.h"
#define MAIN_CHANNEL (spll_n_chan_ref)
......@@ -60,30 +48,6 @@ int spll_n_chan_ref, spll_n_chan_out;
#define AUX_ALIGN_PHASE 3
#define AUX_READY 4
struct spll_aux_state {
int seq_state;
int32_t phase_target;
union {
struct spll_main_state dmtd;
/* spll_external_state ch_bb */
} pll;
};
struct softpll_state {
int mode;
int seq_state;
int dac_timeout;
int default_dac_main;
int delock_count;
int32_t mpll_shift_ps;
struct spll_helper_state helper;
struct spll_external_state ext;
struct spll_main_state mpll;
struct spll_aux_state aux[MAX_CHAN_AUX];
struct spll_ptracker_state ptrackers[MAX_PTRACKERS];
};
static const struct stringlist_entry seq_states [] =
{
{ SEQ_START_EXT, "start-ext" },
......
......@@ -13,6 +13,14 @@
#define __SOFTPLL_NG_H
#include <stdint.h>
#include "spll_defs.h"
#include "spll_common.h"
#include "spll_debug.h"
#include "spll_helper.h"
#include "spll_main.h"
#include "spll_ptracker.h"
#include "spll_external.h"
/* SoftPLL operating modes, for mode parameter of spll_init(). */
......@@ -155,5 +163,34 @@ struct spll_stats {
/* This only exists in wr-switch, but we should use it always */
extern struct spll_stats stats;
/*
* Aux and main state:
* used to be in .c file, but we need it here for memory dumping
*/
struct spll_aux_state {
int seq_state;
int32_t phase_target;
union {
struct spll_main_state dmtd;
/* spll_external_state ch_bb */
} pll;
};
struct softpll_state {
int mode;
int seq_state;
int dac_timeout;
int default_dac_main;
int delock_count;
int32_t mpll_shift_ps;
struct spll_helper_state helper;
struct spll_external_state ext;
struct spll_main_state mpll;
struct spll_aux_state aux[MAX_CHAN_AUX];
struct spll_ptracker_state ptrackers[MAX_PTRACKERS];
};
#endif // __SOFTPLL_NG_H
......@@ -13,8 +13,7 @@
#include <string.h>
#include <pp-printf.h>
#include "trace.h"
#include "spll_defs.h"
#include "spll_common.h"
#include "softpll_ng.h"
int pi_update(spll_pi_t *pi, int x)
{
......
......@@ -12,15 +12,11 @@
#ifndef __SPLL_COMMON_H
#define __SPLL_COMMON_H
#include <stdint.h>
#include <stdlib.h>
#include <syscon.h>
#include <hw/softpll_regs.h>
#include <hw/pps_gen_regs.h>
#include "spll_defs.h"
#define SPLL_LOCKED 1
#define SPLL_LOCKING 0
......
......@@ -10,8 +10,7 @@
/* spll_external.h - implementation of SoftPLL servo for the
external (10 MHz - Grandmaster mode) reference channel */
#include "spll_external.h"
#include "spll_debug.h"
#include "softpll_ng.h"
#include <pp-printf.h>
#include "trace.h"
......
......@@ -13,9 +13,7 @@
#ifndef __SPLL_EXTERNAL_H
#define __SPLL_EXTERNAL_H
#include "spll_common.h"
#include "spll_helper.h"
#include "spll_main.h"
#include "softpll_ng.h"
struct spll_external_state {
struct spll_helper_state *helper;
......
......@@ -9,8 +9,7 @@
/* spll_helper.c - implmentation of the Helper PLL servo algorithm. */
#include "spll_helper.h"
#include "spll_debug.h"
#include "softpll_ng.h"
const int helper_precomp_coefs [] =
{ /*b0*/ 60648,
......
......@@ -9,8 +9,7 @@
/* spll_main.c - Implementation of the main DDMTD PLL. */
#include "spll_main.h"
#include "spll_debug.h"
#include "softpll_ng.h"
#include <pp-printf.h>
#include "trace.h"
......
......@@ -13,8 +13,6 @@
#ifndef __SPLL_MAIN_H
#define __SPLL_MAIN_H
#include "spll_common.h"
/* State of the Main PLL */
struct spll_main_state {
int state;
......
......@@ -9,7 +9,7 @@
/* spll_ptracker.c - implementation of phase trackers. */
#include "spll_ptracker.h"
#include "softpll_ng.h"
static int tag_ref = -1;
......
......@@ -12,8 +12,6 @@
#ifndef __SPLL_PTRACKER_H
#define __SPLL_PTRACKER_H
#include "spll_common.h"
struct spll_ptracker_state {
int enabled, id;
int n_avg, acc, avg_count, preserve_sign;
......
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