posix: Fix name collision with __bswap

__bswap_ in zephyr/sys/byteorder.h conflicts with __bswap_ in host's
byteswap.h. byteswap.h from host compiler used in posix_native_64 boards
causes a compilation issue.

This commit renames __bswap_ to BSWAP_ to prevent collision.

Before this commit a compilation error can be created by adding #include
<byteswap.h> to samples/net/sockets/echo/src/socket_echo.c

This does not change external API to byteorder.h, but does change
internal implementation which some other source files depend on.

Replaced manual byteswap operations in devmem_service.c with APIs from
byteorder.h which automatically converts to CPU endianess when necessary.

Fixes #44324

Signed-off-by: Jonathan Hamberg <jonathanhamberg@gmail.com>
This commit is contained in:
Jonathan Hamberg 2024-01-04 10:36:24 -08:00 committed by Fabio Baltieri
commit 9c1a45cc00
7 changed files with 39 additions and 49 deletions

View file

@ -17,9 +17,9 @@
LOG_MODULE_REGISTER(gt911, CONFIG_INPUT_LOG_LEVEL);
/* GT911 used registers */
#define DEVICE_ID __bswap_16(0x8140U)
#define REG_STATUS __bswap_16(0x814EU)
#define REG_FIRST_POINT __bswap_16(0x814FU)
#define DEVICE_ID BSWAP_16(0x8140U)
#define REG_STATUS BSWAP_16(0x814EU)
#define REG_FIRST_POINT BSWAP_16(0x814FU)
/* REG_TD_STATUS: Touch points. */
#define TOUCH_POINTS_MSK 0x0FU
@ -28,7 +28,7 @@ LOG_MODULE_REGISTER(gt911, CONFIG_INPUT_LOG_LEVEL);
#define TOUCH_STATUS_MSK (1 << 7U)
/* The GT911's config */
#define GT911_CONFIG_REG __bswap_16(0x8047U)
#define GT911_CONFIG_REG BSWAP_16(0x8047U)
#define REG_CONFIG_VERSION GT911_CONFIG_REG
#define REG_CONFIG_SIZE (186U)
#define GT911_PRODUCT_ID (0x00313139U)