Skip to content

Commit

Permalink
TRICE_DIAGNOSTICS==0 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sazerac4 committed Sep 5, 2024
1 parent 4c0717b commit a94e58a
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/trice.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,27 @@ extern const int TriceTypeS4;
extern const int TriceTypeX0;
extern unsigned RTT0_writeDepthMax;
extern unsigned TriceErrorCount;
extern unsigned TriceDynBufTruncateCount;
extern unsigned TriceDirectOverflowCount;
extern unsigned TriceDeferredOverflowCount;

extern uint32_t* const TriceRingBufferStart;
extern uint32_t* const triceRingBufferLimit;
extern unsigned TriceSingleMaxWordCount;
extern int TriceRingBufferDepthMax;
extern unsigned TriceHalfBufferDepthMax;

#if (TRICE_DIAGNOSTICS == 1)
extern int TriceDataOffsetDepthMax;
extern unsigned TriceSingleMaxWordCount;
extern unsigned TriceDynBufTruncateCount;
#if TRICE_PROTECT == 1
extern unsigned TriceDirectOverflowCount;
extern unsigned TriceDeferredOverflowCount;
#endif
#define TRICE_DYN_BUF_TRUNCATE_COUNT_INCREMENT() \
do { \
TriceDynBufTruncateCount++; \
} while (0)
#else
#define TRICE_DYN_BUF_TRUNCATE_COUNT_INCREMENT()
#endif

#if (TRICE_BUFFER == TRICE_RING_BUFFER) || (TRICE_BUFFER == TRICE_DOUBLE_BUFFER)
extern uint32_t* TriceBufferWritePosition;
Expand Down Expand Up @@ -658,7 +670,7 @@ TRICE_INLINE uint64_t aDouble(double x) {
uint32_t limit = TRICE_SINGLE_MAX_SIZE - 12; /* 12 = head(2) + max timestamp size(4) + count(2) + max 3 zeroes, we take 4 */ \
uint32_t len_ = n; /* n could be a constant */ \
if (len_ > limit) { \
TriceDynBufTruncateCount++; \
TRICE_DYN_BUF_TRUNCATE_COUNT_INCREMENT(); \
len_ = limit; \
} \
TRICE_ENTER tid; \
Expand Down

0 comments on commit a94e58a

Please sign in to comment.