diff --git a/bacnet-stack/handlers.c b/bacnet-stack/handlers.c index f5a4e076..2740db8b 100644 --- a/bacnet-stack/handlers.c +++ b/bacnet-stack/handlers.c @@ -222,7 +222,7 @@ bool Send_Read_Property_Request( object_instance, object_property, array_index); - if (pdu_len < max_apdu) + if ((unsigned)pdu_len < max_apdu) { tsm_set_confirmed_unsegmented_transaction( invoke_id, @@ -323,6 +323,7 @@ void ReadPropertyAckHandler( int len = 0; BACNET_READ_PROPERTY_DATA data; + (void)src; tsm_free_invoke_id(service_data->invoke_id); len = rp_ack_decode_service_request( service_request, diff --git a/bacnet-stack/ports/rtos32/ethernet.c b/bacnet-stack/ports/rtos32/ethernet.c index e94e566f..7c25398d 100644 --- a/bacnet-stack/ports/rtos32/ethernet.c +++ b/bacnet-stack/ports/rtos32/ethernet.c @@ -76,7 +76,7 @@ bool ethernet_init(char *interface_name) if (bind(Ethernet_Socket, &Ethernet_Address, sizeof(Ethernet_Address)) == SOCKET_ERROR) fprintf(stderr,"ethernet: failed to bind to socket!\r\n"); - setsockopt(Ethernet_Socket,SOL_SOCKET,SO_802_2,(char *)&value,sizeof(value)); + //setsockopt(Ethernet_Socket,SOL_SOCKET,SO_802_2,(char *)&value,sizeof(value)); return ethernet_valid(); } diff --git a/bacnet-stack/ports/rtos32/makefile.mak b/bacnet-stack/ports/rtos32/makefile.mak index 45ca6bfe..996ee2a6 100644 --- a/bacnet-stack/ports/rtos32/makefile.mak +++ b/bacnet-stack/ports/rtos32/makefile.mak @@ -39,6 +39,9 @@ SRCS = init.c main.c ethernet.c bip.c \ ..\..\wp.c \ ..\..\device.c \ ..\..\ai.c \ + ..\..\ao.c \ + ..\..\tsm.c \ + ..\..\address.c \ ..\..\abort.c \ ..\..\reject.c \ ..\..\bacerror.c \ @@ -58,8 +61,7 @@ LOCATE = $(RTOS32_DIR)\bin\rtloc # Include directories # CC_DIR = $(BORLAND_DIR)\BIN -CC_INCLDIR = $(BORLAND_DIR)\include -INCL_DIRS = -I$(BORLAND_DIR)\include;$(RTOS32_DIR)\include;../../; +INCL_DIRS = -I$(BORLAND_DIR)\include;$(RTOS32_DIR)\include;..\..\;. CFLAGS = $(INCL_DIRS) $(CS_FLAGS) $(DEFINES) @@ -80,7 +82,7 @@ $(RTOS32_LIB_DIR)\DRVRT32.LIB \ $(RTOS32_LIB_DIR)\RTEMUMT.LIB \ $(RTOS32_LIB_DIR)\RTT32.LIB \ $(RTOS32_LIB_DIR)\RTTHEAP.LIB \ -$(C_LIB_DIR)\DPMI32.lib \ +#$(C_LIB_DIR)\DPMI32.lib \ $(C_LIB_DIR)\IMPORT32.lib \ $(C_LIB_DIR)\CW32MT.lib diff --git a/bacnet-stack/ports/rtos32/setvars.bat b/bacnet-stack/ports/rtos32/setvars.bat index ad9e8cf1..404c1998 100644 --- a/bacnet-stack/ports/rtos32/setvars.bat +++ b/bacnet-stack/ports/rtos32/setvars.bat @@ -1,3 +1,3 @@ set BORLAND_DIR=\bc5 -set RTOS32_DIR=\rtos32 +set RTOS32_DIR=\code\rtos32 diff --git a/bacnet-stack/ports/rtos32/stdbool.h b/bacnet-stack/ports/rtos32/stdbool.h new file mode 100644 index 00000000..29b9a5e4 --- /dev/null +++ b/bacnet-stack/ports/rtos32/stdbool.h @@ -0,0 +1,28 @@ +#ifndef STDBOOL_H +#define STDBOOL_H + +// C99 Boolean types for compilers without C99 support + +#ifndef __cplusplus + typedef int _Bool; + #ifndef bool + #define bool _Bool + #endif + #ifndef true + #define true 1 + #endif + #ifndef false + #define false 0 + #endif + #define __bool_true_false_are_defined 1 +#endif + +#ifndef FALSE + #define FALSE 0 +#endif + +#ifndef TRUE + #define TRUE 1 +#endif + +#endif diff --git a/bacnet-stack/ports/rtos32/stdint.h b/bacnet-stack/ports/rtos32/stdint.h new file mode 100644 index 00000000..3615d7ea --- /dev/null +++ b/bacnet-stack/ports/rtos32/stdint.h @@ -0,0 +1,19 @@ +// Defines the standard integer types that are used in code +// for the x86 processor and Borland Compiler + +#ifndef STDINT_H +#define STDINT_H + +#include + +typedef unsigned char uint8_t; // 1 byte 0 to 255 +typedef signed char int8_t; // 1 byte -127 to 127 +typedef unsigned short uint16_t; // 2 bytes 0 to 65535 +typedef signed short int16_t; // 2 bytes -32767 to 32767 +//typedef unsigned short long uint24_t; // 3 bytes 0 to 16777215 +typedef unsigned long uint32_t; // 4 bytes 0 to 4294967295 +typedef signed long int32_t; // 4 bytes -2147483647 to 2147483647 +// typedef signed long long int64_t; +// typedef unsigned long long uint64_t; + +#endif // STDINT_H diff --git a/bacnet-stack/wp.c b/bacnet-stack/wp.c index ffba2772..996e1ca3 100644 --- a/bacnet-stack/wp.c +++ b/bacnet-stack/wp.c @@ -178,9 +178,9 @@ int wp_decode_service_request( &data->value.type.Unsigned_Int); } else if (tag_number == BACNET_APPLICATION_TAG_SIGNED_INT) - { + { data->value.tag = tag_number; - len += decode_unsigned(&apdu[len], + len += decode_signed(&apdu[len], len_value_type, &data->value.type.Signed_Int); } @@ -234,7 +234,7 @@ int wp_decode_service_request( len++; // Tag 4: optional Priority data->priority = BACNET_MAX_PRIORITIES; - if (len < apdu_len) + if ((unsigned)len < apdu_len) { tag_len = decode_tag_number_and_value(&apdu[len], &tag_number, &len_value_type); diff --git a/bacnet-stack/wp.h b/bacnet-stack/wp.h index 89756b71..07acb13c 100644 --- a/bacnet-stack/wp.h +++ b/bacnet-stack/wp.h @@ -45,7 +45,7 @@ typedef struct BACnet_Write_Property_Value { // NULL - not needed as it is encoded in the tag alone bool Boolean; - unsigned int Unsigned_Int; + unsigned Unsigned_Int; int Signed_Int; float Real; // Note: if you choose to enable the writing of certain types @@ -54,7 +54,7 @@ typedef struct BACnet_Write_Property_Value //uint8_t Octet_String[20]; //char Character_String[20]; //BACNET_BIT_STRING Bit_String - unsigned int Enumerated; + int Enumerated; BACNET_DATE Date; BACNET_TIME Time; struct