Skip to content

Commit 505926c

Browse files
committed
IDF master 58022f859
1 parent c5a1f3e commit 505926c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+199
-53
lines changed

platform.txt

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

tools/platformio-build-esp32.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "espcoredump", "include", "port", "xtensa"),
177177
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "wpa_supplicant", "include"),
178178
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "wpa_supplicant", "port", "include"),
179-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "wpa_supplicant", "include", "esp_supplicant"),
179+
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "wpa_supplicant", "esp_supplicant", "include"),
180180
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "ieee802154", "include"),
181181
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "asio", "asio", "asio", "include"),
182182
join(FRAMEWORK_DIR, "tools", "sdk", "esp32", "include", "asio", "port", "include"),
@@ -295,7 +295,7 @@
295295
"UNITY_INCLUDE_CONFIG_H",
296296
"WITH_POSIX",
297297
"_GNU_SOURCE",
298-
("IDF_VER", '\\"v4.4-dev-2313-gc69f0ec32\\"'),
298+
("IDF_VER", '\\"v4.4-dev-2359-g58022f859\\"'),
299299
"ESP_PLATFORM",
300300
"ARDUINO_ARCH_ESP32",
301301
"ESP32",

tools/platformio-build-esp32c3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@
202202
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "espcoredump", "include", "port", "riscv"),
203203
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "wpa_supplicant", "include"),
204204
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "wpa_supplicant", "port", "include"),
205-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "wpa_supplicant", "include", "esp_supplicant"),
205+
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "wpa_supplicant", "esp_supplicant", "include"),
206206
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "ieee802154", "include"),
207207
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "asio", "asio", "asio", "include"),
208208
join(FRAMEWORK_DIR, "tools", "sdk", "esp32c3", "include", "asio", "port", "include"),
@@ -281,7 +281,7 @@
281281
"UNITY_INCLUDE_CONFIG_H",
282282
"WITH_POSIX",
283283
"_GNU_SOURCE",
284-
("IDF_VER", '\\"v4.4-dev-2313-gc69f0ec32\\"'),
284+
("IDF_VER", '\\"v4.4-dev-2359-g58022f859\\"'),
285285
"ESP_PLATFORM",
286286
"ARDUINO_ARCH_ESP32",
287287
"ESP32",

tools/platformio-build-esp32s2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "espcoredump", "include", "port", "xtensa"),
172172
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wpa_supplicant", "include"),
173173
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wpa_supplicant", "port", "include"),
174-
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wpa_supplicant", "include", "esp_supplicant"),
174+
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "wpa_supplicant", "esp_supplicant", "include"),
175175
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "ieee802154", "include"),
176176
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "asio", "asio", "asio", "include"),
177177
join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "include", "asio", "port", "include"),
@@ -281,7 +281,7 @@
281281
"UNITY_INCLUDE_CONFIG_H",
282282
"WITH_POSIX",
283283
"_GNU_SOURCE",
284-
("IDF_VER", '\\"v4.4-dev-2313-gc69f0ec32\\"'),
284+
("IDF_VER", '\\"v4.4-dev-2359-g58022f859\\"'),
285285
"ESP_PLATFORM",
286286
"ARDUINO_ARCH_ESP32",
287287
"ESP32",

tools/sdk/esp32/include/config/sdkconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,5 +690,5 @@
690690
#define CONFIG_ULP_COPROC_ENABLED CONFIG_ESP32_ULP_COPROC_ENABLED
691691
#define CONFIG_ULP_COPROC_RESERVE_MEM CONFIG_ESP32_ULP_COPROC_RESERVE_MEM
692692
#define CONFIG_WARN_WRITE_STRINGS CONFIG_COMPILER_WARN_WRITE_STRINGS
693-
#define CONFIG_ARDUINO_IDF_COMMIT "c69f0ec32"
693+
#define CONFIG_ARDUINO_IDF_COMMIT "58022f859"
694694
#define CONFIG_ARDUINO_IDF_BRANCH "master"

tools/sdk/esp32/include/esp32-camera/driver/include/esp_camera.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ typedef enum {
8383
CAMERA_GRAB_LATEST /*!< Except when 1 frame buffer is used, queue will always contain the last 'fb_count' frames */
8484
} camera_grab_mode_t;
8585

86+
/**
87+
* @brief Camera frame buffer location
88+
*/
89+
typedef enum {
90+
CAMERA_FB_IN_PSRAM, /*!< Frame buffer is placed in external PSRAM */
91+
CAMERA_FB_IN_DRAM /*!< Frame buffer is placed in internal DRAM */
92+
} camera_fb_location_t;
93+
8694
/**
8795
* @brief Configuration structure for camera initialization
8896
*/
@@ -114,6 +122,7 @@ typedef struct {
114122

115123
int jpeg_quality; /*!< Quality of JPEG output. 0-63 lower means higher quality */
116124
size_t fb_count; /*!< Number of frame buffers to be allocated. If more than one, then each frame will be acquired (double speed) */
125+
camera_fb_location_t fb_location; /*!< The location where the frame buffer will be allocated */
117126
camera_grab_mode_t grab_mode; /*!< When buffers should be filled */
118127
} camera_config_t;
119128

tools/sdk/esp32/include/idf_test/include/idf_performance.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@
5050
#define IDF_PERFORMANCE_MIN_UDP_TX_THROUGHPUT 50
5151
#endif
5252

53+
// throughput performance by ethernet iperf
54+
#ifndef IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT
55+
#define IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT 20
56+
#endif
57+
#ifndef IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT
58+
#define IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT 30
59+
#endif
60+
#ifndef IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT
61+
#define IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT 50
62+
#endif
63+
#ifndef IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT
64+
#define IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT 70
65+
#endif
66+
5367
// events dispatched per second by event loop library
5468
#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH
5569
#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH 25000

tools/sdk/esp32/ld/sections.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ SECTIONS
587587
_bss_start = ABSOLUTE(.);
588588

589589
*(.bss .bss.*)
590-
*(.dynbss .dynsbss .gnu.linkonce.b .gnu.linkonce.b.* .gnu.linkonce.sb .gnu.linkonce.sb.* .gnu.linkonce.sb2 .gnu.linkonce.sb2.* .sbss .sbss.* .sbss2 .sbss2.* .scommon .share.mem)
591590
*(.ext_ram.bss .ext_ram.bss.*)
591+
*(.dynbss .dynsbss .gnu.linkonce.b .gnu.linkonce.b.* .gnu.linkonce.sb .gnu.linkonce.sb.* .gnu.linkonce.sb2 .gnu.linkonce.sb2.* .sbss .sbss.* .sbss2 .sbss2.* .scommon .share.mem)
592592
*(COMMON)
593593
_bt_bss_start = ABSOLUTE(.);
594594
*libbt.a:(.bss .bss.* COMMON)

tools/sdk/esp32/lib/libapp_update.a

0 Bytes
Binary file not shown.

tools/sdk/esp32/lib/libesp32-camera.a

1.52 KB
Binary file not shown.

tools/sdk/esp32/lib/libesp_lcd.a

-15.2 KB
Binary file not shown.

tools/sdk/esp32/lib/libesp_system.a

0 Bytes
Binary file not shown.

tools/sdk/esp32/lib/libesp_wifi.a

0 Bytes
Binary file not shown.

tools/sdk/esp32/lib/libspi_flash.a

724 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

tools/sdk/esp32/sdkconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,11 +1421,6 @@ CONFIG_WS_BUFFER_SIZE=1024
14211421
# end of Websocket
14221422
# end of TCP Transport
14231423

1424-
#
1425-
# TinyUSB
1426-
#
1427-
# end of TinyUSB
1428-
14291424
#
14301425
# Unity unit testing library
14311426
#
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

tools/sdk/esp32c3/include/config/sdkconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,5 +624,5 @@
624624
#define CONFIG_TIMER_TASK_STACK_SIZE CONFIG_ESP_TIMER_TASK_STACK_SIZE
625625
#define CONFIG_TOOLPREFIX CONFIG_SDK_TOOLPREFIX
626626
#define CONFIG_UDP_RECVMBOX_SIZE CONFIG_LWIP_UDP_RECVMBOX_SIZE
627-
#define CONFIG_ARDUINO_IDF_COMMIT "c69f0ec32"
627+
#define CONFIG_ARDUINO_IDF_COMMIT "58022f859"
628628
#define CONFIG_ARDUINO_IDF_BRANCH "master"

tools/sdk/esp32c3/include/esp_rom/esp32c3/esp_rom_caps.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
#define ESP_ROM_UART_CLK_IS_XTAL (1) // UART clock source is selected to XTAL in ROM
2121
#define ESP_ROM_USB_SERIAL_DEVICE_NUM (3) // UART uses USB_SERIAL_JTAG port in ROM.
2222
#define ESP_ROM_HAS_RETARGETABLE_LOCKING (1) // ROM was built with retargetable locking
23+
#define ESP_ROM_HAS_ERASE_0_REGION_BUG (1) // ROM has esp_flash_erase_region(size=0) bug

tools/sdk/esp32c3/include/idf_test/include/idf_performance.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@
5050
#define IDF_PERFORMANCE_MIN_UDP_TX_THROUGHPUT 50
5151
#endif
5252

53+
// throughput performance by ethernet iperf
54+
#ifndef IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT
55+
#define IDF_PERFORMANCE_MIN_TCP_RX_ETH_THROUGHPUT 20
56+
#endif
57+
#ifndef IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT
58+
#define IDF_PERFORMANCE_MIN_TCP_TX_ETH_THROUGHPUT 30
59+
#endif
60+
#ifndef IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT
61+
#define IDF_PERFORMANCE_MIN_UDP_RX_ETH_THROUGHPUT 50
62+
#endif
63+
#ifndef IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT
64+
#define IDF_PERFORMANCE_MIN_UDP_TX_ETH_THROUGHPUT 70
65+
#endif
66+
5367
// events dispatched per second by event loop library
5468
#ifndef IDF_PERFORMANCE_MIN_EVENT_DISPATCH
5569
#define IDF_PERFORMANCE_MIN_EVENT_DISPATCH 25000

tools/sdk/esp32c3/ld/esp32c3.rom.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ PROVIDE( esp_flash_chip_driver_initialized = 0x400002fc );
260260
PROVIDE( esp_flash_read_id = 0x40000300 );
261261
PROVIDE( esp_flash_get_size = 0x40000304 );
262262
PROVIDE( esp_flash_erase_chip = 0x40000308 );
263-
PROVIDE( esp_flash_erase_region = 0x4000030c );
263+
PROVIDE( rom_esp_flash_erase_region = 0x4000030c );
264264
PROVIDE( esp_flash_get_chip_write_protect = 0x40000310 );
265265
PROVIDE( esp_flash_set_chip_write_protect = 0x40000314 );
266266
PROVIDE( esp_flash_get_protectable_regions = 0x40000318 );

tools/sdk/esp32c3/ld/sections.ld

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,8 @@ SECTIONS
513513
/* Marks the end of IRAM code segment */
514514
.iram0.text_end (NOLOAD) :
515515
{
516-
/* C3 memprot requires 512 B alignment for split lines */
516+
/* C3 memprot requires 16B padding for possible CPU prefetch and 512B alignment for PMS split lines */
517+
. += 16;
517518
. = ALIGN (0x200);
518519
/* iram_end_test section exists for use by memprot unit tests only */
519520
*(.iram_end_test)

tools/sdk/esp32c3/lib/libapp_update.a

0 Bytes
Binary file not shown.

tools/sdk/esp32c3/lib/libesp_lcd.a

-22.6 KB
Binary file not shown.

tools/sdk/esp32c3/lib/libesp_system.a

0 Bytes
Binary file not shown.

tools/sdk/esp32c3/lib/libesp_wifi.a

0 Bytes
Binary file not shown.

tools/sdk/esp32c3/lib/libspi_flash.a

1.88 KB
Binary file not shown.
0 Bytes
Binary file not shown.

tools/sdk/esp32c3/sdkconfig

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,11 +1416,6 @@ CONFIG_WS_BUFFER_SIZE=1024
14161416
# end of Websocket
14171417
# end of TCP Transport
14181418

1419-
#
1420-
# TinyUSB
1421-
#
1422-
# end of TinyUSB
1423-
14241419
#
14251420
# Unity unit testing library
14261421
#

tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/class/cdc/cdc.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ typedef enum
215215
// Class Specific Functional Descriptor (Communication Interface)
216216
//--------------------------------------------------------------------+
217217

218+
// Start of all packed definitions for compiler without per-type packed
219+
TU_ATTR_PACKED_BEGIN
220+
TU_ATTR_BIT_FIELD_ORDER_BEGIN
221+
218222
/// Header Functional Descriptor (Communication Interface)
219223
typedef struct TU_ATTR_PACKED
220224
{
@@ -235,7 +239,7 @@ typedef struct TU_ATTR_PACKED
235239
}cdc_desc_func_union_t;
236240

237241
#define cdc_desc_func_union_n_t(no_slave)\
238-
struct TU_ATTR_PACKED { \
242+
struct TU_ATTR_PACKED { \
239243
uint8_t bLength ;\
240244
uint8_t bDescriptorType ;\
241245
uint8_t bDescriptorSubType ;\
@@ -254,7 +258,7 @@ typedef struct TU_ATTR_PACKED
254258
}cdc_desc_func_country_selection_t;
255259

256260
#define cdc_desc_func_country_selection_n_t(no_country) \
257-
struct TU_ATTR_PACKED {\
261+
struct TU_ATTR_PACKED { \
258262
uint8_t bLength ;\
259263
uint8_t bDescriptorType ;\
260264
uint8_t bDescriptorSubType ;\
@@ -283,7 +287,6 @@ typedef struct TU_ATTR_PACKED
283287
uint8_t bDataInterface;
284288
}cdc_desc_func_call_management_t;
285289

286-
287290
typedef struct TU_ATTR_PACKED
288291
{
289292
uint8_t support_comm_request : 1; ///< Device supports the request combination of Set_Comm_Feature, Clear_Comm_Feature, and Get_Comm_Feature.
@@ -295,8 +298,8 @@ typedef struct TU_ATTR_PACKED
295298

296299
TU_VERIFY_STATIC(sizeof(cdc_acm_capability_t) == 1, "mostly problem with compiler");
297300

298-
/// \brief Abstract Control Management Functional Descriptor
299-
/// \details This functional descriptor describes the commands supported by by the Communications Class interface with SubClass code of \ref CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL
301+
/// Abstract Control Management Functional Descriptor
302+
/// This functional descriptor describes the commands supported by by the Communications Class interface with SubClass code of \ref CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL
300303
typedef struct TU_ATTR_PACKED
301304
{
302305
uint8_t bLength ; ///< Size of this descriptor in bytes.
@@ -367,6 +370,7 @@ typedef struct TU_ATTR_PACKED
367370
} bmCapabilities;
368371
}cdc_desc_func_telephone_call_state_reporting_capabilities_t;
369372

373+
// TODO remove
370374
static inline uint8_t cdc_functional_desc_typeof(uint8_t const * p_desc)
371375
{
372376
return p_desc[2];
@@ -394,7 +398,8 @@ typedef struct TU_ATTR_PACKED
394398

395399
TU_VERIFY_STATIC(sizeof(cdc_line_control_state_t) == 2, "size is not correct");
396400

397-
/** @} */
401+
TU_ATTR_PACKED_END // End of all packed definitions
402+
TU_ATTR_BIT_FIELD_ORDER_END
398403

399404
#ifdef __cplusplus
400405
}

tools/sdk/esp32s2/include/arduino_tinyusb/tinyusb/src/common/tusb_compiler.h

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@
5252
#define TU_VERIFY_STATIC _Static_assert
5353
#elif defined (__cplusplus) && __cplusplus >= 201103L
5454
#define TU_VERIFY_STATIC static_assert
55+
#elif defined(__CCRX__)
56+
#define TU_VERIFY_STATIC(const_expr, _mess) typedef char TU_XSTRCAT(Line, __LINE__)[(const_expr) ? 1 : 0];
5557
#else
5658
#define TU_VERIFY_STATIC(const_expr, _mess) enum { TU_XSTRCAT(_verify_static_, _TU_COUNTER_) = 1/(!!(const_expr)) }
5759
#endif
@@ -77,6 +79,11 @@
7779
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
7880
#define TU_ATTR_USED __attribute__ ((used)) // Function/Variable is meant to be used
7981

82+
#define TU_ATTR_PACKED_BEGIN
83+
#define TU_ATTR_PACKED_END
84+
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
85+
#define TU_ATTR_BIT_FIELD_ORDER_END
86+
8087
// Endian conversion use well-known host to network (big endian) naming
8188
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
8289
#define TU_BYTE_ORDER TU_LITTLE_ENDIAN
@@ -101,6 +108,11 @@
101108
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
102109
#define TU_ATTR_USED __attribute__ ((used))
103110

111+
#define TU_ATTR_PACKED_BEGIN
112+
#define TU_ATTR_PACKED_END
113+
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
114+
#define TU_ATTR_BIT_FIELD_ORDER_END
115+
104116
// __BYTE_ORDER is defined in the TI ARM compiler, but not MSP430 (which is little endian)
105117
#if ((__BYTE_ORDER__) == (__ORDER_LITTLE_ENDIAN__)) || defined(__MSP430__)
106118
#define TU_BYTE_ORDER TU_LITTLE_ENDIAN
@@ -122,6 +134,11 @@
122134
#define TU_ATTR_UNUSED __attribute__ ((unused)) // Function/Variable is meant to be possibly unused
123135
#define TU_ATTR_USED __attribute__ ((used)) // Function/Variable is meant to be used
124136

137+
#define TU_ATTR_PACKED_BEGIN
138+
#define TU_ATTR_PACKED_END
139+
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
140+
#define TU_ATTR_BIT_FIELD_ORDER_END
141+
125142
// Endian conversion use well-known host to network (big endian) naming
126143
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
127144
#define TU_BYTE_ORDER TU_LITTLE_ENDIAN
@@ -131,6 +148,32 @@
131148

132149
#define TU_BSWAP16(u16) (__iar_builtin_REV16(u16))
133150
#define TU_BSWAP32(u32) (__iar_builtin_REV(u32))
151+
152+
#elif defined(__CCRX__)
153+
#define TU_ATTR_ALIGNED(Bytes)
154+
#define TU_ATTR_SECTION(sec_name)
155+
#define TU_ATTR_PACKED
156+
#define TU_ATTR_WEAK
157+
#define TU_ATTR_ALWAYS_INLINE
158+
#define TU_ATTR_DEPRECATED(mess)
159+
#define TU_ATTR_UNUSED
160+
#define TU_ATTR_USED
161+
162+
#define TU_ATTR_PACKED_BEGIN _Pragma("pack")
163+
#define TU_ATTR_PACKED_END _Pragma("packoption")
164+
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN _Pragma("bit_order right")
165+
#define TU_ATTR_BIT_FIELD_ORDER_END _Pragma("bit_order")
166+
167+
// Endian conversion use well-known host to network (big endian) naming
168+
#if defined(__LIT)
169+
#define TU_BYTE_ORDER TU_LITTLE_ENDIAN
170+
#else
171+
#define TU_BYTE_ORDER TU_BIG_ENDIAN
172+
#endif
173+
174+
#define TU_BSWAP16(u16) ((unsigned short)_builtin_revw((unsigned long)u16))
175+
#define TU_BSWAP32(u32) (_builtin_revl(u32))
176+
134177
#else
135178
#error "Compiler attribute porting is required"
136179
#endif
@@ -157,11 +200,11 @@
157200
#define tu_htonl(u32) (u32)
158201
#define tu_ntohl(u32) (u32)
159202

160-
#define tu_htole16(u16) (tu_bswap16(u16))
161-
#define tu_le16toh(u16) (tu_bswap16(u16))
203+
#define tu_htole16(u16) (TU_BSWAP16(u16))
204+
#define tu_le16toh(u16) (TU_BSWAP16(u16))
162205

163-
#define tu_htole32(u32) (tu_bswap32(u32))
164-
#define tu_le32toh(u32) (tu_bswap32(u32))
206+
#define tu_htole32(u32) (TU_BSWAP32(u32))
207+
#define tu_le32toh(u32) (TU_BSWAP32(u32))
165208

166209
#else
167210
#error Byte order is undefined

0 commit comments

Comments
 (0)