Updated makefiles and build scripts for Borland tools.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
@echo off
|
||||
echo Build for Borland 5.5 tools
|
||||
set BORLAND_DIR=c:\borland\bcc55
|
||||
%BORLAND_DIR%\bin\make -f makefile.b32 clean
|
||||
%BORLAND_DIR%\bin\make -f makefile.b32 all
|
||||
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
@echo off
|
||||
rem Build for Borland 5.5 tools
|
||||
rem set BORLAND_DIR=c:\borland\bcc55
|
||||
rem %BORLAND_DIR%\bin\make -f makefile.b32 clean
|
||||
rem %BORLAND_DIR%\bin\make -f makefile.b32 all
|
||||
|
||||
rem Build for MinGW
|
||||
echo Build with MinGW <http://mingw.sourceforge.net/>
|
||||
make BACNET_PORT=win32 OPTIMIZATION=-Os DEBUGGING= clean all
|
||||
rem Build for MinGW debug
|
||||
rem make BACNET_PORT=win32 clean all
|
||||
|
||||
@@ -35,7 +35,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -35,7 +35,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c \
|
||||
|
||||
@@ -54,6 +54,38 @@ static uint8_t RxBuffer[MAX_MPDU];
|
||||
static uint8_t TxBuffer[MAX_MPDU];
|
||||
static uint16_t SilenceTime;
|
||||
#define INCREMENT_AND_LIMIT_UINT16(x) {if (x < 0xFFFF) x++;}
|
||||
|
||||
#if defined (_WIN32)
|
||||
struct timespec {
|
||||
time_t tv_sec; /* Seconds */
|
||||
long tv_nsec; /* Nanoseconds [0 .. 999999999] */
|
||||
};
|
||||
|
||||
static int gettimeofday(
|
||||
struct timeval *tp,
|
||||
void *tzp)
|
||||
{
|
||||
struct _timeb timebuffer;
|
||||
|
||||
_ftime(&timebuffer);
|
||||
tp->tv_sec = timebuffer.time;
|
||||
tp->tv_usec = timebuffer.millitm * 1000;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nanosleep(
|
||||
const struct timespec *rqtp,
|
||||
struct timespec *rmtp)
|
||||
{
|
||||
DWORD dwMilliseconds = (rqtp->tv_sec * 1000) + (rqtp->tv_nsec / 1000);
|
||||
|
||||
Sleep(dwMilliseconds);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint16_t Timer_Silence(
|
||||
void)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -34,7 +34,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -34,7 +34,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -37,7 +37,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACFILE -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP -DCRC_USE_TABLE
|
||||
BACDL_DEFINE=-DBACDL_BIP
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -34,7 +34,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -34,7 +34,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -34,7 +34,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -34,7 +34,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -34,7 +34,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -34,7 +34,7 @@ INCLUDES = \
|
||||
#
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -47,7 +47,8 @@ void debug_printf(
|
||||
static void debug_printf(
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
{
|
||||
format=format;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ TLIB = $(BORLAND_DIR)\bin\tlib
|
||||
MAKE = $(BORLAND_DIR)\bin\make
|
||||
|
||||
BACNET_DEFINES = -DPRINT_ENABLED=1 -DBACFILE -DBACAPP_ALL
|
||||
#BACDL_DEFINE=-DBACDL_MSTP -DCRC_USE_TABLE
|
||||
#BACDL_DEFINE=-DBACDL_BIP
|
||||
BACDL_DEFINE=-DBACDL_BIP=1 -DUSE_INADDR=1
|
||||
DEFINES = $(BACNET_DEFINES) $(BACDL_DEFINE)
|
||||
|
||||
# directories
|
||||
@@ -112,10 +111,10 @@ OBJECT_SRC = $(BACNET_OBJECT)\device.c \
|
||||
$(BACNET_OBJECT)\bacfile.c
|
||||
|
||||
PORT_SRC = $(BACNET_PORT)\bip-init.c \
|
||||
$(BACNET_PORT)\dlmstp.c \
|
||||
$(BACNET_PORT)\rs485.c \
|
||||
$(BACNET_CORE)\mstp.c \
|
||||
$(BACNET_PORT)\dlmstp.c \
|
||||
$(BACNET_CORE)\crc.c \
|
||||
$(BACNET_CORE)\mstp.c \
|
||||
$(BACNET_CORE)\bvlc.c \
|
||||
$(BACNET_CORE)\bip.c
|
||||
|
||||
|
||||
@@ -273,6 +273,10 @@ SOURCE=..\..\..\src\mstp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\mstptext.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\demo\handler\noserv.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -461,6 +465,10 @@ SOURCE=..\..\..\include\mstp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\include\mstptext.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\include\npdu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -38,88 +38,16 @@
|
||||
#include <sys/timeb.h>
|
||||
#include <process.h>
|
||||
|
||||
#ifdef __MSC_VER
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#define inline __inline
|
||||
#endif
|
||||
|
||||
#define close closesocket
|
||||
|
||||
typedef int socklen_t;
|
||||
|
||||
typedef HANDLE sem_t;
|
||||
|
||||
#define sem_post(x) ReleaseSemaphore(*(x), 1, NULL)
|
||||
#define sem_close(x) CloseHandle(*(x))
|
||||
|
||||
struct timespec {
|
||||
time_t tv_sec; /* Seconds */
|
||||
long tv_nsec; /* Nanoseconds [0 .. 999999999] */
|
||||
};
|
||||
|
||||
|
||||
static inline int gettimeofday(
|
||||
struct timeval *tp,
|
||||
void *tzp)
|
||||
{
|
||||
struct _timeb timebuffer;
|
||||
|
||||
_ftime(&timebuffer);
|
||||
tp->tv_sec = timebuffer.time;
|
||||
tp->tv_usec = timebuffer.millitm * 1000;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: not a complete implementation of the posix function */
|
||||
static inline int sem_timedwait(
|
||||
sem_t * sem,
|
||||
const struct timespec *abs_timeout)
|
||||
{
|
||||
struct timeval tp;
|
||||
DWORD wait_status = 0;
|
||||
DWORD dwMilliseconds =
|
||||
(abs_timeout->tv_sec * 1000) + (abs_timeout->tv_nsec / 1000);
|
||||
|
||||
gettimeofday(&tp, NULL);
|
||||
if (abs_timeout->tv_sec >= tp.tv_sec) {
|
||||
dwMilliseconds = (abs_timeout->tv_sec - tp.tv_sec) * 1000;
|
||||
if (abs_timeout->tv_nsec >= (tp.tv_usec * 1000)) {
|
||||
dwMilliseconds +=
|
||||
((abs_timeout->tv_nsec - (tp.tv_usec * 1000)) / (1000 * 1000));
|
||||
}
|
||||
} else {
|
||||
dwMilliseconds = 0;
|
||||
}
|
||||
|
||||
wait_status = WaitForSingleObject(*sem, dwMilliseconds);
|
||||
if (wait_status == WAIT_OBJECT_0) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline int sem_init(
|
||||
sem_t * sem,
|
||||
int pshared,
|
||||
unsigned int value)
|
||||
{
|
||||
(void) pshared;
|
||||
*sem = CreateSemaphore(NULL /*lpSecurityDescriptor */ ,
|
||||
value /* lInitialCount */ ,
|
||||
1 /* lMaximumCount */ ,
|
||||
NULL /* lpName */ );
|
||||
if ((*sem) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int nanosleep(
|
||||
const struct timespec *rqtp,
|
||||
struct timespec *rmtp)
|
||||
{
|
||||
DWORD dwMilliseconds = (rqtp->tv_sec * 1000) + (rqtp->tv_nsec / 1000);
|
||||
|
||||
Sleep(dwMilliseconds);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mstp.h"
|
||||
#include "net.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -72,6 +72,7 @@ static inline void printf_receive(
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
format=format;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -82,6 +83,7 @@ static inline void printf_receive_data(
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
format=format;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -92,6 +94,7 @@ static inline void printf_receive_error(
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
format=format;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -102,6 +105,7 @@ static inline void printf_master(
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
format=format;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user