Finally got MS/TP communicating on ports/rtos32. I still need to verify that it is doing things correctly since it seems a little slow to respond to service requests. Still more work to do refactoring the state machine.

This commit is contained in:
skarg
2006-08-25 21:36:56 +00:00
parent 52ee5a5619
commit 6b18bb8935
7 changed files with 246 additions and 274 deletions
+10 -9
View File
@@ -111,8 +111,9 @@ int dlmstp_send_pdu(BACNET_ADDRESS * dest, /* destination address */
void dlmstp_task(void)
{
RS485_Check_UART_Data(&MSTP_Port);
MSTP_Receive_Frame_FSM(&MSTP_Port);
MSTP_Master_Node_FSM(&MSTP_Port);
MSTP_Receive_Frame_FSM(&MSTP_Port);
if (MSTP_Port.receive_state == MSTP_RECEIVE_STATE_IDLE)
MSTP_Master_Node_FSM(&MSTP_Port);
}
/* called about once a millisecond */
@@ -175,17 +176,17 @@ uint16_t dlmstp_put_receive(
uint8_t * pdu, /* PDU data */
uint16_t pdu_len)
{
if (Receive_Buffer.ready)
{
if (Receive_Buffer.ready) {
/* FIXME: what to do when we miss a message? */
pdu_len = 0;
}
else
{
pdu_len = 0;
} else if (pdu_len < sizeof(Receive_Buffer.pdu)) {
dlmstp_fill_bacnet_address(&Receive_Buffer.address, src);
Receive_Buffer.pdu_len = pdu_len;
memmove(Receive_Buffer.pdu, pdu, sizeof(Receive_Buffer.pdu));
memmove(Receive_Buffer.pdu, pdu, pdu_len);
Receive_Buffer.ready = true;
} else {
/* FIXME: message too large? */
pdu_len = 0;
}
return pdu_len;