Corrected the MS/TP monitor on Linux.
This commit is contained in:
@@ -226,6 +226,7 @@ void RS485_Initialize(
|
|||||||
{
|
{
|
||||||
struct termios newtio;
|
struct termios newtio;
|
||||||
|
|
||||||
|
printf("RS485: Initializing %s", RS485_Port_Name);
|
||||||
/*
|
/*
|
||||||
Open device for reading and writing.
|
Open device for reading and writing.
|
||||||
*/
|
*/
|
||||||
@@ -264,6 +265,7 @@ void RS485_Initialize(
|
|||||||
tcsetattr(RS485_Handle, TCSAFLUSH, &newtio);
|
tcsetattr(RS485_Handle, TCSAFLUSH, &newtio);
|
||||||
/* destructor */
|
/* destructor */
|
||||||
atexit(RS485_Cleanup);
|
atexit(RS485_Cleanup);
|
||||||
|
printf("=success!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST_RS485
|
#ifdef TEST_RS485
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ int main(
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
pthread_t hThread;
|
pthread_t hThread;
|
||||||
int my_mac = 127;
|
int my_mac = 127;
|
||||||
|
long my_baud = 38400;
|
||||||
|
|
||||||
/* mimic our pointer in the state machine */
|
/* mimic our pointer in the state machine */
|
||||||
mstp_port = &MSTP_Port;
|
mstp_port = &MSTP_Port;
|
||||||
@@ -192,11 +193,14 @@ int main(
|
|||||||
RS485_Set_Interface(argv[1]);
|
RS485_Set_Interface(argv[1]);
|
||||||
}
|
}
|
||||||
if (argc > 2) {
|
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)
|
if (my_mac > 127)
|
||||||
my_mac = 127;
|
my_mac = 127;
|
||||||
}
|
}
|
||||||
RS485_Set_Baud_Rate(38400);
|
RS485_Set_Baud_Rate(my_baud);
|
||||||
RS485_Initialize();
|
RS485_Initialize();
|
||||||
MSTP_Port.InputBuffer = &RxBuffer[0];
|
MSTP_Port.InputBuffer = &RxBuffer[0];
|
||||||
MSTP_Port.InputBufferSize = sizeof(RxBuffer);
|
MSTP_Port.InputBufferSize = sizeof(RxBuffer);
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
#Makefile to build test case
|
#Makefile to build test case
|
||||||
CC = gcc
|
CC = gcc
|
||||||
BASEDIR = .
|
SRCDIR = ../../src
|
||||||
|
INCDIR = ../../include
|
||||||
# -g for debugging with gdb
|
# -g for debugging with gdb
|
||||||
DEFINES = -DBIG_ENDIAN=0 -DBACDL_MSTP=1
|
DEFINES = -DBIG_ENDIAN=0 -DBACDL_MSTP=1
|
||||||
INCLUDES = -I. -I../../
|
INCLUDES = -I. -I$(INCDIR)
|
||||||
CFLAGS = -Wall $(INCLUDES) $(DEFINES) -g
|
CFLAGS = -Wall $(INCLUDES) $(DEFINES) -g
|
||||||
|
|
||||||
SRCS = rs485.c \
|
SRCS = rs485.c \
|
||||||
rx_fsm.c \
|
rx_fsm.c \
|
||||||
../../mstp.c \
|
$(SRCDIR)/mstp.c \
|
||||||
../../mstptext.c \
|
$(SRCDIR)/mstptext.c \
|
||||||
../../indtext.c \
|
$(SRCDIR)/indtext.c \
|
||||||
../../crc.c
|
$(SRCDIR)/crc.c
|
||||||
|
|
||||||
OBJS = ${SRCS:.c=.o}
|
OBJS = ${SRCS:.c=.o}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user