Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
|
Byte order helpers. More...
Go to the source code of this file.
Macros | |
#define | sys_le16_to_cpu(val) (val) |
Convert 16-bit integer from little-endian to host endianness. More... | |
#define | sys_cpu_to_le16(val) (val) |
Convert 16-bit integer from host endianness to little-endian. More... | |
#define | sys_le24_to_cpu(val) (val) |
Convert 24-bit integer from little-endian to host endianness. More... | |
#define | sys_cpu_to_le24(val) (val) |
Convert 24-bit integer from host endianness to little-endian. More... | |
#define | sys_le32_to_cpu(val) (val) |
Convert 32-bit integer from little-endian to host endianness. More... | |
#define | sys_cpu_to_le32(val) (val) |
Convert 32-bit integer from host endianness to little-endian. More... | |
#define | sys_le48_to_cpu(val) (val) |
Convert 48-bit integer from little-endian to host endianness. More... | |
#define | sys_cpu_to_le48(val) (val) |
Convert 48-bit integer from host endianness to little-endian. More... | |
#define | sys_le64_to_cpu(val) (val) |
#define | sys_cpu_to_le64(val) (val) |
#define | sys_be16_to_cpu(val) __bswap_16(val) |
Convert 16-bit integer from big-endian to host endianness. More... | |
#define | sys_cpu_to_be16(val) __bswap_16(val) |
Convert 16-bit integer from host endianness to big-endian. More... | |
#define | sys_be24_to_cpu(val) __bswap_24(val) |
Convert 24-bit integer from big-endian to host endianness. More... | |
#define | sys_cpu_to_be24(val) __bswap_24(val) |
Convert 24-bit integer from host endianness to big-endian. More... | |
#define | sys_be32_to_cpu(val) __bswap_32(val) |
Convert 32-bit integer from big-endian to host endianness. More... | |
#define | sys_cpu_to_be32(val) __bswap_32(val) |
Convert 32-bit integer from host endianness to big-endian. More... | |
#define | sys_be48_to_cpu(val) __bswap_48(val) |
Convert 48-bit integer from big-endian to host endianness. More... | |
#define | sys_cpu_to_be48(val) __bswap_48(val) |
Convert 48-bit integer from host endianness to big-endian. More... | |
#define | sys_be64_to_cpu(val) __bswap_64(val) |
#define | sys_cpu_to_be64(val) __bswap_64(val) |
Functions | |
static void | sys_put_be16 (uint16_t val, uint8_t dst[2]) |
Put a 16-bit integer as big-endian to arbitrary location. More... | |
static void | sys_put_be24 (uint32_t val, uint8_t dst[3]) |
Put a 24-bit integer as big-endian to arbitrary location. More... | |
static void | sys_put_be32 (uint32_t val, uint8_t dst[4]) |
Put a 32-bit integer as big-endian to arbitrary location. More... | |
static void | sys_put_be48 (uint64_t val, uint8_t dst[6]) |
Put a 48-bit integer as big-endian to arbitrary location. More... | |
static void | sys_put_be64 (uint64_t val, uint8_t dst[8]) |
Put a 64-bit integer as big-endian to arbitrary location. More... | |
static void | sys_put_le16 (uint16_t val, uint8_t dst[2]) |
Put a 16-bit integer as little-endian to arbitrary location. More... | |
static void | sys_put_le24 (uint32_t val, uint8_t dst[3]) |
Put a 24-bit integer as little-endian to arbitrary location. More... | |
static void | sys_put_le32 (uint32_t val, uint8_t dst[4]) |
Put a 32-bit integer as little-endian to arbitrary location. More... | |
static void | sys_put_le48 (uint64_t val, uint8_t dst[6]) |
Put a 48-bit integer as little-endian to arbitrary location. More... | |
static void | sys_put_le64 (uint64_t val, uint8_t dst[8]) |
Put a 64-bit integer as little-endian to arbitrary location. More... | |
static uint16_t | sys_get_be16 (const uint8_t src[2]) |
Get a 16-bit integer stored in big-endian format. More... | |
static uint32_t | sys_get_be24 (const uint8_t src[3]) |
Get a 24-bit integer stored in big-endian format. More... | |
static uint32_t | sys_get_be32 (const uint8_t src[4]) |
Get a 32-bit integer stored in big-endian format. More... | |
static uint64_t | sys_get_be48 (const uint8_t src[6]) |
Get a 48-bit integer stored in big-endian format. More... | |
static uint64_t | sys_get_be64 (const uint8_t src[8]) |
Get a 64-bit integer stored in big-endian format. More... | |
static uint16_t | sys_get_le16 (const uint8_t src[2]) |
Get a 16-bit integer stored in little-endian format. More... | |
static uint32_t | sys_get_le24 (const uint8_t src[3]) |
Get a 24-bit integer stored in big-endian format. More... | |
static uint32_t | sys_get_le32 (const uint8_t src[4]) |
Get a 32-bit integer stored in little-endian format. More... | |
static uint64_t | sys_get_le48 (const uint8_t src[6]) |
Get a 48-bit integer stored in little-endian format. More... | |
static uint64_t | sys_get_le64 (const uint8_t src[8]) |
Get a 64-bit integer stored in little-endian format. More... | |
static void | sys_memcpy_swap (void *dst, const void *src, size_t length) |
Swap one buffer content into another. More... | |
static void | sys_mem_swap (void *buf, size_t length) |
Swap buffer content. More... | |
Byte order helpers.
#define sys_be16_to_cpu | ( | val | ) | __bswap_16(val) |
Convert 16-bit integer from big-endian to host endianness.
val | 16-bit integer in big-endian format. |
#define sys_be24_to_cpu | ( | val | ) | __bswap_24(val) |
Convert 24-bit integer from big-endian to host endianness.
val | 24-bit integer in big-endian format. |
#define sys_be32_to_cpu | ( | val | ) | __bswap_32(val) |
Convert 32-bit integer from big-endian to host endianness.
val | 32-bit integer in big-endian format. |
#define sys_be48_to_cpu | ( | val | ) | __bswap_48(val) |
Convert 48-bit integer from big-endian to host endianness.
val | 48-bit integer in big-endian format. |
#define sys_be64_to_cpu | ( | val | ) | __bswap_64(val) |
#define sys_cpu_to_be16 | ( | val | ) | __bswap_16(val) |
Convert 16-bit integer from host endianness to big-endian.
val | 16-bit integer in host endianness. |
#define sys_cpu_to_be24 | ( | val | ) | __bswap_24(val) |
Convert 24-bit integer from host endianness to big-endian.
val | 24-bit integer in host endianness. |
#define sys_cpu_to_be32 | ( | val | ) | __bswap_32(val) |
Convert 32-bit integer from host endianness to big-endian.
val | 32-bit integer in host endianness. |
#define sys_cpu_to_be48 | ( | val | ) | __bswap_48(val) |
Convert 48-bit integer from host endianness to big-endian.
val | 48-bit integer in host endianness. |
#define sys_cpu_to_be64 | ( | val | ) | __bswap_64(val) |
#define sys_cpu_to_le16 | ( | val | ) | (val) |
Convert 16-bit integer from host endianness to little-endian.
val | 16-bit integer in host endianness. |
#define sys_cpu_to_le24 | ( | val | ) | (val) |
Convert 24-bit integer from host endianness to little-endian.
val | 24-bit integer in host endianness. |
#define sys_cpu_to_le32 | ( | val | ) | (val) |
Convert 32-bit integer from host endianness to little-endian.
val | 32-bit integer in host endianness. |
#define sys_cpu_to_le48 | ( | val | ) | (val) |
Convert 48-bit integer from host endianness to little-endian.
val | 48-bit integer in host endianness. |
#define sys_cpu_to_le64 | ( | val | ) | (val) |
#define sys_le16_to_cpu | ( | val | ) | (val) |
Convert 16-bit integer from little-endian to host endianness.
val | 16-bit integer in little-endian format. |
#define sys_le24_to_cpu | ( | val | ) | (val) |
Convert 24-bit integer from little-endian to host endianness.
val | 24-bit integer in little-endian format. |
#define sys_le32_to_cpu | ( | val | ) | (val) |
Convert 32-bit integer from little-endian to host endianness.
val | 32-bit integer in little-endian format. |
#define sys_le48_to_cpu | ( | val | ) | (val) |
Convert 48-bit integer from little-endian to host endianness.
val | 48-bit integer in little-endian format. |
#define sys_le64_to_cpu | ( | val | ) | (val) |
Get a 16-bit integer stored in big-endian format.
Get a 16-bit integer, stored in big-endian format in a potentially unaligned memory location, and convert it to the host endianness.
src | Location of the big-endian 16-bit integer to get. |
Get a 24-bit integer stored in big-endian format.
Get a 24-bit integer, stored in big-endian format in a potentially unaligned memory location, and convert it to the host endianness.
src | Location of the big-endian 24-bit integer to get. |
Get a 32-bit integer stored in big-endian format.
Get a 32-bit integer, stored in big-endian format in a potentially unaligned memory location, and convert it to the host endianness.
src | Location of the big-endian 32-bit integer to get. |
Get a 48-bit integer stored in big-endian format.
Get a 48-bit integer, stored in big-endian format in a potentially unaligned memory location, and convert it to the host endianness.
src | Location of the big-endian 48-bit integer to get. |
Get a 64-bit integer stored in big-endian format.
Get a 64-bit integer, stored in big-endian format in a potentially unaligned memory location, and convert it to the host endianness.
src | Location of the big-endian 64-bit integer to get. |
Get a 16-bit integer stored in little-endian format.
Get a 16-bit integer, stored in little-endian format in a potentially unaligned memory location, and convert it to the host endianness.
src | Location of the little-endian 16-bit integer to get. |
Get a 24-bit integer stored in big-endian format.
Get a 24-bit integer, stored in big-endian format in a potentially unaligned memory location, and convert it to the host endianness.
src | Location of the big-endian 24-bit integer to get. |
Get a 32-bit integer stored in little-endian format.
Get a 32-bit integer, stored in little-endian format in a potentially unaligned memory location, and convert it to the host endianness.
src | Location of the little-endian 32-bit integer to get. |
Get a 48-bit integer stored in little-endian format.
Get a 48-bit integer, stored in little-endian format in a potentially unaligned memory location, and convert it to the host endianness.
src | Location of the little-endian 48-bit integer to get. |
Get a 64-bit integer stored in little-endian format.
Get a 64-bit integer, stored in little-endian format in a potentially unaligned memory location, and convert it to the host endianness.
src | Location of the little-endian 64-bit integer to get. |
Swap buffer content.
In-place memory swap, where final content will be reversed. I.e.: buf[n] will be put in buf[end-n] Where n is an index and 'end' the last index of buf.
buf | A valid pointer on a memory area to swap |
length | Size of buf memory area |
Swap one buffer content into another.
Copy the content of src buffer into dst buffer in reversed order, i.e.: src[n] will be put in dst[end-n] Where n is an index and 'end' the last index in both arrays. The 2 memory pointers must be pointing to different areas, and have a minimum size of given length.
dst | A valid pointer on a memory area where to copy the data in |
src | A valid pointer on a memory area where to copy the data from |
length | Size of both dst and src memory areas |
Put a 16-bit integer as big-endian to arbitrary location.
Put a 16-bit integer, originally in host endianness, to a potentially unaligned memory location in big-endian format.
val | 16-bit integer in host endianness. |
dst | Destination memory address to store the result. |
Put a 24-bit integer as big-endian to arbitrary location.
Put a 24-bit integer, originally in host endianness, to a potentially unaligned memory location in big-endian format.
val | 24-bit integer in host endianness. |
dst | Destination memory address to store the result. |
Put a 32-bit integer as big-endian to arbitrary location.
Put a 32-bit integer, originally in host endianness, to a potentially unaligned memory location in big-endian format.
val | 32-bit integer in host endianness. |
dst | Destination memory address to store the result. |
Put a 48-bit integer as big-endian to arbitrary location.
Put a 48-bit integer, originally in host endianness, to a potentially unaligned memory location in big-endian format.
val | 48-bit integer in host endianness. |
dst | Destination memory address to store the result. |
Put a 64-bit integer as big-endian to arbitrary location.
Put a 64-bit integer, originally in host endianness, to a potentially unaligned memory location in big-endian format.
val | 64-bit integer in host endianness. |
dst | Destination memory address to store the result. |
Put a 16-bit integer as little-endian to arbitrary location.
Put a 16-bit integer, originally in host endianness, to a potentially unaligned memory location in little-endian format.
val | 16-bit integer in host endianness. |
dst | Destination memory address to store the result. |
Put a 24-bit integer as little-endian to arbitrary location.
Put a 24-bit integer, originally in host endianness, to a potentially unaligned memory location in littel-endian format.
val | 24-bit integer in host endianness. |
dst | Destination memory address to store the result. |
Put a 32-bit integer as little-endian to arbitrary location.
Put a 32-bit integer, originally in host endianness, to a potentially unaligned memory location in little-endian format.
val | 32-bit integer in host endianness. |
dst | Destination memory address to store the result. |
Put a 48-bit integer as little-endian to arbitrary location.
Put a 48-bit integer, originally in host endianness, to a potentially unaligned memory location in little-endian format.
val | 48-bit integer in host endianness. |
dst | Destination memory address to store the result. |
Put a 64-bit integer as little-endian to arbitrary location.
Put a 64-bit integer, originally in host endianness, to a potentially unaligned memory location in little-endian format.
val | 64-bit integer in host endianness. |
dst | Destination memory address to store the result. |