1、【增加】《FreeModbus 主机分析图》,但部分图还需要完善;
2、【修改】《FreeModbus 从机分析图》部分错误; 3、【修改】mbrtu_m.c 中关于接收状态及定时器超时状态机相关内容 Signed-off-by: armink <armink.ztl@gmail.com>
This commit is contained in:
parent
a5528950d0
commit
cb7ce7ee03
Binary file not shown.
Binary file not shown.
|
@ -56,14 +56,14 @@ typedef enum
|
||||||
{
|
{
|
||||||
STATE_M_RX_INIT, /*!< Receiver is in initial state. */
|
STATE_M_RX_INIT, /*!< Receiver is in initial state. */
|
||||||
STATE_M_RX_IDLE, /*!< Receiver is in idle state. */
|
STATE_M_RX_IDLE, /*!< Receiver is in idle state. */
|
||||||
STATE_M_RX_RCV /*!< Frame is beeing received. */
|
STATE_M_RX_RCV, /*!< Frame is beeing received. */
|
||||||
|
STATE_M_RX_ERROR /*!< If the frame is invalid. */
|
||||||
} eMBMasterRcvState;
|
} eMBMasterRcvState;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
STATE_M_TX_IDLE, /*!< Transmitter is in idle state. */
|
STATE_M_TX_IDLE, /*!< Transmitter is in idle state. */
|
||||||
STATE_M_TX_XMIT, /*!< Transmitter is in transfer state. */
|
STATE_M_TX_XMIT, /*!< Transmitter is in transfer state. */
|
||||||
STATE_M_TX_ERROR /*!< If the frame is invalid. */
|
|
||||||
} eMBMasterSndState;
|
} eMBMasterSndState;
|
||||||
|
|
||||||
/* ----------------------- Static variables ---------------------------------*/
|
/* ----------------------- Static variables ---------------------------------*/
|
||||||
|
@ -321,13 +321,13 @@ eMBMasterRTUStop( void )
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
BOOL
|
BOOL
|
||||||
xMBMasterRTUTimerT35Expired( void )
|
xMBMasterRTUTimerT35Expired(void)
|
||||||
{
|
{
|
||||||
BOOL xNeedPoll = FALSE;
|
BOOL xNeedPoll = FALSE;
|
||||||
|
|
||||||
switch (eRcvState)
|
switch (eRcvState)
|
||||||
{
|
{
|
||||||
/* Timer t35 expired. Startup phase is finished. */
|
/* Timer t35 expired. Startup phase is finished. */
|
||||||
case STATE_M_RX_INIT:
|
case STATE_M_RX_INIT:
|
||||||
xNeedPoll = xMBMasterPortEventPost(EV_READY);
|
xNeedPoll = xMBMasterPortEventPost(EV_READY);
|
||||||
break;
|
break;
|
||||||
|
@ -337,10 +337,15 @@ xMBMasterRTUTimerT35Expired( void )
|
||||||
case STATE_M_RX_RCV:
|
case STATE_M_RX_RCV:
|
||||||
xNeedPoll = xMBMasterPortEventPost(EV_FRAME_RECEIVED);
|
xNeedPoll = xMBMasterPortEventPost(EV_FRAME_RECEIVED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* An error occured while receiving the frame. */
|
||||||
|
case STATE_RX_ERROR:
|
||||||
|
break;
|
||||||
|
|
||||||
/* Function called in an illegal state. */
|
/* Function called in an illegal state. */
|
||||||
default:
|
default:
|
||||||
assert_param(
|
assert_param(
|
||||||
( eRcvState == STATE_M_RX_INIT ) || ( eRcvState == STATE_M_RX_RCV ));
|
( eRcvState == STATE_M_RX_INIT ) || ( eRcvState == STATE_M_RX_RCV ) || ( eRcvState == STATE_M_RX_ERROR ));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +354,14 @@ xMBMasterRTUTimerT35Expired( void )
|
||||||
|
|
||||||
//TODO 发送状态在超时后的状态转换需要添加
|
//TODO 发送状态在超时后的状态转换需要添加
|
||||||
|
|
||||||
return xNeedPoll;
|
switch(eSndState)
|
||||||
|
{
|
||||||
|
/* Timer t35 expired. . */
|
||||||
|
case STATE_M_TX_XMIT :
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return xNeedPoll;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue