From e268569c5cea0bf6760047f24a7999e88b9c8cad Mon Sep 17 00:00:00 2001 From: skarg Date: Fri, 6 Aug 2010 22:01:48 +0000 Subject: [PATCH] Moved some constants from MS/TP source file to common header. --- bacnet-stack/include/mstpdef.h | 28 +++++++++++++++++++++++++++- bacnet-stack/src/mstp.c | 25 ------------------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/bacnet-stack/include/mstpdef.h b/bacnet-stack/include/mstpdef.h index dca2088e..067aa6f3 100644 --- a/bacnet-stack/include/mstpdef.h +++ b/bacnet-stack/include/mstpdef.h @@ -73,7 +73,8 @@ typedef enum { MSTP_RECEIVE_STATE_IDLE = 0, MSTP_RECEIVE_STATE_PREAMBLE = 1, MSTP_RECEIVE_STATE_HEADER = 2, - MSTP_RECEIVE_STATE_DATA = 3 + MSTP_RECEIVE_STATE_DATA = 3, + MSTP_RECEIVE_STATE_SKIP_DATA = 4 } MSTP_RECEIVE_STATE; /* master node FSM states */ @@ -105,6 +106,31 @@ typedef enum { #define Tturnaround (40UL) /* turnaround_time_milliseconds = (Tturnaround*1000UL)/RS485_Baud; */ +/* The number of tokens received or used before a Poll For Master cycle */ +/* is executed: 50. */ +#define Npoll 50 + +/* The number of retries on sending Token: 1. */ +#define Nretry_token 1 + +/* The maximum idle time a sending node may allow to elapse between octets */ +/* of a frame the node is transmitting: 20 bit times. */ +#define Tframe_gap 20 + +/* The maximum time after the end of the stop bit of the final */ +/* octet of a transmitted frame before a node must disable its */ +/* EIA-485 driver: 15 bit times. */ +#define Tpostdrive 15 + +/* The width of the time slot within which a node may generate a token: */ +/* 10 milliseconds. */ +#define Tslot 10 + +/* The maximum time a node may wait after reception of the token or */ +/* a Poll For Master frame before sending the first octet of a frame: */ +/* 15 milliseconds. */ +#define Tusage_delay 15 + #define DEFAULT_MAX_INFO_FRAMES 1 #define DEFAULT_MAX_MASTER 127 #define DEFAULT_MAC_ADDRESS 127 diff --git a/bacnet-stack/src/mstp.c b/bacnet-stack/src/mstp.c index 8d69ac5a..7a1fea4d 100644 --- a/bacnet-stack/src/mstp.c +++ b/bacnet-stack/src/mstp.c @@ -125,13 +125,6 @@ static inline void printf_master( /* least significant octet first */ /* (pad): (optional) at most one octet of padding: X'FF' */ -/* The number of tokens received or used before a Poll For Master cycle */ -/* is executed: 50. */ -#define Npoll 50 - -/* The number of retries on sending Token: 1. */ -#define Nretry_token 1 - /* The minimum number of DataAvailable or ReceiveError events that must be */ /* seen by a receiving node in order to declare the line "active": 4. */ #define Nmin_octets 4 @@ -144,15 +137,6 @@ static inline void printf_master( /* const uint16_t Tframe_abort = 1 + ((1000 * 60) / 9600); */ #define Tframe_abort 95 -/* The maximum idle time a sending node may allow to elapse between octets */ -/* of a frame the node is transmitting: 20 bit times. */ -#define Tframe_gap 20 - -/* The maximum time after the end of the stop bit of the final */ -/* octet of a transmitted frame before a node must disable its */ -/* EIA-485 driver: 15 bit times. */ -#define Tpostdrive 15 - /* The maximum time a node may wait after reception of a frame that expects */ /* a reply before sending the first octet of a reply or Reply Postponed */ /* frame: 250 milliseconds. */ @@ -165,15 +149,6 @@ static inline void printf_master( /* will enter the IDLE state: 29 bit times < Troff < 40 bit times. */ #define Troff 30 -/* The width of the time slot within which a node may generate a token: */ -/* 10 milliseconds. */ -#define Tslot 10 - -/* The maximum time a node may wait after reception of the token or */ -/* a Poll For Master frame before sending the first octet of a frame: */ -/* 15 milliseconds. */ -#define Tusage_delay 15 - /* The minimum time without a DataAvailable or ReceiveError event */ /* that a node must wait for a station to begin replying to a */ /* confirmed request: 255 milliseconds. (Implementations may use */