Fixing Makefile build for bip6 with win32 MinGW and in github workflows. (#1125)
This commit is contained in:
@@ -277,18 +277,19 @@ jobs:
|
|||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
sudo apt-get install -qq build-essential
|
sudo apt-get install -qq build-essential
|
||||||
sudo apt-get install -qq mingw-w64
|
sudo apt-get install -qq mingw-w64
|
||||||
- name: Build Win32 Demo Apps
|
|
||||||
run: |
|
|
||||||
export CC=i686-w64-mingw32-gcc
|
|
||||||
export LD=i686-w64-mingw32-ld
|
|
||||||
i686-w64-mingw32-gcc --version
|
i686-w64-mingw32-gcc --version
|
||||||
make win32
|
- name: Build Win32 Demo BACnet/IP Apps
|
||||||
|
run: make PREFIX=i686-w64-mingw32- LEGACY=true BACNET_PORT=win32 clean bip
|
||||||
|
- name: Build Win32 Demo BACnet/IPv6 Apps
|
||||||
|
run: make PREFIX=i686-w64-mingw32- LEGACY=true BACNET_PORT=win32 clean bip6
|
||||||
|
- name: Build Win32 Demo BACnet MS/TP Apps
|
||||||
|
run: make PREFIX=i686-w64-mingw32- LEGACY=true BACNET_PORT=win32 clean mstp
|
||||||
- name: Build Win32 Demo IP to IPv6 Router
|
- name: Build Win32 Demo IP to IPv6 Router
|
||||||
run: make LEGACY=true BUILD=win32 router-ipv6
|
run: make PREFIX=i686-w64-mingw32- LEGACY=true BACNET_PORT=win32 clean router-ipv6
|
||||||
- name: Build Win32 Demo IP to MS/TP Router
|
- name: Build Win32 Demo IP to MS/TP Router
|
||||||
run: make LEGACY=true BUILD=win32 router-mstp
|
run: make PREFIX=i686-w64-mingw32- LEGACY=true BACNET_PORT=win32 clean router-mstp
|
||||||
- name: Build Win32 Demo Gateway
|
- name: Build Win32 Demo Gateway
|
||||||
run: make LEGACY=true BUILD=win32 gateway
|
run: make PREFIX=i686-w64-mingw32- LEGACY=true BACNET_PORT=win32 clean gateway
|
||||||
|
|
||||||
piface:
|
piface:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -11,22 +11,16 @@ all: apps
|
|||||||
|
|
||||||
.PHONY: bsd
|
.PHONY: bsd
|
||||||
bsd:
|
bsd:
|
||||||
$(MAKE) BACNET_PORT=bsd -s -C apps all
|
$(MAKE) LEGACY=true BACNET_PORT=bsd -s -C apps all
|
||||||
|
|
||||||
.PHONY: win32
|
.PHONY: win32
|
||||||
win32:
|
win32:
|
||||||
$(MAKE) BACNET_PORT=win32 -s -C apps all
|
$(MAKE) LEGACY=true BACNET_PORT=win32 -s -C apps all
|
||||||
|
|
||||||
.PHONY: mingw32
|
.PHONY: mingw32
|
||||||
mingw32:
|
mingw32:
|
||||||
i686-w64-mingw32-gcc --version
|
i686-w64-mingw32-gcc --version
|
||||||
ORIGINAL_CC=$(CC) ; \
|
$(MAKE) PREFIX=i686-w64-mingw32- BACNET_PORT=win32 LEGACY=true BACDL=bip6 -s -C apps all
|
||||||
ORIGINAL_LD=$(LD) ; \
|
|
||||||
export CC=i686-w64-mingw32-gcc ; \
|
|
||||||
export LD=i686-w64-mingw32-ld ; \
|
|
||||||
$(MAKE) BACNET_PORT=win32 LEGACY=true -s -C apps all ; \
|
|
||||||
export CC=$(ORIGINAL_CC) ; \
|
|
||||||
export LD=$(ORIGINAL_LD)
|
|
||||||
|
|
||||||
.PHONY: mstpwin32-clean
|
.PHONY: mstpwin32-clean
|
||||||
mstpwin32-clean:
|
mstpwin32-clean:
|
||||||
@@ -40,25 +34,25 @@ mstpwin32:
|
|||||||
mstp:
|
mstp:
|
||||||
$(MAKE) BACDL=mstp -s -C apps all
|
$(MAKE) BACDL=mstp -s -C apps all
|
||||||
|
|
||||||
.PHONY: bip6-win32
|
.PHONY: mingw32-bip6
|
||||||
bip6-win32:
|
mingw32-bip6:
|
||||||
$(MAKE) BACDL=bip6 BACNET_PORT=win32 -s -C apps all
|
$(MAKE) PREFIX=i686-w64-mingw32- BACNET_PORT=win32 LEGACY=true BACDL=bip6 -s -C apps all
|
||||||
|
|
||||||
.PHONY: bip6
|
.PHONY: bip6
|
||||||
bip6:
|
bip6:
|
||||||
$(MAKE) BACDL=bip6 -s -C apps all
|
$(MAKE) LEGACY=true BACDL=bip6 -s -C apps all
|
||||||
|
|
||||||
.PHONY: bip
|
.PHONY: bip
|
||||||
bip:
|
bip:
|
||||||
$(MAKE) BACDL=bip -s -C apps all
|
$(MAKE) LEGACY=true BACDL=bip -s -C apps all
|
||||||
|
|
||||||
.PHONY: bip-client
|
.PHONY: bip-client
|
||||||
bip-client:
|
bip-client:
|
||||||
$(MAKE) BACDL=bip BBMD=client -s -C apps all
|
$(MAKE) LEGACY=true BACDL=bip BBMD=client -s -C apps all
|
||||||
|
|
||||||
.PHONY: ethernet
|
.PHONY: ethernet
|
||||||
ethernet:
|
ethernet:
|
||||||
$(MAKE) BACDL=ethernet -s -C apps all
|
$(MAKE) LEGACY=true BACDL=ethernet -s -C apps all
|
||||||
|
|
||||||
# note: requires additional libraries to be installed
|
# note: requires additional libraries to be installed
|
||||||
# see .github/workflows/gcc.yml
|
# see .github/workflows/gcc.yml
|
||||||
|
|||||||
+48
-19
@@ -1,11 +1,15 @@
|
|||||||
# tools - only if you need them.
|
|
||||||
# Most platforms have this already defined
|
|
||||||
# CC = gcc
|
|
||||||
# AR = ar
|
|
||||||
# MAKE = make
|
|
||||||
# SIZE = size
|
|
||||||
#
|
#
|
||||||
# Assumes rm and cp are available
|
# Set PREFIX to prepend to GCC compiler tools for cross-compilation.
|
||||||
|
# Assumes rm and cp are natively available
|
||||||
|
#
|
||||||
|
PREFIX ?=
|
||||||
|
CC = $(PREFIX)gcc
|
||||||
|
AR = $(PREFIX)ar
|
||||||
|
RANLIB = $(PREFIX)ranlib
|
||||||
|
NM = $(PREFIX)nm
|
||||||
|
SIZE = $(PREFIX)size
|
||||||
|
OBJCOPY = $(PREFIX)objcopy
|
||||||
|
OBJDUMP = $(PREFIX)objdump
|
||||||
|
|
||||||
# Passing parameters via command line or from Makefile export to this one
|
# Passing parameters via command line or from Makefile export to this one
|
||||||
BACNET_DEFINES ?=
|
BACNET_DEFINES ?=
|
||||||
@@ -20,6 +24,9 @@ BACNET_LIB ?= -L$(BACNET_LIB_DIR) -l$(BACNET_LIB_NAME)
|
|||||||
# Use BACDL=mstp or BACDL=bip and BBMD=server when invoking make
|
# Use BACDL=mstp or BACDL=bip and BBMD=server when invoking make
|
||||||
|
|
||||||
ifeq (${BACDL_DEFINE},)
|
ifeq (${BACDL_DEFINE},)
|
||||||
|
ifeq (${BACDL},)
|
||||||
|
BACDL = bip
|
||||||
|
endif
|
||||||
ifeq (${BACDL},ethernet)
|
ifeq (${BACDL},ethernet)
|
||||||
BACDL_DEFINE=-DBACDL_ETHERNET=1
|
BACDL_DEFINE=-DBACDL_ETHERNET=1
|
||||||
endif
|
endif
|
||||||
@@ -39,6 +46,9 @@ ifeq (${BACDL},bsc)
|
|||||||
BACDL_DEFINE=-DBACDL_BSC=1
|
BACDL_DEFINE=-DBACDL_BSC=1
|
||||||
BACNET_DEFINE=-DBACFILE=1
|
BACNET_DEFINE=-DBACFILE=1
|
||||||
endif
|
endif
|
||||||
|
ifeq (${BACDL},zigbee)
|
||||||
|
BACDL_DEFINE=-DBACDL_ZIGBEE=1
|
||||||
|
endif
|
||||||
ifeq (${BACDL},none)
|
ifeq (${BACDL},none)
|
||||||
BACDL_DEFINE=-DBACDL_NONE=1
|
BACDL_DEFINE=-DBACDL_NONE=1
|
||||||
endif
|
endif
|
||||||
@@ -51,11 +61,11 @@ endif
|
|||||||
ifeq (${BACDL},all)
|
ifeq (${BACDL},all)
|
||||||
BACDL_DEFINE=-DBACDL_ALL=1
|
BACDL_DEFINE=-DBACDL_ALL=1
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL},)
|
|
||||||
BACDL_DEFINE ?= -DBACDL_BIP=1
|
|
||||||
BBMD_DEFINE ?= -DBBMD_ENABLED=1 -DBBMD_CLIENT_ENABLED
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
ifneq (,$(filter $(BACDL),bip all))
|
||||||
|
ifeq (${BBMD},)
|
||||||
|
BBMD=full
|
||||||
|
endif
|
||||||
ifeq (${BBMD},none)
|
ifeq (${BBMD},none)
|
||||||
BBMD_DEFINE = -DBBMD_ENABLED=0
|
BBMD_DEFINE = -DBBMD_ENABLED=0
|
||||||
endif
|
endif
|
||||||
@@ -68,7 +78,25 @@ endif
|
|||||||
ifeq (${BBMD},full)
|
ifeq (${BBMD},full)
|
||||||
BBMD_DEFINE = -DBBMD_ENABLED=1 -DBBMD_CLIENT_ENABLED
|
BBMD_DEFINE = -DBBMD_ENABLED=1 -DBBMD_CLIENT_ENABLED
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(filter $(BACDL),bip6 all))
|
||||||
|
ifeq (${BBMD6},)
|
||||||
|
BBMD6=client
|
||||||
|
endif
|
||||||
|
ifeq (${BBMD6},none)
|
||||||
|
BBMD_DEFINE = -DBBMD6_ENABLED=0
|
||||||
|
endif
|
||||||
|
ifeq (${BBMD6},server)
|
||||||
|
BBMD_DEFINE = -DBBMD6_ENABLED=1
|
||||||
|
endif
|
||||||
|
ifeq (${BBMD6},client)
|
||||||
|
BBMD_DEFINE = -DBBMD6_ENABLED=0 -DBBMD6_CLIENT_ENABLED
|
||||||
|
endif
|
||||||
|
ifeq (${BBMD6},full)
|
||||||
|
BBMD_DEFINE = -DBBMD6_ENABLED=1 -DBBMD6_CLIENT_ENABLED
|
||||||
|
endif
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define WEAK_FUNC for unsupported or specific compilers
|
# Define WEAK_FUNC for unsupported or specific compilers
|
||||||
@@ -175,7 +203,7 @@ WARNINGS ?= $(WARNING_ALL)
|
|||||||
ifeq (${BUILD},debug)
|
ifeq (${BUILD},debug)
|
||||||
OPTIMIZATION = -O0
|
OPTIMIZATION = -O0
|
||||||
DEBUGGING = -g -DDEBUG_ENABLED=1
|
DEBUGGING = -g -DDEBUG_ENABLED=1
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_BIP=1)
|
ifeq (${BACDL},bip)
|
||||||
BACNET_DEFINES += -DBIP_DEBUG
|
BACNET_DEFINES += -DBIP_DEBUG
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@@ -226,16 +254,16 @@ SUBDIRS = lib readprop writeprop readfile writefile reinit server dcc \
|
|||||||
who-am-i you-are apdu writegroup \
|
who-am-i you-are apdu writegroup \
|
||||||
delete-object server-discover server-basic server-mini
|
delete-object server-discover server-basic server-mini
|
||||||
|
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_BIP=1)
|
ifneq (,$(filter $(BACDL),bip all))
|
||||||
SUBDIRS += whoisrouter iamrouter initrouter whatisnetnum netnumis
|
SUBDIRS += whoisrouter iamrouter initrouter whatisnetnum netnumis
|
||||||
ifneq (${BBMD},none)
|
ifneq (${BBMD},none)
|
||||||
SUBDIRS += readbdt readfdt writebdt
|
SUBDIRS += readbdt readfdt writebdt
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq (${BACNET_PORT},linux)
|
ifeq (${BACNET_PORT},linux)
|
||||||
ifneq (${OSTYPE},cygwin)
|
ifneq (${OSTYPE},cygwin)
|
||||||
SUBDIRS += mstpcap mstpcrc
|
SUBDIRS += mstpcap mstpcrc
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -274,6 +302,7 @@ TARGETS = all clean
|
|||||||
$(TARGETS): %: $(patsubst %, %.%, $(SUBDIRS))
|
$(TARGETS): %: $(patsubst %, %.%, $(SUBDIRS))
|
||||||
|
|
||||||
$(foreach TGT, $(TARGETS), $(patsubst %, %.$(TGT), $(SUBDIRS))):
|
$(foreach TGT, $(TARGETS), $(patsubst %, %.$(TGT), $(SUBDIRS))):
|
||||||
|
$(info recipe: $@...)
|
||||||
$(MAKE) -C $(subst ., , $@)
|
$(MAKE) -C $(subst ., , $@)
|
||||||
|
|
||||||
.PHONY: lib
|
.PHONY: lib
|
||||||
@@ -283,7 +312,7 @@ $(BACNET_LIB_TARGET):
|
|||||||
$(MAKE) -B -C lib
|
$(MAKE) -B -C lib
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(MAKE) -C lib clean
|
$(MAKE) BACDL=all -C lib clean
|
||||||
|
|
||||||
.PHONY: gateway
|
.PHONY: gateway
|
||||||
gateway: $(BACNET_LIB_TARGET)
|
gateway: $(BACNET_LIB_TARGET)
|
||||||
|
|||||||
+13
-11
@@ -95,37 +95,38 @@ PORT_ALL_SRC = \
|
|||||||
PORT_NONE_SRC = \
|
PORT_NONE_SRC = \
|
||||||
$(BACNET_SRC_DIR)/bacnet/datalink/datalink.c
|
$(BACNET_SRC_DIR)/bacnet/datalink/datalink.c
|
||||||
|
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_BIP=1)
|
$(info $(BACNET_LIB_TARGET) datalink $(BACDL))
|
||||||
|
ifeq ($(BACDL),bip)
|
||||||
BACNET_PORT_SRC = ${PORT_BIP_SRC} ${APPS_ENVIRONMENT_SRC}
|
BACNET_PORT_SRC = ${PORT_BIP_SRC} ${APPS_ENVIRONMENT_SRC}
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_BIP6=1)
|
ifeq ($(BACDL),bip6)
|
||||||
BACNET_PORT_SRC = ${PORT_BIP6_SRC} ${APPS_ENVIRONMENT_SRC}
|
BACNET_PORT_SRC = ${PORT_BIP6_SRC} ${APPS_ENVIRONMENT_SRC}
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_MSTP=1)
|
ifeq ($(BACDL),mstp)
|
||||||
BACNET_PORT_SRC = ${PORT_MSTP_SRC} ${APPS_ENVIRONMENT_SRC}
|
BACNET_PORT_SRC = ${PORT_MSTP_SRC} ${APPS_ENVIRONMENT_SRC}
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_ARCNET=1)
|
ifeq ($(BACDL),arcnet)
|
||||||
BACNET_PORT_SRC = ${PORT_ARCNET_SRC} ${APPS_ENVIRONMENT_SRC}
|
BACNET_PORT_SRC = ${PORT_ARCNET_SRC} ${APPS_ENVIRONMENT_SRC}
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_ETHERNET=1)
|
ifeq ($(BACDL),ethernet)
|
||||||
BACNET_PORT_SRC = ${PORT_ETHERNET_SRC} ${APPS_ENVIRONMENT_SRC}
|
BACNET_PORT_SRC = ${PORT_ETHERNET_SRC} ${APPS_ENVIRONMENT_SRC}
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_ZIGBEE=1)
|
ifeq ($(BACDL),zigbee)
|
||||||
BACNET_PORT_SRC = ${PORT_ZIGBEE_SRC} ${APPS_ENVIRONMENT_SRC}
|
BACNET_PORT_SRC = ${PORT_ZIGBEE_SRC} ${APPS_ENVIRONMENT_SRC}
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_NONE=1)
|
ifeq ($(BACDL),none)
|
||||||
BACNET_PORT_SRC = ${PORT_NONE_SRC}
|
BACNET_PORT_SRC = ${PORT_NONE_SRC}
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_BSC=1)
|
ifeq ($(BACDL),bsc)
|
||||||
BACNET_PORT_SRC = ${PORT_BSC_SRC} ${APPS_ENVIRONMENT_SRC}
|
BACNET_PORT_SRC = ${PORT_BSC_SRC} ${APPS_ENVIRONMENT_SRC}
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL_DEFINE},-DBACDL_ALL=1)
|
ifeq ($(BACDL),all)
|
||||||
BACNET_PORT_SRC = ${PORT_ALL_SRC}
|
BACNET_PORT_SRC = ${PORT_ALL_SRC}
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL},bip-mstp)
|
ifeq ($(BACDL),bip-mstp)
|
||||||
BACNET_PORT_SRC = ${PORT_BIP_SRC} ${PORT_MSTP_SRC}
|
BACNET_PORT_SRC = ${PORT_BIP_SRC} ${PORT_MSTP_SRC}
|
||||||
endif
|
endif
|
||||||
ifeq (${BACDL},bip-bip6)
|
ifeq ($(BACDL),bip-bip6)
|
||||||
BACNET_PORT_SRC = ${PORT_BIP_SRC} ${PORT_BIP6_SRC}
|
BACNET_PORT_SRC = ${PORT_BIP_SRC} ${PORT_BIP6_SRC}
|
||||||
endif
|
endif
|
||||||
ifneq (${BACDL_DEFINE},)
|
ifneq (${BACDL_DEFINE},)
|
||||||
@@ -170,6 +171,7 @@ all: $(BACNET_LIB_TARGET)
|
|||||||
lib: $(BACNET_LIB_TARGET)
|
lib: $(BACNET_LIB_TARGET)
|
||||||
|
|
||||||
$(BACNET_LIB_TARGET): $(OBJS) Makefile
|
$(BACNET_LIB_TARGET): $(OBJS) Makefile
|
||||||
|
$(info $(BACNET_LIB_TARGET) SRCS: $(notdir $(SRCS)))
|
||||||
${AR} rcs $@ $(OBJS)
|
${AR} rcs $@ $(OBJS)
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ all: ${BACNET_LIB_TARGET} Makefile ${TARGET_BIN}
|
|||||||
|
|
||||||
${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET}
|
${TARGET_BIN}: ${OBJS} Makefile ${BACNET_LIB_TARGET}
|
||||||
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
${CC} ${PFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||||
size $@
|
${SIZE} $@
|
||||||
cp $@ ../../bin
|
cp $@ ../../bin
|
||||||
|
|
||||||
${BACNET_LIB_TARGET}:
|
${BACNET_LIB_TARGET}:
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ rem assumes rm, cp, size are already in path
|
|||||||
set CC=mingw32-gcc.exe
|
set CC=mingw32-gcc.exe
|
||||||
set AR=mingw32-gcc-ar.exe
|
set AR=mingw32-gcc-ar.exe
|
||||||
set NM=mingw32-gcc-nm.exe
|
set NM=mingw32-gcc-nm.exe
|
||||||
set NM=mingw32-gcc-nm.exe
|
|
||||||
set OBJCOPY=objcopy.exe
|
set OBJCOPY=objcopy.exe
|
||||||
set SIZE=size.exe
|
set SIZE=size.exe
|
||||||
set MAKE=mingw32-make.exe
|
set MAKE=mingw32-make.exe
|
||||||
|
|||||||
@@ -0,0 +1,129 @@
|
|||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief Provides port specific functions for ARCNET
|
||||||
|
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||||
|
* @date October 2025
|
||||||
|
* @copyright SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "bacnet/bacdef.h"
|
||||||
|
#include "bacnet/npdu.h"
|
||||||
|
#include "bacnet/datalink/arcnet.h"
|
||||||
|
|
||||||
|
/* my local device data - MAC address */
|
||||||
|
uint8_t ARCNET_MAC_Address = 0;
|
||||||
|
/* ARCNET file handle */
|
||||||
|
static int ARCNET_Sock_FD = -1;
|
||||||
|
/* Broadcast address */
|
||||||
|
#define ARCNET_BROADCAST 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
Hints:
|
||||||
|
|
||||||
|
When using a PCI20-485D ARCNET card from Contemporary Controls,
|
||||||
|
you might need to know about the following settings:
|
||||||
|
|
||||||
|
Assuming a 20MHz clock on the COM20020 chip:
|
||||||
|
|
||||||
|
clockp Clock Prescaler DataRate
|
||||||
|
------ --------------- --------
|
||||||
|
0 8 2.5 Mbps
|
||||||
|
1 16 1.25 Mbps
|
||||||
|
2 32 625 Kbps
|
||||||
|
3 64 312.5 Kbps
|
||||||
|
4 128 156.25Kbps
|
||||||
|
|
||||||
|
1. Install the arcnet driver and arcnet raw mode driver
|
||||||
|
2. The hardware address (MAC address) is set using the dipswitch
|
||||||
|
on the back of the card. 0 is broadcast, so don't use 0.
|
||||||
|
3. The backplane mode on the PCI20-485D card is done in hardware,
|
||||||
|
so the driver does not need to do backplane mode. If you
|
||||||
|
use another type of PCI20 card, you could pass in backplane=1 or
|
||||||
|
backplane=0 as an option to the modprobe of com20020_pci.
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool arcnet_valid(void)
|
||||||
|
{
|
||||||
|
return (ARCNET_Sock_FD >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void arcnet_cleanup(void)
|
||||||
|
{
|
||||||
|
if (arcnet_valid()) {
|
||||||
|
/* close the interface */
|
||||||
|
}
|
||||||
|
ARCNET_Sock_FD = -1;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool arcnet_init(char *interface_name)
|
||||||
|
{
|
||||||
|
(void)interface_name;
|
||||||
|
return arcnet_valid();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* function to send a PDU out the socket */
|
||||||
|
/* returns number of bytes sent on success, negative on failure */
|
||||||
|
int arcnet_send_pdu(
|
||||||
|
BACNET_ADDRESS *dest, /* destination address */
|
||||||
|
BACNET_NPDU_DATA *npdu_data, /* network information */
|
||||||
|
uint8_t *pdu, /* any data to be sent - may be null */
|
||||||
|
unsigned pdu_len)
|
||||||
|
{
|
||||||
|
int bytes = 0;
|
||||||
|
|
||||||
|
(void)dest;
|
||||||
|
(void)npdu_data;
|
||||||
|
(void)pdu;
|
||||||
|
(void)pdu_len;
|
||||||
|
|
||||||
|
return bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* receives an framed packet */
|
||||||
|
/* returns the number of octets in the PDU, or zero on failure */
|
||||||
|
uint16_t arcnet_receive(
|
||||||
|
BACNET_ADDRESS *src, /* source address */
|
||||||
|
uint8_t *pdu, /* PDU data */
|
||||||
|
uint16_t pdu_size, /* amount of space available in the PDU */
|
||||||
|
unsigned timeout)
|
||||||
|
{
|
||||||
|
(void)src;
|
||||||
|
(void)pdu;
|
||||||
|
(void)timeout;
|
||||||
|
(void)pdu_size;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void arcnet_get_my_address(BACNET_ADDRESS *my_address)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
my_address->mac_len = 1;
|
||||||
|
my_address->mac[0] = ARCNET_MAC_Address;
|
||||||
|
my_address->net = 0; /* DNET=0 is local only, no routing */
|
||||||
|
my_address->len = 0;
|
||||||
|
for (i = 0; i < MAX_MAC_LEN; i++) {
|
||||||
|
my_address->adr[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void arcnet_get_broadcast_address(BACNET_ADDRESS *dest)
|
||||||
|
{ /* destination address */
|
||||||
|
int i = 0; /* counter */
|
||||||
|
|
||||||
|
if (dest) {
|
||||||
|
dest->mac[0] = ARCNET_BROADCAST;
|
||||||
|
dest->mac_len = 1;
|
||||||
|
dest->net = BACNET_BROADCAST_NETWORK;
|
||||||
|
dest->len = 0; /* always zero when DNET is broadcast */
|
||||||
|
for (i = 0; i < MAX_MAC_LEN; i++) {
|
||||||
|
dest->adr[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
# Assumes rm and cp are available
|
# Assumes rm and cp are available
|
||||||
|
|
||||||
CFLAGS += -Dbacnet_stack_EXPORTS
|
CFLAGS += -DBACNET_STACK_EXPORTS
|
||||||
|
|
||||||
ifeq ($(STATIC),1)
|
ifeq ($(STATIC),1)
|
||||||
CFLAGS += -DBACNET_STACK_STATIC_DEFINE
|
CFLAGS += -DBACNET_STACK_STATIC_DEFINE
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ static void bbmd6_send_pdu_bdt(uint8_t *mtu, unsigned int mtu_len)
|
|||||||
|
|
||||||
if (mtu) {
|
if (mtu) {
|
||||||
bip6_get_addr(&my_addr);
|
bip6_get_addr(&my_addr);
|
||||||
for (i = 0; i < MAX_BBMD_ENTRIES; i++) {
|
for (i = 0; i < MAX_BBMD6_ENTRIES; i++) {
|
||||||
if (BBMD_Table[i].valid) {
|
if (BBMD_Table[i].valid) {
|
||||||
if (bvlc6_address_different(
|
if (bvlc6_address_different(
|
||||||
&my_addr, &BBMD_Table[i].bip6_address)) {
|
&my_addr, &BBMD_Table[i].bip6_address)) {
|
||||||
@@ -391,7 +391,7 @@ static void bbmd6_send_pdu_fdt(uint8_t *mtu, unsigned int mtu_len)
|
|||||||
|
|
||||||
if (mtu) {
|
if (mtu) {
|
||||||
bip6_get_addr(&my_addr);
|
bip6_get_addr(&my_addr);
|
||||||
for (i = 0; i < MAX_FD_ENTRIES; i++) {
|
for (i = 0; i < MAX_FD6_ENTRIES; i++) {
|
||||||
if (FD_Table[i].valid) {
|
if (FD_Table[i].valid) {
|
||||||
if (bvlc6_address_different(
|
if (bvlc6_address_different(
|
||||||
&my_addr, &FD_Table[i].bip6_address)) {
|
&my_addr, &FD_Table[i].bip6_address)) {
|
||||||
@@ -401,46 +401,6 @@ static void bbmd6_send_pdu_fdt(uint8_t *mtu, unsigned int mtu_len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The Forward NPDU send function for Broadcast Distribution Table
|
|
||||||
*
|
|
||||||
* @param addr - Points to a #BACNET_IP6_ADDRESS structure containing the
|
|
||||||
* source IPv6 address.
|
|
||||||
* @param vmac_src - Source-Virtual-Address
|
|
||||||
* @param npdu - the bytes of NPDU+APDU data to send
|
|
||||||
* @param npdu_len - the number of bytes of NPDU+APDU data to send
|
|
||||||
*/
|
|
||||||
static void bbmd6_send_forward_npdu(
|
|
||||||
BACNET_IP6_ADDRESS *address,
|
|
||||||
uint32_t vmac_src,
|
|
||||||
uint8_t *npdu,
|
|
||||||
unsigned int npdu_len)
|
|
||||||
{
|
|
||||||
uint8_t mtu[BIP6_MPDU_MAX] = { 0 };
|
|
||||||
uint16_t mtu_len = 0;
|
|
||||||
unsigned i = 0; /* loop counter */
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_BBMD_ENTRIES; i++) {
|
|
||||||
if (BBMD_Table[i].valid) {
|
|
||||||
if (bbmd6_address_match_self(&BBMD_Table[i].bip6_address)) {
|
|
||||||
/* don't forward to our selves */
|
|
||||||
} else {
|
|
||||||
bip6_send_mpdu(&BBMD_Table[i].bip6_address, mtu, mtu_len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (i = 0; i < MAX_FD_ENTRIES; i++) {
|
|
||||||
if (FD_Table[i].valid) {
|
|
||||||
if (bbmd6_address_match_self(&FD_Table[i].bip6_address)) {
|
|
||||||
/* don't forward to our selves */
|
|
||||||
} else {
|
|
||||||
bip6_send_mpdu(&FD_Table[i].bip6_address, mtu, mtu_len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -840,10 +800,8 @@ int bvlc6_bbmd_enabled_handler(
|
|||||||
uint16_t mtu_len)
|
uint16_t mtu_len)
|
||||||
{
|
{
|
||||||
uint16_t result_code = BVLC6_RESULT_SUCCESSFUL_COMPLETION;
|
uint16_t result_code = BVLC6_RESULT_SUCCESSFUL_COMPLETION;
|
||||||
uint32_t vmac_me = 0;
|
|
||||||
uint32_t vmac_src = 0;
|
uint32_t vmac_src = 0;
|
||||||
uint32_t vmac_dst = 0;
|
uint32_t vmac_dst = 0;
|
||||||
uint32_t vmac_target = 0;
|
|
||||||
uint8_t message_type = 0;
|
uint8_t message_type = 0;
|
||||||
uint16_t message_length = 0;
|
uint16_t message_length = 0;
|
||||||
int header_len = 0;
|
int header_len = 0;
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ void routed_get_my_address(BACNET_ADDRESS *my_address);
|
|||||||
#else
|
#else
|
||||||
#define datalink_get_my_address bip_get_my_address
|
#define datalink_get_my_address bip_get_my_address
|
||||||
#endif
|
#endif
|
||||||
#define datalink_maintenance_timer(s) bvlc_maintenance_timer(s)
|
#define datalink_maintenance_timer bvlc_maintenance_timer
|
||||||
|
|
||||||
#elif defined(BACDL_BIP6) && !defined(BACDL_MULTIPLE)
|
#elif defined(BACDL_BIP6) && !defined(BACDL_MULTIPLE)
|
||||||
#define MAX_MPDU BIP6_MPDU_MAX
|
#define MAX_MPDU BIP6_MPDU_MAX
|
||||||
@@ -104,7 +104,7 @@ void routed_get_my_address(BACNET_ADDRESS *my_address);
|
|||||||
#define datalink_cleanup bip6_cleanup
|
#define datalink_cleanup bip6_cleanup
|
||||||
#define datalink_get_broadcast_address bip6_get_broadcast_address
|
#define datalink_get_broadcast_address bip6_get_broadcast_address
|
||||||
#define datalink_get_my_address bip6_get_my_address
|
#define datalink_get_my_address bip6_get_my_address
|
||||||
#define datalink_maintenance_timer(s) bvlc6_maintenance_timer(s)
|
#define datalink_maintenance_timer bvlc6_maintenance_timer
|
||||||
|
|
||||||
#elif defined(BACDL_ZIGBEE) && !defined(BACDL_MULTIPLE)
|
#elif defined(BACDL_ZIGBEE) && !defined(BACDL_MULTIPLE)
|
||||||
/* A BACnet/ZigBee Data Link Layer (BZLL) */
|
/* A BACnet/ZigBee Data Link Layer (BZLL) */
|
||||||
|
|||||||
Reference in New Issue
Block a user