Replies: 1 comment
-
|
The answers, Rafi, are in the //! TriceTransfer needs to be called cyclically to read out the Ring Buffer.
void TriceTransfer(void) {
#if TRICE_CGO == 0 // In automated tests we assume last transmission is finished, so we do not test depth to be able to test multiple Trices in deferred mode.
if (TriceOutDepth() > 0) { // Last transmission not finished. todo: Write TriceOutDepth() as dummy for TRICE_CGO.
return;
}
#endif
#if TRICE_DEFERRED_TRANSFER_MODE == TRICE_SINGLE_PACK_MODE
triceTransferSingleFraming();
#else
triceTransferMultiFraming();
#endif
}It is the users responsibility to call 2nd question answer: // triceRingBufferDiagnostics computes and tracks TriceRingBufferDepthMax
TRICE_INLINE void triceRingBufferDiagnostics(void) {
#if TRICE_DIAGNOSTICS == 1
int depth = (TriceBufferWritePosition - TriceRingBufferReadPosition) << 2; // lint !e845 Info 845: The left argument to operator '<<' is certain to be 0
if (depth < 0) {
depth += TRICE_DEFERRED_BUFFER_SIZE;
}
TriceRingBufferDepthMax = (depth > TriceRingBufferDepthMax) ? depth : TriceRingBufferDepthMax;
#endif // #if TRICE_DIAGNOSTICS == 1
}Usually
// triceRingBufferDepth computes the current TriceRingBufferDepth
int triceRingBufferDepth (void) {
int depth = (TriceBufferWritePosition - TriceRingBufferReadPosition) << 2; // lint !e845 Info 845: The left argument to operator '<<' is certain to be 0
if (depth < 0) {
depth += TRICE_DEFERRED_BUFFER_SIZE;
}
return depth;
}
Maybe you like to tell the use case for this. If it is of common interest, I could add this code to the Trice library. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi Thomas and all.
I got a question about TriceTransfer().
Is there a way to tell TriceTransfer() in RING BUFFER mode not to send all the entries , but just part of
them ?
and also ,
Is there recommended way to know how full is the RING BUFFER ?
I can try write & read index arithmetic, but perhaps there is recommended calculation ...
Thanks again!
Rafi.
Beta Was this translation helpful? Give feedback.
All reactions