OSCBS-23 Add backport.h for all ports

BACNET_OBJECT_TABLE will be use in zephyr port for create iterable section
This commit is contained in:
Mikhail Antropov
2022-06-15 09:31:23 +03:00
parent 8d3c134b3e
commit adbbbeef64
6 changed files with 97 additions and 0 deletions
+6
View File
@@ -95,5 +95,11 @@
extern int bip_get_local_netmask( extern int bip_get_local_netmask(
struct in_addr *netmask); struct in_addr *netmask);
#define BACNET_OBJECT_TABLE(table_name, _type, _init, _count, \
_index_to_instance, _valid_instance, _object_name, \
_read_property, _write_property, _RPM_list, \
_RR_info, _iterator, _value_list, _COV, \
_COV_clear, _intrinsic_reporting) \
/*TODO Add compile error "Unsupported BACNET_OBJECT_TABLE for this platform." */
#endif #endif
+8
View File
@@ -101,6 +101,14 @@
#include <netdb.h> #include <netdb.h>
#include "bacnet/bacnet_stack_exports.h" #include "bacnet/bacnet_stack_exports.h"
#define BACNET_OBJECT_TABLE(table_name, _type, _init, _count, \
_index_to_instance, _valid_instance, _object_name, \
_read_property, _write_property, _RPM_list, \
_RR_info, _iterator, _value_list, _COV, \
_COV_clear, _intrinsic_reporting) \
/*TODO Add compile error "Unsupported BACNET_OBJECT_TABLE for this platform." */
/** @file linux/bacport.h Includes Linux network headers. */ /** @file linux/bacport.h Includes Linux network headers. */
/* Local helper functions for this port */ /* Local helper functions for this port */
+7
View File
@@ -36,4 +36,11 @@
#include "lwip/dhcp.h" #include "lwip/dhcp.h"
#include "lwip/inet.h" #include "lwip/inet.h"
#define BACNET_OBJECT_TABLE(table_name, _type, _init, _count, \
_index_to_instance, _valid_instance, _object_name, \
_read_property, _write_property, _RPM_list, \
_RR_info, _iterator, _value_list, _COV, \
_COV_clear, _intrinsic_reporting) \
/*TODO Add compile error "Unsupported BACNET_OBJECT_TABLE for this platform." */
#endif #endif
+14
View File
@@ -70,6 +70,12 @@ and globals in favor of more secure versions. */
#endif #endif
#include <sys/timeb.h> #include <sys/timeb.h>
#if defined(__BORLANDC__) || defined(_WIN32)
/* seems to not be defined in time.h as specified by The Open Group */
/* difference from UTC and local standard time */
long int timezone;
#endif
#ifdef _MSC_VER #ifdef _MSC_VER
#define inline __inline #define inline __inline
#endif #endif
@@ -82,4 +88,12 @@ and globals in favor of more secure versions. */
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
#define BACNET_OBJECT_TABLE(table_name, _type, _init, _count, \
_index_to_instance, _valid_instance, _object_name, \
_read_property, _write_property, _RPM_list, \
_RR_info, _iterator, _value_list, _COV, \
_COV_clear, _intrinsic_reporting) \
/*TODO Add compile error "Unsupported BACNET_OBJECT_TABLE for this platform." */
#endif #endif
+24
View File
@@ -28,6 +28,8 @@
#include <net/net_ip.h> #include <net/net_ip.h>
#include <net/socket.h> #include <net/socket.h>
#include <zephyr.h>
#include "bacnet/basic/object/device.h"
static inline char *inet_ntoa(struct in_addr in) { static inline char *inet_ntoa(struct in_addr in) {
return "(inet_ntoa() to be implemented)"; return "(inet_ntoa() to be implemented)";
@@ -37,5 +39,27 @@ static inline char *inet_ntoa(struct in_addr in) {
extern int bip_get_local_netmask( extern int bip_get_local_netmask(
struct in_addr *netmask); struct in_addr *netmask);
#define BACNET_OBJECT_TABLE(table_name, _type, _init, _count, \
_index_to_instance, _valid_instance, _object_name, \
_read_property, _write_property, _RPM_list, \
_RR_info, _iterator, _value_list, _COV, \
_COV_clear, _intrinsic_reporting) \
STRUCT_SECTION_ITERABLE(object_functions, table_name) = { \
.Object_Type = _type, \
.Object_Init = _init, \
.Object_Count = _count, \
.Object_Index_To_Instance = _index_to_instance, \
.Object_Valid_Instance = _valid_instance, \
.Object_Name = _object_name, \
.Object_Read_Property = _read_property, \
.Object_Write_Property = _write_property, \
.Object_RPM_List = _RPM_list, \
.Object_RR_Info = _RR_info, \
.Object_Iterator = _iterator, \
.Object_Value_List = _value_list, \
.Object_COV = _COV, \
.Object_COV_Clear = _COV_clear, \
.Object_Intrinsic_Reporting = _intrinsic_reporting \
}
#endif #endif
+38
View File
@@ -0,0 +1,38 @@
/**************************************************************************
*
* Copyright (c) 2022 Legrand North America, LLC.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*********************************************************************/
/* ztest mock file */
#ifndef BACPORT_H
#define BACPORT_H
#define BACNET_OBJECT_TABLE(table_name, _type, _init, _count, \
_index_to_instance, _valid_instance, _object_name, \
_read_property, _write_property, _RPM_list, \
_RR_info, _iterator, _value_list, _COV, \
_COV_clear, _intrinsic_reporting) \
/* Empty define */
#endif