Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yunqingabc
rt-thread
提交
be18a1d0
R
rt-thread
项目概览
yunqingabc
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
be18a1d0
编写于
4月 11, 2017
作者:
armink_ztl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Modbus] Update the code to the latest version.
上级
5502558d
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
12 addition
and
14 deletion
+12
-14
components/net/freemodbus/modbus/functions/mbfunccoils_m.c
components/net/freemodbus/modbus/functions/mbfunccoils_m.c
+1
-1
components/net/freemodbus/modbus/functions/mbfuncholding.c
components/net/freemodbus/modbus/functions/mbfuncholding.c
+1
-1
components/net/freemodbus/port/portserial.c
components/net/freemodbus/port/portserial.c
+3
-4
components/net/freemodbus/port/portserial_m.c
components/net/freemodbus/port/portserial_m.c
+5
-6
components/net/freemodbus/port/porttimer.c
components/net/freemodbus/port/porttimer.c
+1
-1
components/net/freemodbus/port/porttimer_m.c
components/net/freemodbus/port/porttimer_m.c
+1
-1
未找到文件。
components/net/freemodbus/modbus/functions/mbfunccoils_m.c
浏览文件 @
be18a1d0
...
...
@@ -196,7 +196,7 @@ eMBMasterReqWriteCoil( UCHAR ucSndAddr, USHORT usCoilAddr, USHORT usCoilData, LO
UCHAR
*
ucMBFrame
;
eMBMasterReqErrCode
eErrStatus
=
MB_MRE_NO_ERR
;
if
(
u
sCoil
Addr
>
MB_MASTER_TOTAL_SLAVE_NUM
)
eErrStatus
=
MB_MRE_ILL_ARG
;
if
(
u
cSnd
Addr
>
MB_MASTER_TOTAL_SLAVE_NUM
)
eErrStatus
=
MB_MRE_ILL_ARG
;
else
if
(
(
usCoilData
!=
0xFF00
)
&&
(
usCoilData
!=
0x0000
)
)
eErrStatus
=
MB_MRE_ILL_ARG
;
else
if
(
xMBMasterRunResTake
(
lTimeOut
)
==
FALSE
)
eErrStatus
=
MB_MRE_MASTER_BUSY
;
else
...
...
components/net/freemodbus/modbus/functions/mbfuncholding.c
浏览文件 @
be18a1d0
...
...
@@ -183,7 +183,7 @@ eMBFuncReadHoldingRegister( UCHAR * pucFrame, USHORT * usLen )
usRegAddress
++
;
usRegCount
=
(
USHORT
)(
pucFrame
[
MB_PDU_FUNC_READ_REGCNT_OFF
]
<<
8
);
usRegCount
=
(
USHORT
)(
pucFrame
[
MB_PDU_FUNC_READ_REGCNT_OFF
+
1
]
);
usRegCount
|
=
(
USHORT
)(
pucFrame
[
MB_PDU_FUNC_READ_REGCNT_OFF
+
1
]
);
/* Check if the number of registers to read is valid. If not
* return Modbus illegal data value exception.
...
...
components/net/freemodbus/port/portserial.c
浏览文件 @
be18a1d0
...
...
@@ -99,14 +99,14 @@ BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
serial
->
ops
->
configure
(
serial
,
&
(
serial
->
config
));
/* open serial device */
if
(
!
serial
->
parent
.
open
(
&
serial
->
parent
,
RT_DEVICE_OFLAG_RDWR
|
RT_DEVICE_FLAG_INT_RX
))
{
serial
->
parent
.
rx_indicate
=
serial_rx_ind
;
if
(
!
rt_device_open
(
&
serial
->
parent
,
RT_DEVICE_OFLAG_RDWR
|
RT_DEVICE_FLAG_INT_RX
))
{
rt_device_set_rx_indicate
(
&
serial
->
parent
,
serial_rx_ind
);
}
else
{
return
FALSE
;
}
/* software initialize */
rt_event_init
(
&
event_serial
,
"slave event"
,
RT_IPC_FLAG_PRIO
);
rt_thread_init
(
&
thread_serial_soft_trans_irq
,
"slave trans"
,
serial_soft_trans_irq
,
...
...
@@ -115,7 +115,6 @@ BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
sizeof
(
serial_soft_trans_irq_stack
),
10
,
5
);
rt_thread_startup
(
&
thread_serial_soft_trans_irq
);
rt_event_init
(
&
event_serial
,
"slave event"
,
RT_IPC_FLAG_PRIO
);
return
TRUE
;
}
...
...
components/net/freemodbus/port/portserial_m.c
浏览文件 @
be18a1d0
...
...
@@ -36,7 +36,7 @@ static rt_uint8_t serial_soft_trans_irq_stack[512];
static
struct
rt_thread
thread_serial_soft_trans_irq
;
/* serial event */
static
struct
rt_event
event_serial
;
/* modbus
slave
serial device */
/* modbus
master
serial device */
static
rt_serial_t
*
serial
;
/* ----------------------- Defines ------------------------------------------*/
...
...
@@ -100,23 +100,22 @@ BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
serial
->
ops
->
configure
(
serial
,
&
(
serial
->
config
));
/* open serial device */
if
(
!
serial
->
parent
.
open
(
&
serial
->
parent
,
RT_DEVICE_OFLAG_RDWR
|
RT_DEVICE_FLAG_INT_RX
))
{
serial
->
parent
.
rx_indicate
=
serial_rx_ind
;
if
(
!
rt_device_open
(
&
serial
->
parent
,
RT_DEVICE_OFLAG_RDWR
|
RT_DEVICE_FLAG_INT_RX
))
{
rt_device_set_rx_indicate
(
&
serial
->
parent
,
serial_rx_ind
);
}
else
{
return
FALSE
;
}
/* software initialize */
rt_event_init
(
&
event_serial
,
"master event"
,
RT_IPC_FLAG_PRIO
);
rt_thread_init
(
&
thread_serial_soft_trans_irq
,
"
slave
trans"
,
"
master
trans"
,
serial_soft_trans_irq
,
RT_NULL
,
serial_soft_trans_irq_stack
,
sizeof
(
serial_soft_trans_irq_stack
),
10
,
5
);
rt_thread_startup
(
&
thread_serial_soft_trans_irq
);
rt_event_init
(
&
event_serial
,
"slave event"
,
RT_IPC_FLAG_PRIO
);
return
TRUE
;
}
...
...
components/net/freemodbus/port/porttimer.c
浏览文件 @
be18a1d0
...
...
@@ -37,7 +37,7 @@ BOOL xMBPortTimersInit(USHORT usTim1Timerout50us)
rt_timer_init
(
&
timer
,
"slave timer"
,
timer_timeout_ind
,
/* bind timeout callback function */
RT_NULL
,
(
50
*
usTim1Timerout50us
)
/
(
1000
*
1000
/
RT_TICK_PER_SECOND
)
,
(
50
*
usTim1Timerout50us
)
/
(
1000
*
1000
/
RT_TICK_PER_SECOND
)
+
1
,
RT_TIMER_FLAG_ONE_SHOT
);
/* one shot */
return
TRUE
;
}
...
...
components/net/freemodbus/port/porttimer_m.c
浏览文件 @
be18a1d0
...
...
@@ -46,7 +46,7 @@ BOOL xMBMasterPortTimersInit(USHORT usTimeOut50us)
rt_timer_init
(
&
timer
,
"master timer"
,
timer_timeout_ind
,
/* bind timeout callback function */
RT_NULL
,
(
50
*
usT35TimeOut50us
)
/
(
1000
*
1000
/
RT_TICK_PER_SECOND
),
(
50
*
usT35TimeOut50us
)
/
(
1000
*
1000
/
RT_TICK_PER_SECOND
)
+
1
,
RT_TIMER_FLAG_ONE_SHOT
);
/* one shot */
return
TRUE
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录