Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
Deserialisation and Endian conversion

Helper functions to convert between big/little endian byte arrays and system types. More...

Collaboration diagram for Deserialisation and Endian conversion:

Macros

#define CA821X_API_INCLUDE_CA821X_ENDIAN_H_
 

Functions

STATIC uint8_t LS_BYTE (uint16_t x)
 Extract the least significant octet of a 16-bit value. More...
 
STATIC uint8_t MS_BYTE (uint16_t x)
 Extract the most significant octet of a 16-bit value. More...
 
STATIC uint8_t LS0_BYTE (uint16_t x)
 Extract the first (little-endian) octet of a 32-bit value. More...
 
STATIC uint8_t LS1_BYTE (uint32_t x)
 Extract the second (little-endian) octet of a 32-bit value. More...
 
STATIC uint8_t LS2_BYTE (uint32_t x)
 Extract the third (little-endian) octet of a 32-bit value. More...
 
STATIC uint8_t LS3_BYTE (uint32_t x)
 Extract the fourth (little-endian) octet of a 32-bit value. More...
 
STATIC uint16_t GETLE16 (const uint8_t *in)
 Extract a 16-bit value from a little-endian octet array. More...
 
STATIC uint32_t GETLE32 (const uint8_t *in)
 Extract a 32-bit value from a little-endian octet array. More...
 
STATIC uint64_t GETLE64 (const uint8_t *in)
 Extract a 64-bit value from a little-endian octet array. More...
 
STATIC void PUTLE16 (uint16_t in, uint8_t *out)
 Put a 16-bit value into a little-endian octet array. More...
 
STATIC void PUTLE32 (uint32_t in, uint8_t *out)
 Put a 32-bit value into a little-endian octet array. More...
 
STATIC void PUTLE64 (uint64_t in, uint8_t *out)
 Put a 64-bit value into a little-endian octet array. More...
 
STATIC uint16_t GETBE16 (const uint8_t *in)
 Extract a 16-bit value from a big-endian octet array. More...
 
STATIC void PUTBE16 (uint16_t in, uint8_t *out)
 Put a 16-bit value into a big-endian octet array. More...
 
STATIC uint32_t GETBE32 (const uint8_t *in)
 Extract a 32-bit value from a big-endian octet array. More...
 
STATIC uint64_t GETBE64 (const uint8_t *in)
 Extract a 64-bit value from a big-endian octet array. More...
 
STATIC void PUTBE32 (uint32_t in, uint8_t *out)
 Put a 32-bit value into a big-endian octet array. More...
 
STATIC void PUTBE64 (uint64_t in, uint8_t *out)
 Put a 64-bit value into a little-endian octet array. More...
 

Detailed Description

Helper functions to convert between big/little endian byte arrays and system types.

Macro Definition Documentation

◆ CA821X_API_INCLUDE_CA821X_ENDIAN_H_

#define CA821X_API_INCLUDE_CA821X_ENDIAN_H_

Function Documentation

◆ GETBE16()

STATIC uint16_t GETBE16 ( const uint8_t *  in)
inline

Extract a 16-bit value from a big-endian octet array.

◆ GETBE32()

STATIC uint32_t GETBE32 ( const uint8_t *  in)
inline

Extract a 32-bit value from a big-endian octet array.

◆ GETBE64()

STATIC uint64_t GETBE64 ( const uint8_t *  in)
inline

Extract a 64-bit value from a big-endian octet array.

◆ GETLE16()

STATIC uint16_t GETLE16 ( const uint8_t *  in)
inline

Extract a 16-bit value from a little-endian octet array.

◆ GETLE32()

STATIC uint32_t GETLE32 ( const uint8_t *  in)
inline

Extract a 32-bit value from a little-endian octet array.

◆ GETLE64()

STATIC uint64_t GETLE64 ( const uint8_t *  in)
inline

Extract a 64-bit value from a little-endian octet array.

◆ LS0_BYTE()

STATIC uint8_t LS0_BYTE ( uint16_t  x)
inline

Extract the first (little-endian) octet of a 32-bit value.

◆ LS1_BYTE()

STATIC uint8_t LS1_BYTE ( uint32_t  x)
inline

Extract the second (little-endian) octet of a 32-bit value.

◆ LS2_BYTE()

STATIC uint8_t LS2_BYTE ( uint32_t  x)
inline

Extract the third (little-endian) octet of a 32-bit value.

◆ LS3_BYTE()

STATIC uint8_t LS3_BYTE ( uint32_t  x)
inline

Extract the fourth (little-endian) octet of a 32-bit value.

◆ LS_BYTE()

STATIC uint8_t LS_BYTE ( uint16_t  x)
inline

Extract the least significant octet of a 16-bit value.

◆ MS_BYTE()

STATIC uint8_t MS_BYTE ( uint16_t  x)
inline

Extract the most significant octet of a 16-bit value.

◆ PUTBE16()

STATIC void PUTBE16 ( uint16_t  in,
uint8_t *  out 
)
inline

Put a 16-bit value into a big-endian octet array.

◆ PUTBE32()

STATIC void PUTBE32 ( uint32_t  in,
uint8_t *  out 
)
inline

Put a 32-bit value into a big-endian octet array.

◆ PUTBE64()

STATIC void PUTBE64 ( uint64_t  in,
uint8_t *  out 
)
inline

Put a 64-bit value into a little-endian octet array.

◆ PUTLE16()

STATIC void PUTLE16 ( uint16_t  in,
uint8_t *  out 
)
inline

Put a 16-bit value into a little-endian octet array.

◆ PUTLE32()

STATIC void PUTLE32 ( uint32_t  in,
uint8_t *  out 
)
inline

Put a 32-bit value into a little-endian octet array.

◆ PUTLE64()

STATIC void PUTLE64 ( uint64_t  in,
uint8_t *  out 
)
inline

Put a 64-bit value into a little-endian octet array.