License#
Copyright 2018 Silicon Laboratories Inc. www.silabs.com
SPDX-License-Identifier: Zlib
The licensor of this software is Silicon Laboratories Inc.
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
This notice may not be removed or altered from any source distribution.
/***************************************************************************/
#define EMBER_NULL_BUFFER 0x0000u
//void emberMarkApplicationBuffersHandler(void);
EmberBuffer emberAllocateBuffer(uint16_t dataSizeInBytes);
void emberMarkBuffer(EmberBuffer *buffer);
uint8_t *emberGetBufferPointer(EmberBuffer buffer);
uint16_t emberGetBufferLength(EmberBuffer buffer);
uint16_t emberGetAvailableBufferMemory(void);
APIs#
This handler is invoked by the memory buffers system garbage collector and allows the application to properly mark the application-defined EmberBuffer variables with emberMarkBuffer().Implement associated callback emberAfMarkApplicationBuffersCallback() to use. See Handlers for additional information.
Dynamically allocates memory.
Prevent the garbage collector from reclaiming the memory associated with the passed EmberBuffer. The application should call this API within the ::emberMarkApplicationBuffersHandler() stack handler for each EmberBuffer object.
Return a pointer to the memory segment corresponding to the passed EmberBuffer buffer. Notice that the garbage collector can move memory segments to defragment the available memory. As result, the application should always use this API to obtain an updated pointer prior to accessing the memory.
Return the length in bytes of the passed EmberBuffer buffer.
Return the available memory at the buffer manager in bytes.
Macros#
A special EmberBuffer ID indicating that no memory is currently allocated.
APIs Documentation#
emberAllocateBuffer#
EmberBuffer emberAllocateBuffer (uint16_t dataSizeInBytes)
Dynamically allocates memory.
[in] | dataSizeInBytes | The size in bytes of the memory to be allocated. |
Returns
An EmberBuffer value of EMBER_NULL_BUFFER if the memory management system could not allocate the requested memory, or any other EmberBuffer value indicating that the requested memory was successfully allocated. The allocated memory can easily be freed by assigning an EmberBuffer variable to EMBER_NULL_BUFFER. The memory will be freed by the garbage collector during the next emberTick() call.
92
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/stack/include/memory-buffer.h
emberMarkBuffer#
void emberMarkBuffer (EmberBuffer * buffer)
Prevent the garbage collector from reclaiming the memory associated with the passed EmberBuffer. The application should call this API within the ::emberMarkApplicationBuffersHandler() stack handler for each EmberBuffer object.
[in] | buffer | A pointer to the EmberBuffer buffer to be marked. |
101
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/stack/include/memory-buffer.h
emberGetBufferPointer#
uint8_t * emberGetBufferPointer (EmberBuffer buffer)
Return a pointer to the memory segment corresponding to the passed EmberBuffer buffer. Notice that the garbage collector can move memory segments to defragment the available memory. As result, the application should always use this API to obtain an updated pointer prior to accessing the memory.
[in] | buffer | A pointer to the EmberBuffer buffer for which the corresponding memory pointer should be returned. |
Returns
A NULL pointer if the passed EmberBuffer value is EMBER_NULL_BUFFER. Otherwise, a pointer to the corresponding memory segment.
116
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/stack/include/memory-buffer.h
emberGetBufferLength#
uint16_t emberGetBufferLength (EmberBuffer buffer)
Return the length in bytes of the passed EmberBuffer buffer.
[in] | buffer | A pointer to the EmberBuffer buffer for which the corresponding length in bytes should be returned. |
Returns
The length in bytes of a memory segment corresponding to the passed EmberBuffer buffer.
127
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/stack/include/memory-buffer.h
emberGetAvailableBufferMemory#
uint16_t emberGetAvailableBufferMemory (void )
Return the available memory at the buffer manager in bytes.
N/A |
Returns
The number of available bytes.
134
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/stack/include/memory-buffer.h
Macro Definition Documentation#
EMBER_NULL_BUFFER#
#define EMBER_NULL_BUFFERValue:
0x0000u
A special EmberBuffer ID indicating that no memory is currently allocated.
50
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/protocol/flex/stack/include/memory-buffer.h