Skip to main content

Functions

rpcmem_init

Initialize the RPCMEM Library. Only call this function once before using the RPCMEM Library. This API is mandatory on pre-Lahaina targets IF the client has linked to the rpcmem.a static library. If the client has only linked libadsprpc.so, libcdsprpc.so, or libsdsprpc.so, then the rpcmem_init call is not required on any target and other rpcmem APIs such as rpcmem_alloc can be called directly. NOTE: This function is not thread safe.

rpcmem_deinit

Deinitialize the RPCMEM Library. Only call this function once when the RPCMEM Library is no longer required. This API is mandatory on pre-Lahaina targets IF the client has linked to the rpcmem.a static library. If the client has only linked libadsprpc.so, libcdsprpc.so, or libsdsprpc.so, then the rpcmem_deinit call is not required on any target. NOTE: This function is not thread safe.

rpcmem_alloc

Allocate a zero-copy buffer for size upto 2 GB with the FastRPC framework. Default memory attributes, 2 KB rpcmem_alloc(RPCMEM_HEAP_ID_SYSTEM,RPCMEM_DEFAULT_FLAGS,2048); Or rpcmem_alloc_def(2048); Heap 22, uncached, 1 KB rpcmem_alloc(22,0,1024); Or rpcmem_alloc(22,RPCMEM_FLAG_UNCACHED,1024); Heap 21, cached, 2 KB rpcmem_alloc(21,RPCMEM_FLAG_CACHED,2048); Or #include<ion.h> rpcmem_alloc(21,ION_FLAG_CACHED,2048); Default memory attributes but from heap 18, 4 KB rpcmem_alloc(18,RPCMEM_DEFAULT_FLAGS,4096);
Parameters
int
Heap ID to use for memory allocation.
uint32_t
ION flags to use for memory allocation.
int
Buffer size to allocate.
Returns Pointer to the buffer on success; NULL on failure.

rpcmem_alloc2

Allocate a zero-copy buffer with the FastRPC framework. The usage examples are same as rpcmem_alloc.
Parameters
int
Heap ID to use for memory allocation.
uint32_t
ION flags to use for memory allocation.
size_t
Buffer size to allocate.
Returns Pointer to the buffer on success; NULL on failure.

__attribute__

Allocate a buffer with default settings.
Parameters
Size of the buffer to be allocated.
Returns Pointer to the allocated memory buffer.

rpcmem_free

Free a buffer and ignore invalid buffers.

rpcmem_to_fd

Return an associated file descriptor.
Parameters
void *
Data pointer for an RPCMEM-allocated buffer.
Returns Buffer file descriptor.