sbgECom Library
4.0.1987-stable
C library to interface SBG Systems IMU/AHRS/INS
|
Helper methods used to handle a splittable buffer. More...
#include <sbgCommon.h>
Go to the source code of this file.
Data Structures | |
struct | _SbgSplitBuffer |
Typedefs | |
typedef struct _SbgSplitBuffer | SbgSplitBuffer |
Functions | |
SBG_INLINE void | sbgSplitBufferInitForRead (SbgSplitBuffer *pSplitBuffer, const void *pBuffer, size_t bufferSize, size_t subBufferSize) |
SBG_INLINE void | sbgSplitBufferInitForWrite (SbgSplitBuffer *pSplitBuffer, void *pBuffer, size_t bufferSize, size_t subBufferSize) |
SBG_INLINE size_t | sbgSplitBufferGetSubBufferNbr (const SbgSplitBuffer *pSplitBuffer) |
SBG_INLINE void * | sbgSplitBufferGetSubBuffer (const SbgSplitBuffer *pSplitBuffer, size_t subBufferIdx) |
SBG_INLINE size_t | sbgSplitBufferGetSubBufferOffset (const SbgSplitBuffer *pSplitBuffer, size_t subBufferIdx) |
SBG_INLINE size_t | sbgSplitBufferGetSubBufferSize (const SbgSplitBuffer *pSplitBuffer, size_t subBufferIdx) |
Helper methods used to handle a splittable buffer.
The MIT license
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
typedef struct _SbgSplitBuffer SbgSplitBuffer |
Defines the ECom transfer states
SBG_INLINE void sbgSplitBufferInitForRead | ( | SbgSplitBuffer * | pSplitBuffer, |
const void * | pBuffer, | ||
size_t | bufferSize, | ||
size_t | subBufferSize | ||
) |
Initialize a split buffer for read operations.
[in] | pSplitBuffer | Pointer to an allocated split buffer instance. |
[in] | pBuffer | The buffer that needs to be split (doesn't take the ownership). |
[in] | bufferSize | The total size of the buffer in bytes. |
[in] | subBufferSize | The size of each sub buffer in bytes. |
References _SbgSplitBuffer::linkedBufferSize, _SbgSplitBuffer::pLinkedBuffer, _SbgSplitBuffer::subBufferNbr, and _SbgSplitBuffer::subBufferSize.
SBG_INLINE void sbgSplitBufferInitForWrite | ( | SbgSplitBuffer * | pSplitBuffer, |
void * | pBuffer, | ||
size_t | bufferSize, | ||
size_t | subBufferSize | ||
) |
Initialize a split buffer for write operations.
[in] | pSplitBuffer | Pointer to an allocated split buffer instance. |
[in] | pBuffer | The buffer that needs to be split (doesn't take the ownership). |
[in] | bufferSize | The total size of the buffer in bytes. |
[in] | subBufferSize | The size of each sub buffer in bytes. |
References _SbgSplitBuffer::linkedBufferSize, _SbgSplitBuffer::pLinkedBuffer, _SbgSplitBuffer::subBufferNbr, and _SbgSplitBuffer::subBufferSize.
SBG_INLINE size_t sbgSplitBufferGetSubBufferNbr | ( | const SbgSplitBuffer * | pSplitBuffer | ) |
Returns the number of sub buffers that compose the whole buffer.
[in] | pSplitBuffer | Valid pointer to a Split Buffer instance. |
References _SbgSplitBuffer::subBufferNbr.
SBG_INLINE void* sbgSplitBufferGetSubBuffer | ( | const SbgSplitBuffer * | pSplitBuffer, |
size_t | subBufferIdx | ||
) |
Get one sub buffer given its index.
[in] | pSplitBuffer | Valid pointer to a Split Buffer instance. |
[in] | subBufferIdx | Index of the sub buffer required. |
References _SbgSplitBuffer::pLinkedBuffer, and _SbgSplitBuffer::subBufferSize.
SBG_INLINE size_t sbgSplitBufferGetSubBufferOffset | ( | const SbgSplitBuffer * | pSplitBuffer, |
size_t | subBufferIdx | ||
) |
Return the offset in bytes of a sub buffer from the start of the buffer.
[in] | pSplitBuffer | Valid pointer to a Split Buffer instance. |
[in] | subBufferIdx | Index of the sub buffer required. |
References _SbgSplitBuffer::subBufferSize.
SBG_INLINE size_t sbgSplitBufferGetSubBufferSize | ( | const SbgSplitBuffer * | pSplitBuffer, |
size_t | subBufferIdx | ||
) |
Get the size of a sub buffer given its index.
[in] | pSplitBuffer | Valid pointer to a Split Buffer instance. |
[in] | subBufferIdx | Index of the sub buffer required. |
References _SbgSplitBuffer::linkedBufferSize, _SbgSplitBuffer::subBufferNbr, and _SbgSplitBuffer::subBufferSize.