From d9fea88227150380946c80911c2ff0f110a59c33 Mon Sep 17 00:00:00 2001 From: skarg Date: Fri, 17 Jul 2009 15:41:37 +0000 Subject: [PATCH] Removed the unused state of MSTP_RECEIVE_STATE_HEADER_CRC. Hopefully this doesn't break too many implementations! --- bacnet-stack/Makefile | 17 ++++++- bacnet-stack/include/mstpdef.h | 3 +- bacnet-stack/ports/pic18f6720/mstp.c | 5 --- bacnet-stack/ports/pic18f6720/mstp.h | 66 +--------------------------- bacnet-stack/ports/rtos32/mstp.c | 3 -- bacnet-stack/ports/rtos32/mstp.h | 59 +------------------------ bacnet-stack/src/mstp.c | 8 ---- bacnet-stack/src/mstptext.c | 1 - 8 files changed, 19 insertions(+), 143 deletions(-) diff --git a/bacnet-stack/Makefile b/bacnet-stack/Makefile index 7f446cf2..4e268c30 100644 --- a/bacnet-stack/Makefile +++ b/bacnet-stack/Makefile @@ -1,6 +1,6 @@ all: library readprop writeprop readfile writefile reinit server dcc \ whohas whois ucov timesync epics readpropm mstpcap \ - whoisrouter iamrouter initrouter + whoisrouter iamrouter initrouter @echo "utilities are in the bin directory" clean: lib/Makefile\ @@ -94,3 +94,18 @@ iamrouter: demo/iamrouter/Makefile initrouter: demo/initrouter/Makefile ( cd demo/initrouter ; make ; cp bacinitr ../../bin ) +ports: atmega168 at91sam7s bdk-atxx4-mstp + echo "Built the ports" + +atmega168: ports/atmega168/Makefile + make -C ports/atmega168 clean all + +at91sam7s: ports/at91sam7s/Makefile + make -C ports/at91sam7s clean all + +bdk-atxx4-mstp: ports/bdk-atxx4-mstp/Makefile + make -C ports/bdk-atxx4-mstp clean all + + + + diff --git a/bacnet-stack/include/mstpdef.h b/bacnet-stack/include/mstpdef.h index 74056dc4..cf219bff 100644 --- a/bacnet-stack/include/mstpdef.h +++ b/bacnet-stack/include/mstpdef.h @@ -73,8 +73,7 @@ typedef enum { MSTP_RECEIVE_STATE_IDLE = 0, MSTP_RECEIVE_STATE_PREAMBLE = 1, MSTP_RECEIVE_STATE_HEADER = 2, - MSTP_RECEIVE_STATE_HEADER_CRC = 3, - MSTP_RECEIVE_STATE_DATA = 4 + MSTP_RECEIVE_STATE_DATA = 3 } MSTP_RECEIVE_STATE; /* master node FSM states */ diff --git a/bacnet-stack/ports/pic18f6720/mstp.c b/bacnet-stack/ports/pic18f6720/mstp.c index 07ae407f..3d82acb1 100644 --- a/bacnet-stack/ports/pic18f6720/mstp.c +++ b/bacnet-stack/ports/pic18f6720/mstp.c @@ -419,7 +419,6 @@ void MSTP_Receive_Frame_FSM( mstp_port->HeaderCRC); mstp_port->DataAvailable = false; /* don't wait for next state - do it here */ - /* MSTP_RECEIVE_STATE_HEADER_CRC */ if (mstp_port->HeaderCRC != 0x55) { /* BadCRC */ /* indicate that an error has occurred during the reception of a frame */ @@ -478,10 +477,6 @@ void MSTP_Receive_Frame_FSM( mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; } } - break; - /* In the HEADER_CRC state, the node validates the CRC on the fixed */ - /* message header. */ - case MSTP_RECEIVE_STATE_HEADER_CRC: break; /* In the DATA state, the node waits for the data portion of a frame. */ case MSTP_RECEIVE_STATE_DATA: diff --git a/bacnet-stack/ports/pic18f6720/mstp.h b/bacnet-stack/ports/pic18f6720/mstp.h index fac03588..29598390 100644 --- a/bacnet-stack/ports/pic18f6720/mstp.h +++ b/bacnet-stack/ports/pic18f6720/mstp.h @@ -40,58 +40,9 @@ #include #include #include "bacdef.h" +#include "mstpdef.h" #include "dlmstp.h" -/* The value 255 is used to denote broadcast when used as a */ -/* destination address but is not allowed as a value for a station. */ -/* Station addresses for master nodes can be 0-127. */ -/* Station addresses for slave nodes can be 127-254. */ -#define MSTP_BROADCAST_ADDRESS 255 - -/* MS/TP Frame Type */ -/* Frame Types 8 through 127 are reserved by ASHRAE. */ -#define FRAME_TYPE_TOKEN 0 -#define FRAME_TYPE_POLL_FOR_MASTER 1 -#define FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER 2 -#define FRAME_TYPE_TEST_REQUEST 3 -#define FRAME_TYPE_TEST_RESPONSE 4 -#define FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY 5 -#define FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY 6 -#define FRAME_TYPE_REPLY_POSTPONED 7 -/* Frame Types 128 through 255: Proprietary Frames */ -/* These frames are available to vendors as proprietary (non-BACnet) frames. */ -/* The first two octets of the Data field shall specify the unique vendor */ -/* identification code, most significant octet first, for the type of */ -/* vendor-proprietary frame to be conveyed. The length of the data portion */ -/* of a Proprietary frame shall be in the range of 2 to 501 octets. */ -#define FRAME_TYPE_PROPRIETARY_MIN 128 -#define FRAME_TYPE_PROPRIETARY_MAX 255 -/* The initial CRC16 checksum value */ -#define CRC16_INITIAL_VALUE (0xFFFF) - - -/* receive FSM states */ -typedef enum { - MSTP_RECEIVE_STATE_IDLE = 0, - MSTP_RECEIVE_STATE_PREAMBLE = 1, - MSTP_RECEIVE_STATE_HEADER = 2, - MSTP_RECEIVE_STATE_HEADER_CRC = 3, - MSTP_RECEIVE_STATE_DATA = 4 -} MSTP_RECEIVE_STATE; - -/* master node FSM states */ -typedef enum { - MSTP_MASTER_STATE_INITIALIZE = 0, - MSTP_MASTER_STATE_IDLE = 1, - MSTP_MASTER_STATE_USE_TOKEN = 2, - MSTP_MASTER_STATE_WAIT_FOR_REPLY = 3, - MSTP_MASTER_STATE_DONE_WITH_TOKEN = 4, - MSTP_MASTER_STATE_PASS_TOKEN = 5, - MSTP_MASTER_STATE_NO_TOKEN = 6, - MSTP_MASTER_STATE_POLL_FOR_MASTER = 7, - MSTP_MASTER_STATE_ANSWER_DATA_REQUEST = 8 -} MSTP_MASTER_STATE; - struct mstp_port_struct_t { MSTP_RECEIVE_STATE receive_state; /* When a master node is powered up or reset, */ @@ -203,21 +154,6 @@ struct mstp_port_struct_t { uint8_t TxFrameType; /* type of message - needed by MS/TP */ }; -#define DEFAULT_MAX_INFO_FRAMES 1 -#define DEFAULT_MAX_MASTER 127 -#define DEFAULT_MAC_ADDRESS 127 - -/* The minimum time after the end of the stop bit of the final octet of a */ -/* received frame before a node may enable its EIA-485 driver: 40 bit times. */ -/* At 9600 baud, 40 bit times would be about 4.166 milliseconds */ -/* At 19200 baud, 40 bit times would be about 2.083 milliseconds */ -/* At 38400 baud, 40 bit times would be about 1.041 milliseconds */ -/* At 57600 baud, 40 bit times would be about 0.694 milliseconds */ -/* At 76800 baud, 40 bit times would be about 0.520 milliseconds */ -/* At 115200 baud, 40 bit times would be about 0.347 milliseconds */ -/* 40 bits is 4 octets including a start and stop bit with each octet */ -#define Tturnaround 40 - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ diff --git a/bacnet-stack/ports/rtos32/mstp.c b/bacnet-stack/ports/rtos32/mstp.c index b9873b73..676aa8d2 100644 --- a/bacnet-stack/ports/rtos32/mstp.c +++ b/bacnet-stack/ports/rtos32/mstp.c @@ -255,9 +255,6 @@ char *mstp_receive_state_text( case MSTP_RECEIVE_STATE_HEADER: text = "HEADER"; break; - case MSTP_RECEIVE_STATE_HEADER_CRC: - text = "HEADER_CRC"; - break; case MSTP_RECEIVE_STATE_DATA: text = "DATA"; break; diff --git a/bacnet-stack/ports/rtos32/mstp.h b/bacnet-stack/ports/rtos32/mstp.h index da53b704..2c28ddb7 100644 --- a/bacnet-stack/ports/rtos32/mstp.h +++ b/bacnet-stack/ports/rtos32/mstp.h @@ -40,58 +40,9 @@ #include #include #include "bacdef.h" +#include "mstpdef.h" #include "dlmstp.h" -/* The value 255 is used to denote broadcast when used as a */ -/* destination address but is not allowed as a value for a station. */ -/* Station addresses for master nodes can be 0-127. */ -/* Station addresses for slave nodes can be 127-254. */ -#define MSTP_BROADCAST_ADDRESS 255 - -/* MS/TP Frame Type */ -/* Frame Types 8 through 127 are reserved by ASHRAE. */ -#define FRAME_TYPE_TOKEN 0 -#define FRAME_TYPE_POLL_FOR_MASTER 1 -#define FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER 2 -#define FRAME_TYPE_TEST_REQUEST 3 -#define FRAME_TYPE_TEST_RESPONSE 4 -#define FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY 5 -#define FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY 6 -#define FRAME_TYPE_REPLY_POSTPONED 7 -/* Frame Types 128 through 255: Proprietary Frames */ -/* These frames are available to vendors as proprietary (non-BACnet) frames. */ -/* The first two octets of the Data field shall specify the unique vendor */ -/* identification code, most significant octet first, for the type of */ -/* vendor-proprietary frame to be conveyed. The length of the data portion */ -/* of a Proprietary frame shall be in the range of 2 to 501 octets. */ -#define FRAME_TYPE_PROPRIETARY_MIN 128 -#define FRAME_TYPE_PROPRIETARY_MAX 255 -/* The initial CRC16 checksum value */ -#define CRC16_INITIAL_VALUE (0xFFFF) - - -/* receive FSM states */ -typedef enum { - MSTP_RECEIVE_STATE_IDLE, - MSTP_RECEIVE_STATE_PREAMBLE, - MSTP_RECEIVE_STATE_HEADER, - MSTP_RECEIVE_STATE_HEADER_CRC, - MSTP_RECEIVE_STATE_DATA -} MSTP_RECEIVE_STATE; - -/* master node FSM states */ -typedef enum { - MSTP_MASTER_STATE_INITIALIZE, - MSTP_MASTER_STATE_IDLE, - MSTP_MASTER_STATE_USE_TOKEN, - MSTP_MASTER_STATE_WAIT_FOR_REPLY, - MSTP_MASTER_STATE_DONE_WITH_TOKEN, - MSTP_MASTER_STATE_PASS_TOKEN, - MSTP_MASTER_STATE_NO_TOKEN, - MSTP_MASTER_STATE_POLL_FOR_MASTER, - MSTP_MASTER_STATE_ANSWER_DATA_REQUEST -} MSTP_MASTER_STATE; - struct mstp_port_struct_t { MSTP_RECEIVE_STATE receive_state; /* When a master node is powered up or reset, */ @@ -205,14 +156,6 @@ struct mstp_port_struct_t { uint8_t TxFrameType; /* type of message - needed by MS/TP */ }; -#define DEFAULT_MAX_INFO_FRAMES 1 -#define DEFAULT_MAX_MASTER 127 - -/* The minimum time after the end of the stop bit of the final octet of a */ -/* received frame before a node may enable its EIA-485 driver: 40 bit times. */ -/* At 9600 baud, 40 bit times would be about 4.166 milliseconds */ -#define Tturnaround 40; - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ diff --git a/bacnet-stack/src/mstp.c b/bacnet-stack/src/mstp.c index a40ef681..d756804e 100644 --- a/bacnet-stack/src/mstp.c +++ b/bacnet-stack/src/mstp.c @@ -410,7 +410,6 @@ void MSTP_Receive_Frame_FSM( mstp_port->HeaderCRC); mstp_port->HeaderCRCActual = mstp_port->DataRegister; /* don't wait for next state - do it here */ - /* MSTP_RECEIVE_STATE_HEADER_CRC */ if (mstp_port->HeaderCRC != 0x55) { /* BadCRC */ /* indicate that an error has occurred during @@ -482,13 +481,6 @@ void MSTP_Receive_Frame_FSM( mstp_port->DataAvailable = false; } break; - /* In the HEADER_CRC state, the node validates the CRC on the fixed */ - /* message header. */ - case MSTP_RECEIVE_STATE_HEADER_CRC: - /* note: we should never get to this state since we shortcut - it earlier in the state machine, and never set this state */ - mstp_port->receive_state = MSTP_RECEIVE_STATE_IDLE; - break; /* In the DATA state, the node waits for the data portion of a frame. */ case MSTP_RECEIVE_STATE_DATA: /* Timeout */ diff --git a/bacnet-stack/src/mstptext.c b/bacnet-stack/src/mstptext.c index 7b3960b7..06aaaaa9 100644 --- a/bacnet-stack/src/mstptext.c +++ b/bacnet-stack/src/mstptext.c @@ -40,7 +40,6 @@ static INDTEXT_DATA mstp_receive_state_text[] = { {MSTP_RECEIVE_STATE_IDLE, "IDLE"}, {MSTP_RECEIVE_STATE_PREAMBLE, "PREAMBLE"}, {MSTP_RECEIVE_STATE_HEADER, "HEADER"}, - {MSTP_RECEIVE_STATE_HEADER_CRC, "HEADER_CRC"}, {MSTP_RECEIVE_STATE_DATA, "DATA"}, {0, NULL} };