Edouard@2020: /************************************************************************** Edouard@2020: * Edouard@2020: * Copyright (C) 2004 Steve Karg Edouard@2020: * Copyright (C) 2017 Mario de Sousa Edouard@2020: * Edouard@2020: * Permission is hereby granted, free of charge, to any person obtaining Edouard@2020: * a copy of this software and associated documentation files (the Edouard@2020: * "Software"), to deal in the Software without restriction, including Edouard@2020: * without limitation the rights to use, copy, modify, merge, publish, Edouard@2020: * distribute, sublicense, and/or sell copies of the Software, and to Edouard@2020: * permit persons to whom the Software is furnished to do so, subject to Edouard@2020: * the following conditions: Edouard@2020: * Edouard@2020: * The above copyright notice and this permission notice shall be included Edouard@2020: * in all copies or substantial portions of the Software. Edouard@2020: * Edouard@2020: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, Edouard@2020: * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF Edouard@2020: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. Edouard@2020: * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY Edouard@2020: * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, Edouard@2020: * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE Edouard@2020: * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Edouard@2020: * Edouard@2020: *********************************************************************/ Edouard@2020: Edouard@2020: Edouard@2020: #ifndef CONFIG_BACNET_FOR_BEREMIZ_H Edouard@2020: #define CONFIG_BACNET_FOR_BEREMIZ_H Edouard@2020: Edouard@2020: #ifdef CONFIG_H Edouard@2020: #error "config.h already processed! (config_bacnet_for_beremiz.h should be included before config.h)" Edouard@2020: #endif Edouard@2020: Edouard@2020: /* Compilaton options for BACnet library, configured for the BACnet sserver Edouard@2020: * running on Beremiz. Edouard@2020: */ Edouard@2020: Edouard@2020: /* declare a single physical layer using your compiler define. Edouard@2020: * see datalink.h for possible defines. Edouard@2020: */ Edouard@2020: /* Use BACnet/IP */ Edouard@2020: #define BACDL_BIP Edouard@2020: Edouard@2020: /* optional configuration for BACnet/IP datalink layers */ Edouard@2020: /* other BIP defines (define as 1 to enable): Edouard@2020: USE_INADDR - uses INADDR_BROADCAST for broadcast and binds using INADDR_ANY Edouard@2020: USE_CLASSADDR = uses IN_CLASSx_HOST where x=A,B,C or D for broadcast Edouard@2020: */ Edouard@2020: #define BBMD_ENABLED 1 Edouard@2020: Edouard@2020: /* name of file in which BDT table will be stored */ Edouard@2020: #define BBMD_BACKUP_FILE beremiz_BACnet_BDT_table Edouard@2020: Edouard@2020: /* Enable the Gateway (Routing) functionality here, if desired. */ Edouard@2020: #define MAX_NUM_DEVICES 1 /* Just the one normal BACnet Device Object */ Edouard@2020: Edouard@2020: Edouard@2020: /* Define your processor architecture as Edouard@2020: Big Endian (PowerPC,68K,Sparc) or Little Endian (Intel,AVR) Edouard@2020: ARM and MIPS can be either - what is your setup? */ Edouard@2020: Edouard@2020: /* WARNING: The following files are being included: Edouard@2020: * --> --> Edouard@2020: * Edouard@2020: * endian.h defines the following constants as: Edouard@2020: * #define __LITTLE_ENDIAN and LITTLE_ENDIAN as 1234 Edouard@2020: * #define __BIG_ENDIAN and BIG_ENDIAN as 4321 Edouard@2020: * #define __PDP_ENDIAN and PDP_ENDIAN as 3412 Edouard@2020: * Edouard@2020: * bits/endian.h defines the constant BYTE_ORDER as: Edouard@2020: * #define __BYTE_ORDER as __LITTLE_ENDIAN Edouard@2020: * Edouard@2020: * endian.h then sets the following constants Edouard@2020: * (if __USE_BSD is set, which seems to be true): Edouard@2020: * # define LITTLE_ENDIAN __LITTLE_ENDIAN Edouard@2020: * # define BIG_ENDIAN __BIG_ENDIAN Edouard@2020: * # define PDP_ENDIAN __PDP_ENDIAN Edouard@2020: * # define BYTE_ORDER __BYTE_ORDER Edouard@2020: * Edouard@2020: * CONCLUSION: Edouard@2020: * The bacnet library uses the BIG_ENDIAN constant (set to 0, or anything <>0) Edouard@2020: * to indicate whether we are compiling on a little or big endian platform. Edouard@2020: * However, is defining this same constant as '4321' !!! Edouard@2020: * The decision to use BIG_ENDIAN as the constant is a unfortunate Edouard@2020: * on the part of the bacnet coders, but we live with it for now... Edouard@2020: * We simply start off by undefining the BIG_ENDIAN constant, and carry Edouard@2020: * on from there! Edouard@2020: */ Edouard@2020: #undef BIG_ENDIAN Edouard@2020: Edouard@2020: #ifndef BIG_ENDIAN Edouard@2020: #if defined(__GNUC__) Edouard@2020: /* We have GCC, which should define __LITTLE_ENDIAN__ or __BIG_ENDIAN__ */ Edouard@2020: # if defined(__LITTLE_ENDIAN__) Edouard@2020: /*# warning "Using gcc to determine platform endianness."*/ Edouard@2020: # define BIG_ENDIAN 0 Edouard@2020: # elif defined(__BIG_ENDIAN__) Edouard@2020: /*# warning "Using gcc to determine platform endianness."*/ Edouard@2020: # define BIG_ENDIAN 1 Edouard@2020: # endif Edouard@2020: #endif /* __GNUC__ */ Edouard@2020: #endif /* BIG_ENDIAN */ Edouard@2020: Edouard@2020: Edouard@2020: /* If we still don't know byte order, try to get it from */ Edouard@2020: #ifndef BIG_ENDIAN Edouard@2020: #include Edouard@2020: # ifdef BYTE_ORDER Edouard@2020: # if BYTE_ORDER == LITTLE_ENDIAN Edouard@2020: /*# warning "Using to determine platform endianness."*/ Edouard@2020: # undef BIG_ENDIAN Edouard@2020: # define BIG_ENDIAN 0 Edouard@2020: # elif BYTE_ORDER == BIG_ENDIAN Edouard@2020: /*# warning "Using to determine platform endianness."*/ Edouard@2020: # undef BIG_ENDIAN Edouard@2020: # define BIG_ENDIAN 1 Edouard@2020: # else Edouard@2020: # undef BIG_ENDIAN Edouard@2020: # endif Edouard@2020: # endif /* BYTE_ORDER */ Edouard@2020: #endif /* BIG_ENDIAN */ Edouard@2020: Edouard@2020: Edouard@2020: #ifndef BIG_ENDIAN Edouard@2020: #error "Unable to determine platform's byte order. Aborting compilation." Edouard@2020: #elif BIG_ENDIAN Edouard@2020: /*#warning "Compiling for BIG endian platform."*/ Edouard@2020: #else Edouard@2020: /*#warning "Compiling for LITTLE endian platform."*/ Edouard@2020: #endif Edouard@2020: Edouard@2020: Edouard@2020: Edouard@2020: /* Define your Vendor Identifier assigned by ASHRAE */ Edouard@2020: #define BACNET_VENDOR_ID %(BACnet_Vendor_ID)s Edouard@2020: #define BACNET_VENDOR_NAME "%(BACnet_Vendor_Name)s" Edouard@2020: #define BACNET_DEVICE_MODEL_NAME "%(BACnet_Model_Name)s" Edouard@2020: #define BACNET_FIRMWARE_REVISION "Beremiz BACnet Extension, BACnet Stack:" BACNET_VERSION_TEXT Edouard@2020: #define BACNET_DEVICE_LOCATION "%(BACnet_Device_Location)s" Edouard@2020: #define BACNET_DEVICE_DESCRIPTION "%(BACnet_Device_Description)s" Edouard@2020: #define BACNET_DEVICE_APPSOFT_VER "%(BACnet_Device_AppSoft_Version)s" Edouard@2020: Edouard@2020: Edouard@2020: /* Max number of bytes in an APDU. */ Edouard@2020: /* Typical sizes are 50, 128, 206, 480, 1024, and 1476 octets */ Edouard@2020: /* This is used in constructing messages and to tell others our limits */ Edouard@2020: /* 50 is the minimum; adjust to your memory and physical layer constraints */ Edouard@2020: /* Lon=206, MS/TP=480, ARCNET=480, Ethernet=1476, BACnet/IP=1476 */ Edouard@2020: #define MAX_APDU 1476 Edouard@2020: /* #define MAX_APDU 128 enable this IP for testing readrange so you get the More Follows flag set */ Edouard@2020: Edouard@2020: Edouard@2020: /* for confirmed messages, this is the number of transactions */ Edouard@2020: /* that we hold in a queue waiting for timeout. */ Edouard@2020: /* Configure to zero if you don't want any confirmed messages */ Edouard@2020: /* Configure from 1..255 for number of outstanding confirmed */ Edouard@2020: /* requests available. */ Edouard@2020: #define MAX_TSM_TRANSACTIONS 255 Edouard@2020: Edouard@2020: /* The address cache is used for binding to BACnet devices */ Edouard@2020: /* The number of entries corresponds to the number of */ Edouard@2020: /* devices that might respond to an I-Am on the network. */ Edouard@2020: /* If your device is a simple server and does not need to bind, */ Edouard@2020: /* then you don't need to use this. */ Edouard@2020: #define MAX_ADDRESS_CACHE 255 Edouard@2020: Edouard@2020: /* some modules have debugging enabled using PRINT_ENABLED */ Edouard@2020: #define PRINT_ENABLED 0 Edouard@2020: Edouard@2020: Edouard@2020: /* BACAPP decodes WriteProperty service requests Edouard@2020: Choose the datatypes that your application supports */ Edouard@2020: #if !(defined(BACAPP_ALL) || \ Edouard@2020: defined(BACAPP_NULL) || \ Edouard@2020: defined(BACAPP_BOOLEAN) || \ Edouard@2020: defined(BACAPP_UNSIGNED) || \ Edouard@2020: defined(BACAPP_SIGNED) || \ Edouard@2020: defined(BACAPP_REAL) || \ Edouard@2020: defined(BACAPP_DOUBLE) || \ Edouard@2020: defined(BACAPP_OCTET_STRING) || \ Edouard@2020: defined(BACAPP_CHARACTER_STRING) || \ Edouard@2020: defined(BACAPP_BIT_STRING) || \ Edouard@2020: defined(BACAPP_ENUMERATED) || \ Edouard@2020: defined(BACAPP_DATE) || \ Edouard@2020: defined(BACAPP_TIME) || \ Edouard@2020: defined(BACAPP_OBJECT_ID) || \ Edouard@2020: defined(BACAPP_DEVICE_OBJECT_PROP_REF)) Edouard@2020: #define BACAPP_ALL Edouard@2020: #endif Edouard@2020: Edouard@2020: #if defined (BACAPP_ALL) Edouard@2020: #define BACAPP_NULL Edouard@2020: #define BACAPP_BOOLEAN Edouard@2020: #define BACAPP_UNSIGNED Edouard@2020: #define BACAPP_SIGNED Edouard@2020: #define BACAPP_REAL Edouard@2020: #define BACAPP_DOUBLE Edouard@2020: #define BACAPP_OCTET_STRING Edouard@2020: #define BACAPP_CHARACTER_STRING Edouard@2020: #define BACAPP_BIT_STRING Edouard@2020: #define BACAPP_ENUMERATED Edouard@2020: #define BACAPP_DATE Edouard@2020: #define BACAPP_TIME Edouard@2020: #define BACAPP_OBJECT_ID Edouard@2020: #define BACAPP_DEVICE_OBJECT_PROP_REF Edouard@2020: #endif Edouard@2020: Edouard@2020: /* Edouard@2020: ** Set the maximum vector type sizes Edouard@2020: */ Edouard@2020: #define MAX_BITSTRING_BYTES (15) Edouard@2020: #define MAX_CHARACTER_STRING_BYTES (MAX_APDU-6) Edouard@2020: #define MAX_OCTET_STRING_BYTES (MAX_APDU-6) Edouard@2020: Edouard@2020: /* Edouard@2020: ** Control the selection of services etc to enable code size reduction for those Edouard@2020: ** compiler suites which do not handle removing of unused functions in modules Edouard@2020: ** so well. Edouard@2020: ** Edouard@2020: ** We will start with the A type services code first as these are least likely Edouard@2020: ** to be required in embedded systems using the stack. Edouard@2020: */ Edouard@2020: Edouard@2020: /* Edouard@2020: ** Define the services that may be required. Edouard@2020: ** Edouard@2020: **/ Edouard@2020: Edouard@2020: /* For the moment enable them all to avoid breaking things */ Edouard@2020: #define BACNET_SVC_I_HAVE_A 1 /* Do we send I_Have requests? */ Edouard@2020: #define BACNET_SVC_WP_A 1 /* Do we send WriteProperty requests? */ Edouard@2020: #define BACNET_SVC_RP_A 1 /* Do we send ReadProperty requests? */ Edouard@2020: #define BACNET_SVC_RPM_A 1 /* Do we send ReadPropertyMultiple requests? */ Edouard@2020: #define BACNET_SVC_DCC_A 1 /* Do we send DeviceCommunicationControl requests? */ Edouard@2020: #define BACNET_SVC_RD_A 1 /* Do we send ReinitialiseDevice requests? */ Edouard@2020: #define BACNET_SVC_TS_A 1 Edouard@2020: #define BACNET_SVC_SERVER 0 /* Are we a pure server type device? */ Edouard@2020: #define BACNET_USE_OCTETSTRING 1 /* Do we need any octet strings? */ Edouard@2020: #define BACNET_USE_DOUBLE 1 /* Do we need any doubles? */ Edouard@2020: #define BACNET_USE_SIGNED 1 /* Do we need any signed integers */ Edouard@2020: Edouard@2020: /* Do them one by one */ Edouard@2020: #ifndef BACNET_SVC_I_HAVE_A /* Do we send I_Have requests? */ Edouard@2020: #define BACNET_SVC_I_HAVE_A 0 Edouard@2020: #endif Edouard@2020: Edouard@2020: #ifndef BACNET_SVC_WP_A /* Do we send WriteProperty requests? */ Edouard@2020: #define BACNET_SVC_WP_A 0 Edouard@2020: #endif Edouard@2020: Edouard@2020: #ifndef BACNET_SVC_RP_A /* Do we send ReadProperty requests? */ Edouard@2020: #define BACNET_SVC_RP_A 0 Edouard@2020: #endif Edouard@2020: Edouard@2020: #ifndef BACNET_SVC_RPM_A /* Do we send ReadPropertyMultiple requests? */ Edouard@2020: #define BACNET_SVC_RPM_A 0 Edouard@2020: #endif Edouard@2020: Edouard@2020: #ifndef BACNET_SVC_DCC_A /* Do we send DeviceCommunicationControl requests? */ Edouard@2020: #define BACNET_SVC_DCC_A 0 Edouard@2020: #endif Edouard@2020: Edouard@2020: #ifndef BACNET_SVC_RD_A /* Do we send ReinitialiseDevice requests? */ Edouard@2020: #define BACNET_SVC_RD_A 0 Edouard@2020: #endif Edouard@2020: Edouard@2020: #ifndef BACNET_SVC_SERVER /* Are we a pure server type device? */ Edouard@2020: #define BACNET_SVC_SERVER 1 Edouard@2020: #endif Edouard@2020: Edouard@2020: #ifndef BACNET_USE_OCTETSTRING /* Do we need any octet strings? */ Edouard@2020: #define BACNET_USE_OCTETSTRING 0 Edouard@2020: #endif Edouard@2020: Edouard@2020: #ifndef BACNET_USE_DOUBLE /* Do we need any doubles? */ Edouard@2020: #define BACNET_USE_DOUBLE 0 Edouard@2020: #endif Edouard@2020: Edouard@2020: #ifndef BACNET_USE_SIGNED /* Do we need any signed integers */ Edouard@2020: #define BACNET_USE_SIGNED 0 Edouard@2020: #endif Edouard@2020: Edouard@2020: #endif /* CONFIG_BACNET_FOR_BEREMIZ_H */