Skip to content

Commit f7b3a8f

Browse files
authored
[rt-link] fix the compiling issue under 64bit arch #11018
1 parent a890e62 commit f7b3a8f

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

components/utilities/rt-link/src/rtlink.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#define RT_LINK_THREAD_NAME "rtlink"
4949
#define RT_LINK_THREAD_TICK 20
5050
#define RT_LINK_THREAD_PRIORITY 25
51-
#define RT_LINK_THREAD_STACK_SIZE 1024 /* 32 bytes aligned */
51+
#define RT_LINK_THREAD_STACK_SIZE (4 * 1024) /* 32 bytes aligned */
5252

5353
#define RT_LINK_FRAME_SENT 1
5454
#define RT_LINK_FRAME_NOSEND 0
@@ -905,8 +905,8 @@ static void rt_link_frame_recv_timeout(void)
905905

906906
static void rt_link_send_timeout(void)
907907
{
908-
LOG_D("send count(%d)", (rt_uint32_t)rt_link_scb->sendtimer.parameter);
909-
if ((rt_uint32_t)rt_link_scb->sendtimer.parameter >= 5)
908+
LOG_D("send count(%d)", (rt_ubase_t)rt_link_scb->sendtimer.parameter);
909+
if ((rt_ubase_t)rt_link_scb->sendtimer.parameter >= 5)
910910
{
911911
rt_timer_stop(&rt_link_scb->sendtimer);
912912
LOG_W("Send timeout, please check the link status!");
@@ -929,7 +929,7 @@ static void rt_link_send_timeout(void)
929929

930930
static void rt_link_long_recv_timeout(void)
931931
{
932-
if ((rt_uint32_t)rt_link_scb->longframetimer.parameter >= 5)
932+
if ((rt_ubase_t)rt_link_scb->longframetimer.parameter >= 5)
933933
{
934934
LOG_W("long package receive timeout");
935935
rt_link_scb->longframetimer.parameter = 0x00;
@@ -996,7 +996,7 @@ void rt_link_thread(void *parameter)
996996

997997
static void rt_link_sendtimer_callback(void *parameter)
998998
{
999-
rt_uint32_t count = (rt_uint32_t)rt_link_scb->sendtimer.parameter + 1;
999+
rt_ubase_t count = (rt_ubase_t)rt_link_scb->sendtimer.parameter + 1;
10001000
rt_link_scb->sendtimer.parameter = (void *)count;
10011001
rt_event_send(&rt_link_scb->event, RT_LINK_SEND_TIMEOUT_EVENT);
10021002
}
@@ -1008,7 +1008,7 @@ static void rt_link_recvtimer_callback(void *parameter)
10081008

10091009
static void rt_link_receive_long_frame_callback(void *parameter)
10101010
{
1011-
rt_uint32_t count = (rt_uint32_t)rt_link_scb->longframetimer.parameter + 1;
1011+
rt_ubase_t count = (rt_ubase_t)rt_link_scb->longframetimer.parameter + 1;
10121012
rt_link_scb->longframetimer.parameter = (void *)count;
10131013
rt_event_send(&rt_link_scb->event, RT_LINK_RECV_TIMEOUT_LONG_EVENT);
10141014
}
@@ -1174,8 +1174,8 @@ MSH_CMD_EXPORT(rtlink_status, Display RTLINK status);
11741174
* */
11751175
rt_err_t rt_link_deinit(void)
11761176
{
1177-
rt_enter_critical();
11781177
rt_link_hw_deinit();
1178+
rt_enter_critical();
11791179
if (rt_link_scb)
11801180
{
11811181
rt_timer_detach(&rt_link_scb->longframetimer);
@@ -1235,6 +1235,13 @@ int rt_link_init(void)
12351235
rt_slist_init(&rt_link_scb->tx_data_slist);
12361236
rt_link_scb->tx_seq = RT_LINK_INIT_FRAME_SEQENCE;
12371237

1238+
if (RT_EOK != rt_link_hw_init())
1239+
{
1240+
LOG_E("rtlink hw init failed.");
1241+
result = -RT_ERROR;
1242+
goto __exit;
1243+
}
1244+
12381245
/* create rtlink core work thread */
12391246
thread = rt_thread_create(RT_LINK_THREAD_NAME,
12401247
rt_link_thread,

components/utilities/rt-link/src/rtlink_dev.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <sys/stat.h>
2525
#include <sys/statfs.h>
2626
#include <poll.h>
27+
#include <dfs_file.h>
28+
#include <fcntl.h>
2729

2830
int rtlink_fops_open(struct dfs_file *fd)
2931
{
@@ -82,9 +84,9 @@ int rtlink_fops_ioctl(struct dfs_file *fd, int cmd, void *args)
8284
}
8385
}
8486

85-
int rtlink_fops_read(struct dfs_file *fd, void *buf, size_t count)
87+
ssize_t rtlink_fops_read(struct dfs_file *fd, void *buf, size_t count)
8688
{
87-
int size = 0;
89+
ssize_t size = 0;
8890
rt_device_t device;
8991
device = (rt_device_t)fd->vnode->data;
9092

@@ -96,9 +98,9 @@ int rtlink_fops_read(struct dfs_file *fd, void *buf, size_t count)
9698
return size;
9799
}
98100

99-
int rtlink_fops_write(struct dfs_file *fd, const void *buf, size_t count)
101+
ssize_t rtlink_fops_write(struct dfs_file *fd, const void *buf, size_t count)
100102
{
101-
int size = 0;
103+
ssize_t size = 0;
102104
rt_device_t device;
103105
device = (rt_device_t)fd->vnode->data;
104106

0 commit comments

Comments
 (0)