QRSS Rx Network receiver. A receiver to sample a segment of RF spectrum and send this data to a server for further processing and display. NXP mbed Design Challenge entry (Honorable Mention). Published in Circuit Cellar, Feb 2012
Dependencies: NetServices mbed DNSResolver
Diff: BufferSys.cpp
- Revision:
- 0:82ff15078322
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BufferSys.cpp Wed Jan 25 20:32:53 2012 +0000 @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------- + + QRSS Receiver Application + + by Clayton ZL3TKA/VK1TKA + clayton@isnotcrazy.com + + Buffer System + +---------------------------------------------------------------------------*/ +// include files + +#include "BufferSys.h" + +// Definitions + +// Macros + +// Local Data + +// Global Data +const TDataSample NullSample = {0,0}; + +// Function Prototypes + +//--------------------------------------------------------------------------- +// BUFFER SYSTEM METHODS +//--------------------------------------------------------------------------- + +//--------------------------------------------------------------------------- +// +// Buffer Release Method +// +void TBufferHandle::Release( void ) +{ + if ( !HasBuffer() ) + return; + // If the handler was the only reference to the buffer + // then the buffer should be released to the pool + if ( pMyBuffer->iRefCount<=0 ) + error( "TBufferHandle::CheckForBuffer Invalid TBufferData iRefCount in Release - %d\r\n", pMyBuffer->iRefCount ); + pMyBuffer->iRefCount--; + if ( pMyBuffer->iRefCount==0 ) + { // Release message to the pool it came from + pMyBuffer->pPool->ReturnToPool( pMyBuffer ); + } + // Detach the message from the handler + pMyBuffer = NULL; +} + +//--------------------------------------------------------------------------- +// END +//---------------------------------------------------------------------------