Skip to content

Commit 19d1a29

Browse files
[iperf][ntp] compiling error fix (#93)
- fix the iperf compiling error in rt-thread 5.0.x - fix the compiling error in ntp if the RT_USING_LEGACY is not defined Signed-off-by: Fan YANG <fan.yang@hpmicro.com>
1 parent dc7d6c5 commit 19d1a29

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

iperf/iperf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ void iperf_server(void *thread_param)
354354
data = recvlen * RT_TICK_PER_SECOND / 125 / (tick2 - tick1);
355355
integer = data/1000;
356356
decimal = data%1000;
357-
LOG_I("%s: %d.%03d0 Mbps!", tid->name, integer, decimal);
357+
LOG_I("%s: %d.%03d0 Mbps!", IPERF_GET_THREAD_NAME(tid), integer, decimal);
358358
tick1 = tick2;
359359
recvlen = 0;
360360
}

ntp/ntp.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ extern int closesocket(int s);
8989
#define VN(packet) (rt_uint8_t) ((packet.li_vn_mode & 0x38) >> 3) /* (vn & 00 111 000) >> 3 */
9090
#define MODE(packet) (rt_uint8_t) ((packet.li_vn_mode & 0x07) >> 0) /* (mode & 00 000 111) >> 0 */
9191

92+
93+
#if (RT_VER_NUM >= 0x50000)
94+
#define NTP_RTT_VER_MAJOR RT_VERSION_MAJOR
95+
#define NTP_RTT_VER_MINOR RT_VERSION_MINOR
96+
#define NTP_RTT_VER_PATCH RT_VERSION_PATCH
97+
#else
98+
#define NTP_RTT_VER_MAJOR RT_VERSION
99+
#define NTP_RTT_VER_MINOR RT_SUBVERSION
100+
#define NTP_RTT_VER_PATCH RT_REVISION
101+
#endif
102+
92103
/* Structure that defines the 48 byte NTP packet protocol */
93104
typedef struct {
94105

@@ -230,9 +241,9 @@ time_t ntp_get_time(const char *host_name)
230241
}
231242
}
232243

233-
send_data[9] = RT_VERSION;
234-
send_data[10] = RT_SUBVERSION;
235-
send_data[11] = RT_REVISION;
244+
send_data[9] = NTP_RTT_VER_MAJOR;
245+
send_data[10] = NTP_RTT_VER_MINOR;
246+
send_data[11] = NTP_RTT_VER_PATCH;
236247
send_data[12] = (uint8_t)(SW_VER_NUM >> 24);
237248
send_data[13] = (uint8_t)(SW_VER_NUM >> 16);
238249
send_data[14] = (uint8_t)(SW_VER_NUM >> 8);

0 commit comments

Comments
 (0)