From a20be900c96e687639c0a9cb764edb04e3d5e483 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Mon, 18 Nov 2019 14:26:31 +0100 Subject: [PATCH] segger-rtt: add SEGGER_RTT_GetAvailWriteSpace function --- 3rd-party/segger-rtt/SEGGER_RTT.c | 17 +++++++++++++++++ 3rd-party/segger-rtt/SEGGER_RTT.h | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/3rd-party/segger-rtt/SEGGER_RTT.c b/3rd-party/segger-rtt/SEGGER_RTT.c index 779a0e7c1..75b620f67 100644 --- a/3rd-party/segger-rtt/SEGGER_RTT.c +++ b/3rd-party/segger-rtt/SEGGER_RTT.c @@ -1696,5 +1696,22 @@ int SEGGER_RTT_TerminalOut (unsigned char TerminalId, const char* s) { return Status; } +/********************************************************************* +* +* SEGGER_RTT_GetAvailWriteSpace +* Returns the number of bytes that can be written to the ring +* buffer without blocking. +* +* Parameters +* BufferIndex Index of the buffer. +* +* Return value +* Number of bytes that are free in the buffer. +*/ + +unsigned SEGGER_RTT_GetAvailWriteSpace (unsigned BufferIndex){ + return _GetAvailWriteSpace(&_SEGGER_RTT.aUp[BufferIndex]); +} + /*************************** End of file ****************************/ diff --git a/3rd-party/segger-rtt/SEGGER_RTT.h b/3rd-party/segger-rtt/SEGGER_RTT.h index 71c380861..cc1b1a4af 100644 --- a/3rd-party/segger-rtt/SEGGER_RTT.h +++ b/3rd-party/segger-rtt/SEGGER_RTT.h @@ -219,6 +219,11 @@ void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const voi unsigned SEGGER_RTT_PutChar (unsigned BufferIndex, char c); unsigned SEGGER_RTT_PutCharSkip (unsigned BufferIndex, char c); unsigned SEGGER_RTT_PutCharSkipNoLock (unsigned BufferIndex, char c); + +// BK addition +unsigned SEGGER_RTT_GetAvailWriteSpace (unsigned BufferIndex); + + // // Function macro for performance optimization //