Commit 65fb29b5 authored by Alessandro Rubini's avatar Alessandro Rubini

softpll and dump: add a log of the last 16 fifo values

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 734840b7
......@@ -224,16 +224,30 @@ static inline void update_loops(struct softpll_state *s, int tag_value, int tag_
}
}
struct spll_fifo_log fifo_log[FIFO_LOG_LEN];
void _irq_entry(void)
{
struct softpll_state *s = (struct softpll_state *)&softpll;
uint32_t trr;
int i, tag_source, tag_value;
static uint16_t tag_count;
struct spll_fifo_log *l;
/* check if there are more tags in the FIFO */
/* check if there are more tags in the FIFO, and log them */
while (!(SPLL->TRR_CSR & SPLL_TRR_CSR_EMPTY)) {
volatile uint32_t trr = SPLL->TRR_R0;
int tag_source = SPLL_TRR_R0_CHAN_ID_R(trr);
int tag_value = SPLL_TRR_R0_VALUE_R(trr);
trr = SPLL->TRR_R0;
/* save this to a circular buffer */
i = tag_count % FIFO_LOG_LEN;
l = fifo_log + i;
l->trr = trr;
l->irq_count = s->irq_count & 0xffff;
l->tag_count = tag_count++;
/* And process the values */
tag_source = SPLL_TRR_R0_CHAN_ID_R(trr);
tag_value = SPLL_TRR_R0_VALUE_R(trr);
sequencing_fsm(s, tag_value, tag_source);
update_loops(s, tag_value, tag_source);
......
......@@ -193,5 +193,13 @@ struct softpll_state {
struct spll_ptracker_state ptrackers[MAX_PTRACKERS];
};
struct spll_fifo_log {
uint32_t trr;
uint16_t irq_count;
uint16_t tag_count;
};
#define FIFO_LOG_LEN 16
#endif // __SOFTPLL_NG_H
......@@ -464,6 +464,16 @@ static struct dump_info pll_info [] = {
/* FIXME: aux_state and ptracker_state -- variable-len arrays */
};
#undef DUMP_STRUCT
#define DUMP_STRUCT struct spll_fifo_log
static struct dump_info fifo_info [] = {
DUMP_FIELD(uint32_t, trr),
DUMP_FIELD(uint16_t, irq_count),
DUMP_FIELD(uint16_t, tag_count),
};
/* Use: wrs_dump_memory <file> <hex-offset> <name> */
int main(int argc, char **argv)
{
......@@ -517,6 +527,15 @@ int main(int argc, char **argv)
dump_many_fields(mapaddr + offset,
ARRAY_AND_SIZE(pll_info));
}
if (!strcmp(argv[3], "fifo")) {
int i;
printf("fifo log at 0x%lx\n", offset);
for (i = 0; i < FIFO_LOG_LEN; i++)
dump_many_fields(mapaddr + offset
+ i * sizeof(struct spll_fifo_log),
ARRAY_AND_SIZE(fifo_info));
}
if (!strcmp(argv[3], "ppg")) {
printf("ppg at 0x%lx\n", offset);
dump_many_fields(mapaddr + offset,
......
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