Enhanced the MS/TP packet sniffer to allow configurable baud rate.
This commit is contained in:
@@ -155,7 +155,8 @@ int main(
|
||||
int rc = 0;
|
||||
unsigned long hThread = 0;
|
||||
uint32_t arg_value = 0;
|
||||
int my_mac = 127;
|
||||
long my_mac = 127;
|
||||
long my_baud = 38400;
|
||||
|
||||
/* mimic our pointer in the state machine */
|
||||
mstp_port = &MSTP_Port;
|
||||
@@ -164,13 +165,16 @@ int main(
|
||||
Network_Interface = argv[1];
|
||||
}
|
||||
if (argc > 2) {
|
||||
my_mac = strtol(argv[2], NULL, 0);
|
||||
my_baud = strtol(argv[2], NULL, 0);
|
||||
}
|
||||
if (argc > 3) {
|
||||
my_mac = strtol(argv[3], NULL, 0);
|
||||
if (my_mac > 127)
|
||||
my_mac = 127;
|
||||
}
|
||||
/* initialize our interface */
|
||||
RS485_Set_Interface(Network_Interface);
|
||||
RS485_Set_Baud_Rate(38400);
|
||||
RS485_Set_Baud_Rate(my_baud);
|
||||
RS485_Initialize();
|
||||
MSTP_Port.InputBuffer = &RxBuffer[0];
|
||||
MSTP_Port.InputBufferSize = sizeof(RxBuffer);
|
||||
|
||||
@@ -15,14 +15,14 @@ PRODUCT = rx_fsm
|
||||
PRODUCT_EXE = $(PRODUCT).exe
|
||||
|
||||
# Choose the Data Link Layer to Enable
|
||||
DEFINES = -DBACDL_MSTP
|
||||
DEFINES = -DBACDL_MSTP -DBACAPP_ALL -DPRINT_ENABLED=1 -DPRINT_ENABLED_RECEIVE_DATA=1
|
||||
|
||||
SRCS = rs485.c \
|
||||
rx_fsm.c \
|
||||
..\..\mstp.c \
|
||||
..\..\mstptext.c \
|
||||
..\..\indtext.c \
|
||||
..\..\crc.c
|
||||
..\..\src\mstp.c \
|
||||
..\..\src\mstptext.c \
|
||||
..\..\src\indtext.c \
|
||||
..\..\src\crc.c
|
||||
|
||||
OBJS = $(SRCS:.c=.obj)
|
||||
|
||||
@@ -38,7 +38,7 @@ TLIB = $(BORLAND_DIR)\bin\tlib
|
||||
# Include directories
|
||||
#
|
||||
CC_DIR = $(BORLAND_DIR)\BIN
|
||||
BACNET_INCL = ..\..\;..\..\demo\handler\;..\..\demo\object\;.
|
||||
BACNET_INCL = ..\..\include;.
|
||||
INCL_DIRS = -I$(BORLAND_DIR)\include;$(BACNET_INCL)
|
||||
|
||||
CFLAGS = $(INCL_DIRS) $(CS_FLAGS) $(DEFINES)
|
||||
|
||||
+11
-34
@@ -56,43 +56,20 @@
|
||||
#include "mstptext.h"
|
||||
#endif
|
||||
|
||||
/* debug print statements */
|
||||
#if PRINT_ENABLED
|
||||
#if !defined(PRINT_ENABLED_RECEIVE)
|
||||
#define PRINT_ENABLED_RECEIVE 0
|
||||
#define PRINT_ENABLED_RECEIVE_DATA 0
|
||||
#define PRINT_ENABLED_RECEIVE_ERRORS 1
|
||||
#define PRINT_ENABLED_MASTER 0
|
||||
#else
|
||||
#define PRINT_ENABLED_RECEIVE 0
|
||||
#define PRINT_ENABLED_RECEIVE_DATA 0
|
||||
#define PRINT_ENABLED_MASTER 0
|
||||
#endif
|
||||
|
||||
#if PRINT_ENABLED
|
||||
#define PRINT_DEBUG(x) \
|
||||
fprintf(stderr,x)
|
||||
#define PRINT_DEBUG1(fmt,v1) \
|
||||
fprintf(stderr,fmt,v1)
|
||||
#define PRINT_DEBUG2(fmt,v1,v2) \
|
||||
fprintf(stderr,fmt,v1,v2)
|
||||
#define PRINT_DEBUG3(fmt,v1,v2,v3) \
|
||||
fprintf(stderr,fmt,v1,v2,v3)
|
||||
#define PRINT_DEBUG4(fmt,v1,v2,v3,v4) \
|
||||
fprintf(stderr,fmt,v1,v2,v3,v4)
|
||||
#define PRINT_DEBUG5(fmt,v1,v2,v3,v4,v5) \
|
||||
fprintf(stderr,fmt,v1,v2,v3,v4,v5)
|
||||
#define PRINT_DEBUG6(fmt,v1,v2,v3,v4,v5,v6) \
|
||||
fprintf(stderr,fmt,v1,v2,v3,v4,v5,v6)
|
||||
#define PRINT_DEBUG7(fmt,v1,v2,v3,v4,v5,v6,v7) \
|
||||
fprintf(stderr,fmt,v1,v2,v3,v4,v5,v6,v7)
|
||||
#else
|
||||
#define PRINT_DEBUG(x)
|
||||
#define PRINT_DEBUG1(fmt,v1)
|
||||
#define PRINT_DEBUG2(fmt,v1,v2)
|
||||
#define PRINT_DEBUG3(fmt,v1,v2,v3)
|
||||
#define PRINT_DEBUG4(fmt,v1,v2,v3,v4)
|
||||
#define PRINT_DEBUG5(fmt,v1,v2,v3,v4,v5)
|
||||
#define PRINT_DEBUG6(fmt,v1,v2,v3,v4,v5,v6)
|
||||
#if !defined(PRINT_ENABLED_RECEIVE_DATA)
|
||||
#define PRINT_ENABLED_RECEIVE_DATA 0
|
||||
#endif
|
||||
|
||||
#if !defined(PRINT_ENABLED_RECEIVE_ERRORS)
|
||||
#define PRINT_ENABLED_RECEIVE_ERRORS 0
|
||||
#endif
|
||||
|
||||
#if !defined(PRINT_ENABLED_MASTER)
|
||||
#define PRINT_ENABLED_MASTER 0
|
||||
#endif
|
||||
|
||||
/* MS/TP Frame Format */
|
||||
|
||||
Reference in New Issue
Block a user