Merge pull request #372 from vDorst/fix_macros

Fix define macros, was missing the do {} while (0) wrapping
This commit is contained in:
René van Dorst
2026-08-31 13:07:29 +02:00
committed by GitHub
2 changed files with 7 additions and 4 deletions
+4 -2
View File
@@ -31,11 +31,13 @@ void rtl8224_write_reg_u16(uint16_t reg, uint16_t val) __banked;
void rtl8224_sds_write(uint16_t sds_cmd, uint16_t val) __banked;
void phy_config_8261(uint8_t phy, uint8_t sds) __banked;
#define RTL8224_SDS_WRITE(sds_id, page, reg, v) uint16_t _sdscmd = (uint16_t)(sds_id & 0x01) | (1 << 14) | (1 << 15); \
#define RTL8224_SDS_WRITE(sds_id, page, reg, v) do { \
uint16_t _sdscmd = (uint16_t)(sds_id & 0x01) | (1 << 14) | (1 << 15); \
_sdscmd |= (page & 0x3F) << 1; \
_sdscmd |= ((uint16_t)(reg & 0x1f)) << 7; \
print_string("CMD: "); print_short(_sdscmd); \
write_char('-'); print_short(v); \
rtl8224_sds_write(_sdscmd, v);
rtl8224_sds_write(_sdscmd, v); \
} while (0)
#endif
+3 -2
View File
@@ -8,11 +8,12 @@
#define STAT_COUNTER_RX_PKTS 47
#define STAT_COUNTER_ERR_PKTS 48
#define STAT_GET(cnt, port) \
#define STAT_GET(cnt, port) do { \
REG_WRITE(RTL837X_STAT_GET, 0x00, 0x00, cnt >> 3, (cnt << 5) | (port << 1) | 1); \
do { \
reg_read_m(RTL837X_STAT_GET); \
} while (sfr_data[3] & 0x1);
} while (sfr_data[3] & 0x1); \
} while (0)
// Possible values for ingress filter type
typedef enum {