Cleaning up code by adding prototypes or include files where required.
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "rp.h"
|
||||
#include "wp.h"
|
||||
#include "handlers.h"
|
||||
#include "bacfile.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t instance;
|
||||
@@ -164,7 +165,7 @@ static long fsize(
|
||||
return (size);
|
||||
}
|
||||
|
||||
static unsigned bacfile_file_size(
|
||||
unsigned bacfile_file_size(
|
||||
uint32_t object_instance)
|
||||
{
|
||||
char *pFilename = NULL;
|
||||
|
||||
@@ -182,7 +182,7 @@ bool Multistate_Input_Present_Value_Set(
|
||||
return status;
|
||||
}
|
||||
|
||||
char *Multistate_Input_Description(
|
||||
static char *Multistate_Input_Description(
|
||||
uint32_t object_instance)
|
||||
{
|
||||
unsigned index = 0; /* offset from instance lookup */
|
||||
@@ -268,7 +268,7 @@ bool Multistate_Input_Name_Set(
|
||||
return status;
|
||||
}
|
||||
|
||||
char *Multistate_Input_State_Text(
|
||||
static char *Multistate_Input_State_Text(
|
||||
uint32_t object_instance,
|
||||
uint32_t state_index)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ DEBUGGING = -g
|
||||
endif
|
||||
# put all the flags together
|
||||
CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(INCLUDES) $(DEFINES)
|
||||
LFLAGS = -Wl,-Map=$(TARGET).map,$(LIBRARIES)
|
||||
LFLAGS = -Wl,$(LIBRARIES)
|
||||
|
||||
SRCS = main.c
|
||||
|
||||
@@ -70,6 +70,6 @@ depend:
|
||||
${CC} -MM ${CFLAGS} *.c >> .depend
|
||||
|
||||
clean:
|
||||
rm -f core ${TARGET_BIN} ${OBJS} ${BACNET_LIB_TARGET} $(TARGET).map
|
||||
rm -f core ${TARGET_BIN} ${OBJS} ${BACNET_LIB_TARGET}
|
||||
|
||||
include: .depend
|
||||
|
||||
@@ -45,6 +45,8 @@ extern "C" {
|
||||
void);
|
||||
uint32_t Analog_Value_Index_To_Instance(
|
||||
unsigned index);
|
||||
unsigned Analog_Value_Instance_To_Index(
|
||||
uint32_t object_instance);
|
||||
char *Analog_Value_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
|
||||
@@ -67,6 +67,10 @@ extern "C" {
|
||||
int decode_tag_number(
|
||||
uint8_t * apdu,
|
||||
uint8_t * tag_number);
|
||||
int decode_tag_number_safe(
|
||||
uint8_t * apdu,
|
||||
uint32_t apdu_len_remaining,
|
||||
uint8_t * tag_number);
|
||||
int decode_tag_number_and_value(
|
||||
uint8_t * apdu,
|
||||
uint8_t * tag_number,
|
||||
@@ -88,6 +92,10 @@ extern "C" {
|
||||
bool decode_is_context_tag(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number);
|
||||
bool decode_is_context_tag_with_length(
|
||||
uint8_t * apdu,
|
||||
uint8_t tag_number,
|
||||
int *tag_length);
|
||||
/* returns true if the tag is an opening tag */
|
||||
bool decode_is_opening_tag(
|
||||
uint8_t * apdu);
|
||||
|
||||
@@ -46,6 +46,8 @@ extern "C" {
|
||||
void);
|
||||
uint32_t Binary_Value_Index_To_Instance(
|
||||
unsigned index);
|
||||
unsigned Binary_Value_Instance_To_Index(
|
||||
uint32_t object_instance);
|
||||
char *Binary_Value_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
|
||||
@@ -49,11 +49,15 @@ extern "C" {
|
||||
void);
|
||||
uint32_t Load_Control_Index_To_Instance(
|
||||
unsigned index);
|
||||
unsigned Load_Control_Instance_To_Index(
|
||||
uint32_t object_instance);
|
||||
char *Load_Control_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
void Load_Control_Init(
|
||||
void);
|
||||
void Load_Control_State_Machine(
|
||||
int object_index);
|
||||
|
||||
int Load_Control_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata);
|
||||
|
||||
@@ -46,6 +46,8 @@ extern "C" {
|
||||
void);
|
||||
uint32_t Life_Safety_Point_Index_To_Instance(
|
||||
unsigned index);
|
||||
unsigned Life_Safety_Point_Instance_To_Index(
|
||||
uint32_t object_instance);
|
||||
char *Life_Safety_Point_Name(
|
||||
uint32_t object_instance);
|
||||
void Life_Safety_Point_Init(
|
||||
|
||||
@@ -46,6 +46,8 @@ extern "C" {
|
||||
void);
|
||||
uint32_t Multistate_Output_Index_To_Instance(
|
||||
unsigned index);
|
||||
unsigned Multistate_Output_Instance_To_Index(
|
||||
uint32_t object_instance);
|
||||
char *Multistate_Output_Name(
|
||||
uint32_t object_instance);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#Makefile to build BACnet Library with GCC
|
||||
|
||||
# tools - only if you need them.
|
||||
# tools - only if you need them.
|
||||
# Most platforms have this already defined
|
||||
# CC = gcc
|
||||
# AR = ar
|
||||
@@ -30,6 +30,7 @@ BACNET_INCLUDE = ../include
|
||||
INCLUDES = -I$(BACNET_INCLUDE) -I$(BACNET_PORT_DIR) -I$(BACNET_OBJECT) -I$(BACNET_HANDLER)
|
||||
OPTIMIZATION = -Os
|
||||
DEBUGGING =
|
||||
WARNINGS = -Wall -Wmissing-prototypes
|
||||
ifeq (${BUILD},debug)
|
||||
OPTIMIZATION = -O0
|
||||
DEBUGGING = -g
|
||||
@@ -37,7 +38,7 @@ ifeq (${BACDL_DEFINE},-DBACDL_BIP=1)
|
||||
DEFINES += -DBIP_DEBUG
|
||||
endif
|
||||
endif
|
||||
CFLAGS = -Wall $(DEBUGGING) $(OPTIMIZATION) $(STANDARDS) $(INCLUDES) $(DEFINES)
|
||||
CFLAGS = $(WARNINGS) $(DEBUGGING) $(OPTIMIZATION) $(STANDARDS) $(INCLUDES) $(DEFINES)
|
||||
|
||||
CORE_SRC = \
|
||||
$(BACNET_CORE)/apdu.c \
|
||||
|
||||
@@ -31,9 +31,9 @@ SIZE_OPTIONS = -t
|
||||
# avr109 = bootloader
|
||||
#AVRDUDE_PROGRAMMERID = avr109
|
||||
#AVRDUDE_PROGRAMMERID = jtag2fast
|
||||
AVRDUDE_PROGRAMMERID = avrispmkII
|
||||
#AVRDUDE_PROGRAMMERID = avrispmkII
|
||||
#AVRDUDE_PROGRAMMERID = dragon_isp
|
||||
#AVRDUDE_PROGRAMMERID = dragon_jtag
|
||||
AVRDUDE_PROGRAMMERID = dragon_jtag
|
||||
#
|
||||
# port--serial or parallel port to which your
|
||||
# hardware programmer is attached
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "bacenum.h"
|
||||
#include "bacdcode.h"
|
||||
#include "bacdef.h"
|
||||
#include "abort.h"
|
||||
|
||||
/** @file abort.c Abort Encoding/Decoding */
|
||||
/* Helper function to avoid needing additional entries in service data structures
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <stdbool.h>
|
||||
#include "config.h"
|
||||
#include "bacdef.h"
|
||||
#include "bacaddr.h"
|
||||
|
||||
/** @file bacaddr.c BACnet Address structure utilities */
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "bacenum.h"
|
||||
#include "bacdcode.h"
|
||||
#include "bacdef.h"
|
||||
#include "bacerror.h"
|
||||
|
||||
/** @file bacerror.c Encode/Decode BACnet Errors */
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "config.h"
|
||||
#include "bacint.h"
|
||||
|
||||
/** @file bacint.c Encode/Decode Integer Types */
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <stdio.h>
|
||||
#include "indtext.h"
|
||||
#include "bacenum.h"
|
||||
#include "bactext.h"
|
||||
|
||||
/** @file bactext.c Lookup or Translate BACnet Name Text */
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ int bvlc_encode_write_bdt_init(
|
||||
return len;
|
||||
}
|
||||
|
||||
int bvlc_encode_read_bdt(
|
||||
static int bvlc_encode_read_bdt(
|
||||
uint8_t * pdu)
|
||||
{
|
||||
int len = 0;
|
||||
@@ -339,7 +339,7 @@ static int bvlc_encode_register_foreign_device(
|
||||
return len;
|
||||
}
|
||||
|
||||
int bvlc_encode_read_fdt(
|
||||
static int bvlc_encode_read_fdt(
|
||||
uint8_t * pdu)
|
||||
{
|
||||
int len = 0;
|
||||
@@ -417,7 +417,7 @@ static int bvlc_encode_read_fdt_ack(
|
||||
return pdu_len;
|
||||
}
|
||||
|
||||
int bvlc_encode_delete_fdt_entry(
|
||||
static int bvlc_encode_delete_fdt_entry(
|
||||
uint8_t * pdu,
|
||||
struct in_addr *address,
|
||||
uint16_t port)
|
||||
@@ -440,7 +440,7 @@ int bvlc_encode_delete_fdt_entry(
|
||||
return len;
|
||||
}
|
||||
|
||||
int bvlc_encode_original_unicast_npdu(
|
||||
static int bvlc_encode_original_unicast_npdu(
|
||||
uint8_t * pdu,
|
||||
uint8_t * npdu,
|
||||
unsigned npdu_length)
|
||||
@@ -466,7 +466,7 @@ int bvlc_encode_original_unicast_npdu(
|
||||
return len;
|
||||
}
|
||||
|
||||
int bvlc_encode_original_broadcast_npdu(
|
||||
static int bvlc_encode_original_broadcast_npdu(
|
||||
uint8_t * pdu,
|
||||
uint8_t * npdu,
|
||||
unsigned npdu_length)
|
||||
@@ -587,9 +587,9 @@ static bool bvlc_register_foreign_device(
|
||||
(FD_Table[i].dest_port == ntohs(sin->sin_port))) {
|
||||
status = true;
|
||||
FD_Table[i].time_to_live = time_to_live;
|
||||
/* Upon receipt of a BVLL Register-Foreign-Device message,
|
||||
a BBMD shall start a timer with a value equal to the
|
||||
Time-to-Live parameter supplied plus a fixed grace
|
||||
/* Upon receipt of a BVLL Register-Foreign-Device message,
|
||||
a BBMD shall start a timer with a value equal to the
|
||||
Time-to-Live parameter supplied plus a fixed grace
|
||||
period of 30 seconds. */
|
||||
FD_Table[i].seconds_remaining = time_to_live + 30;
|
||||
break;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
####COPYRIGHTEND####*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "filename.h"
|
||||
|
||||
/** @file filename.c Function for filename manipulation */
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
-------------------------------------------
|
||||
####COPYRIGHTEND####*/
|
||||
#include <stddef.h>
|
||||
#include "memcopy.h"
|
||||
|
||||
/** @file memcopy.c Custom memcopy function */
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
/** @file ptransfer.c Encode/Decode Private Transfer data */
|
||||
|
||||
/* encode service */
|
||||
int pt_encode_apdu(
|
||||
static int pt_encode_apdu(
|
||||
uint8_t * apdu,
|
||||
uint16_t max_apdu,
|
||||
BACNET_PRIVATE_TRANSFER_DATA * private_data)
|
||||
|
||||
Reference in New Issue
Block a user