segger-rtt: add SEGGER_RTT_GetAvailWriteSpace function

This commit is contained in:
Matthias Ringwald 2019-11-18 14:26:31 +01:00
parent 779af47be2
commit a20be900c9
2 changed files with 22 additions and 0 deletions

View File

@ -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 ****************************/

View File

@ -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
//