See Network to Host Byte Order Conversion for detailed documentation.
License#
Copyright 2018 Silicon Laboratories Inc. www.silabs.com
The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.
/***************************************************************************/
#ifndef __ENDIAN_H__
#define __ENDIAN_H__
#include <stdint.h>
// If this is being compiled on a Mac then we need to disable the defines
// from its own internal _endian.h file since they conflict with our
// defines. This allows us to compile the 3xx tools for Mac.
#ifdef __APPLE__
#undef NTOHL
#undef NTOHS
#undef HTONL
#undef HTONS
#endif
#if BIGENDIAN_CPU == false
#ifndef NTOHS // some platforms already define this
uint16_t NTOHS(uint16_t val);
#endif
#ifndef NTOHL // some platforms already define this
uint32_t NTOHL(uint32_t val);
#endif
#else // BIGENDIAN_CPU == true
#ifndef NTOHS // some platforms already define this
#define NTOHS(val) (val)
#endif
#ifndef NTOHL // some platforms already define this
#define NTOHL(val) (val)
#endif
#endif
// The HTON and NTOH operations are the same for sane architectures (eg. big
// and little endian) so define the inverse functions if they don't exist
#ifndef HTONL
#define HTONL NTOHL
#endif
#ifndef HTONS
#define HTONS NTOHS
#endif
/* Swap byte order, e.g. LE to BE or BE to LE.
* This function is used when working with 802.15.4 frames on 8051 MCUs. */
uint32_t SwapEndiannessInt32u(uint32_t val);
#endif //__ENDIAN_H__
Functions#
Converts a short (16-bit) value from network to host byte order.
Converts a long (32-bit) value from network to host byte order.
Macro Definition Documentation#
HTONL#
#define HTONLValue:
NTOHL
71
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/platform/base/hal/micro/endian.h
HTONS#
#define HTONSValue:
NTOHS
74
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/platform/base/hal/micro/endian.h
Function Documentation#
NTOHS#
uint16_t NTOHS (uint16_t val)
Converts a short (16-bit) value from network to host byte order.
N/A | val |
45
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/platform/base/hal/micro/endian.h
NTOHL#
uint32_t NTOHL (uint32_t val)
Converts a long (32-bit) value from network to host byte order.
N/A | val |
53
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/platform/base/hal/micro/endian.h
SwapEndiannessInt32u#
uint32_t SwapEndiannessInt32u (uint32_t val)
N/A | val |
79
of file /mnt/raid/workspaces/ws.2dqDELv9z/overlay/gsdk/platform/base/hal/micro/endian.h