rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
sense_trace_feed.c File Reference

Core 1's side of the trace of the FAST channel's 1ms samples: each tick's records into the ring, and the count of those it dropped. More...

#include "sense_trace.h"

Functions

static void drop (sense_trace_t *tr)
 A record that is not kept, counted as dropped.
static bool push (sense_trace_t *tr, sense_trace_kind_t kind, uint32_t t, int32_t v)
 One record into the ring; false, and counted as dropped, when it is full.
static void publish (sense_trace_t *tr, uint32_t cfg, uint32_t shunt, uint32_t tick_t)
 The set-up and the state as they stand: a record for each that moved, the shunt's first, written again at the next call while the ring has no room for it.
static void feed (sense_trace_t *tr, const sense_sched_t *s, uint32_t tick_t)
 The tick's records, when it has any. tick_t is its start.
void sense_trace_feed (sense_trace_t *tr, const sense_sched_t *s, uint64_t tick_us)
 Core 1, after each tick of s; NULL while no bus is open. tick_us is the time the caller read before the tick, on the clock the schedule reads: no time the tick's samples carry lies before it.

Detailed Description

Core 1's side of the trace of the FAST channel's 1ms samples: each tick's records into the ring, and the count of those it dropped.

See sense_trace.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ drop()

void drop ( sense_trace_t * tr)
static

A record that is not kept, counted as dropped.

The count core 0 reads moves with the one the next record carries, and stops with it.

Parameters
trThe trace.

◆ feed()

void feed ( sense_trace_t * tr,
const sense_sched_t * s,
uint32_t tick_t )
static

The tick's records, when it has any. tick_t is its start.

Parameters
trThe trace.
sThe schedule that has ticked; NULL when there is no bus.
tick_tStart of the tick, in 0.1ms.

◆ publish()

void publish ( sense_trace_t * tr,
uint32_t cfg,
uint32_t shunt,
uint32_t tick_t )
static

The set-up and the state as they stand: a record for each that moved, the shunt's first, written again at the next call while the ring has no room for it.

A record's time is the start of the tick the change was seen in, tick_t then: a tick with no sample has a time all the same, and a trigger between the last sample and the change lies before the change. A record kept since, while this one found no room, moves it to that record's time: the ring's times never run back.

Parameters
trThe trace.
cfgThe Configuration value of FAST's part.
shuntFAST's shunt, in µΩ.
tick_tStart of the tick, in 0.1ms.

◆ push()

bool push ( sense_trace_t * tr,
sense_trace_kind_t kind,
uint32_t t,
int32_t v )
static

One record into the ring; false, and counted as dropped, when it is full.

Parameters
trThe trace.
kindThe record kind.
tTime of the record, in 0.1ms.
vThe record value.
Returns
true when the record was put in the ring.

◆ sense_trace_feed()

void sense_trace_feed ( sense_trace_t * tr,
const sense_sched_t * s,
uint64_t tick_us )

Core 1, after each tick of s; NULL while no bus is open. tick_us is the time the caller read before the tick, on the clock the schedule reads: no time the tick's samples carry lies before it.

Parameters
trThe trace.
sThe schedule that has ticked.
tick_usThe time the caller read before the tick, in µs.