sbgECom Library  4.0.1987-stable
C library to interface SBG Systems IMU/AHRS/INS
sbgCrc.h File Reference

This file provides CRC-32 and CRC-16 methods. More...

#include <sbgCommon.h>

Go to the source code of this file.

Typedefs

typedef uint32_t SbgCrc32
 

Functions

SBG_COMMON_LIB_API void sbgCrc32Initialize (SbgCrc32 *pInstance)
 
SBG_COMMON_LIB_API void sbgCrc32Update (SbgCrc32 *pInstance, const void *pData, size_t dataSize)
 
SBG_INLINE uint32_t sbgCrc32Get (const SbgCrc32 *pInstance)
 
SBG_COMMON_LIB_API uint32_t sbgCrc32Compute (const void *pData, size_t dataSize)
 
SBG_COMMON_LIB_API void sbgCrc16Initialize (SbgCrc16 *pInstance)
 
SBG_COMMON_LIB_API void sbgCrc16Update (SbgCrc16 *pInstance, const void *pData, size_t dataSize)
 
SBG_INLINE uint16_t sbgCrc16Get (const SbgCrc16 *pInstance)
 
SBG_COMMON_LIB_API uint16_t sbgCrc16Compute (const void *pData, size_t dataSize)
 

Detailed Description

This file provides CRC-32 and CRC-16 methods.

Author
SBG Systems
Date
15 January 2013
License

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 Documentation

◆ SbgCrc32

typedef uint32_t SbgCrc32

< Type used to compute a 32 bit Ethernet CRC. Type used to compute a 16 bit CRC.

Function Documentation

◆ sbgCrc32Initialize()

SBG_COMMON_LIB_API void sbgCrc32Initialize ( SbgCrc32 pInstance)

Initialize the 32 bit CRC computation system.

Parameters
[in]pInstancePointer on an allocated but non initialized Crc32 object.

◆ sbgCrc32Update()

SBG_COMMON_LIB_API void sbgCrc32Update ( SbgCrc32 pInstance,
const void *  pData,
size_t  dataSize 
)

Compute a 32 bit CRC using an Ethernet polynome. Warning: the buffer size should be at least 4 bytes long.

Parameters
[in]pInstanceRead only pointer on a valid Crc32 object.
[in]pDataRead only pointer on the data buffer to compute CRC on.
[in]dataSizeData size in bytes of the buffer, has to be greater or equals to 4.

◆ sbgCrc32Get()

SBG_INLINE uint32_t sbgCrc32Get ( const SbgCrc32 pInstance)

Returns the computed 32 bit CRC value.

Parameters
[in]pInstanceRead only pointer on a valid Crc32 object.
Returns
The computed CRC.

◆ sbgCrc32Compute()

SBG_COMMON_LIB_API uint32_t sbgCrc32Compute ( const void *  pData,
size_t  dataSize 
)

Compute a 32 Bit CRC using an Ethernet polynome. Warning: the buffer size should be at least 4 bytes long.

Parameters
[in]pDataRead only pointer on the data buffer to compute CRC on.
[in]dataSizeData size in bytes of the buffer, has to be greater or equals to 4.
Returns
The computed CRC.

◆ sbgCrc16Initialize()

SBG_COMMON_LIB_API void sbgCrc16Initialize ( SbgCrc16 *  pInstance)

Initialize the 16 bit CRC computation system.

Parameters
[in]pInstancePointer on an allocated but non initialized Crc16 object.

◆ sbgCrc16Update()

SBG_COMMON_LIB_API void sbgCrc16Update ( SbgCrc16 *  pInstance,
const void *  pData,
size_t  dataSize 
)

Compute a 16 bit CRC using an the polynome 0x8408.

Parameters
[in]pInstanceRead only pointer on a valid Crc16 object.
[in]pDataRead only pointer on the data buffer to compute CRC on.
[in]dataSizeData size in bytes of the buffer.

◆ sbgCrc16Get()

SBG_INLINE uint16_t sbgCrc16Get ( const SbgCrc16 *  pInstance)

Returns the computed 32 bit CRC value.

Parameters
[in]pInstanceRead only pointer on a valid Crc16 object.
Returns
The computed CRC.

◆ sbgCrc16Compute()

SBG_COMMON_LIB_API uint16_t sbgCrc16Compute ( const void *  pData,
size_t  dataSize 
)

Compute a 32 Bit CRC using an the polynome 0x8408.

Parameters
[in]pDataRead only pointer on the data buffer to compute CRC on.
[in]dataSizeData size in bytes of the buffer.
Returns
The computed CRC.