indented using indent.sh script to get uniform looking code for release
This commit is contained in:
@@ -169,13 +169,11 @@ int Analog_Input_Read_Property(
|
||||
case PROP_OBJECT_NAME:
|
||||
Analog_Input_Object_Name(rpdata->object_instance, &char_string);
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0],
|
||||
&char_string);
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0],
|
||||
rpdata->object_type);
|
||||
encode_application_enumerated(&apdu[0], rpdata->object_type);
|
||||
break;
|
||||
case PROP_PRESENT_VALUE:
|
||||
apdu_len =
|
||||
|
||||
@@ -221,13 +221,11 @@ int Analog_Value_Read_Property(
|
||||
case PROP_OBJECT_NAME:
|
||||
Analog_Value_Object_Name(rpdata->object_instance, &char_string);
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0],
|
||||
&char_string);
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0],
|
||||
rpdata->object_type);
|
||||
encode_application_enumerated(&apdu[0], rpdata->object_type);
|
||||
break;
|
||||
case PROP_PRESENT_VALUE:
|
||||
real_value = Analog_Value_Present_Value(rpdata->object_instance);
|
||||
|
||||
@@ -65,7 +65,8 @@ static bool seeprom_version_test(
|
||||
|
||||
rv = seeprom_bytes_read(NV_SEEPROM_TYPE_0, (uint8_t *) & id, 2);
|
||||
if (rv > 0) {
|
||||
rv = seeprom_bytes_read(NV_SEEPROM_VERSION_0, (uint8_t *) & version, 2);
|
||||
rv = seeprom_bytes_read(NV_SEEPROM_VERSION_0, (uint8_t *) & version,
|
||||
2);
|
||||
}
|
||||
|
||||
if ((rv > 0) && (id == SEEPROM_ID) && (version == SEEPROM_VERSION)) {
|
||||
|
||||
@@ -178,10 +178,10 @@ int Binary_Input_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata)
|
||||
{
|
||||
int apdu_len = 0; /* return value */
|
||||
BACNET_BIT_STRING bit_string = {0};
|
||||
BACNET_BIT_STRING bit_string = { 0 };
|
||||
BACNET_POLARITY polarity = POLARITY_NORMAL;
|
||||
BACNET_BINARY_PV value = BINARY_INACTIVE;
|
||||
BACNET_CHARACTER_STRING char_string = {0};
|
||||
BACNET_CHARACTER_STRING char_string = { 0 };
|
||||
uint8_t *apdu = NULL;
|
||||
|
||||
if ((rpdata->application_data == NULL) ||
|
||||
@@ -198,13 +198,11 @@ int Binary_Input_Read_Property(
|
||||
case PROP_OBJECT_NAME:
|
||||
Binary_Input_Object_Name(rpdata->object_instance, &char_string);
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0],
|
||||
&char_string);
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0],
|
||||
rpdata->object_type);
|
||||
encode_application_enumerated(&apdu[0], rpdata->object_type);
|
||||
break;
|
||||
case PROP_PRESENT_VALUE:
|
||||
value = Binary_Input_Present_Value(rpdata->object_instance);
|
||||
|
||||
@@ -250,8 +250,8 @@ int Binary_Output_Read_Property(
|
||||
{
|
||||
int len = 0;
|
||||
int apdu_len = 0; /* return value */
|
||||
BACNET_BIT_STRING bit_string = {0};
|
||||
BACNET_CHARACTER_STRING char_string = {0};
|
||||
BACNET_BIT_STRING bit_string = { 0 };
|
||||
BACNET_CHARACTER_STRING char_string = { 0 };
|
||||
BACNET_BINARY_PV present_value = BINARY_INACTIVE;
|
||||
unsigned object_index = 0;
|
||||
unsigned i = 0;
|
||||
@@ -272,13 +272,11 @@ int Binary_Output_Read_Property(
|
||||
case PROP_OBJECT_NAME:
|
||||
Binary_Output_Object_Name(rpdata->object_instance, &char_string);
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0],
|
||||
&char_string);
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0],
|
||||
rpdata->object_type);
|
||||
encode_application_enumerated(&apdu[0], rpdata->object_type);
|
||||
break;
|
||||
case PROP_PRESENT_VALUE:
|
||||
present_value =
|
||||
@@ -461,8 +459,8 @@ bool Binary_Output_Write_Property(
|
||||
priority = wp_data->priority;
|
||||
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
|
||||
priority--;
|
||||
Binary_Output_Present_Value_Set(wp_data->
|
||||
object_instance, level, priority);
|
||||
Binary_Output_Present_Value_Set
|
||||
(wp_data->object_instance, level, priority);
|
||||
} else if (priority == 6) {
|
||||
status = false;
|
||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
#if (__GNUC__ <= 4) && (__GNUC_MINOR__ < 3)
|
||||
|
||||
#if !defined(EEWE) && defined(EEPE)
|
||||
# define EEWE EEPE
|
||||
#define EEWE EEPE
|
||||
#endif
|
||||
|
||||
#if !defined(EEMWE) && defined(EEMPE)
|
||||
# define EEMWE EEMPE
|
||||
#define EEMWE EEMPE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,55 +20,55 @@
|
||||
#if defined(__ICCAVR__)
|
||||
|
||||
/* IAR Embedded Workbench */
|
||||
# include <inavr.h>
|
||||
#include <inavr.h>
|
||||
|
||||
# define _GET_LOCK_BITS() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0001, 0x09 )
|
||||
# define _GET_LOW_FUSES() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0000, 0x09 )
|
||||
# define _GET_HIGH_FUSES() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0003, 0x09 )
|
||||
# define _GET_EXTENDED_FUSES() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0002, 0x09 )
|
||||
# define _SET_LOCK_BITS(data) __DataToR0ByteToSPMCR_SPM( data, 0x09 )
|
||||
# define _ENABLE_RWW_SECTION() __DataToR0ByteToSPMCR_SPM( 0x00, 0x11 )
|
||||
#define _GET_LOCK_BITS() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0001, 0x09 )
|
||||
#define _GET_LOW_FUSES() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0000, 0x09 )
|
||||
#define _GET_HIGH_FUSES() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0003, 0x09 )
|
||||
#define _GET_EXTENDED_FUSES() __AddrToZByteToSPMCR_LPM( (void __flash *) 0x0002, 0x09 )
|
||||
#define _SET_LOCK_BITS(data) __DataToR0ByteToSPMCR_SPM( data, 0x09 )
|
||||
#define _ENABLE_RWW_SECTION() __DataToR0ByteToSPMCR_SPM( 0x00, 0x11 )
|
||||
|
||||
# define _WAIT_FOR_SPM() while( SPMCR_REG & (1<<SPMEN) );
|
||||
#define _WAIT_FOR_SPM() while( SPMCR_REG & (1<<SPMEN) );
|
||||
|
||||
# ifndef LARGE_MEMORY
|
||||
# define _LOAD_PROGRAM_MEMORY(addr) __load_program_memory( (const unsigned char __flash *) (addr) )
|
||||
# define _FILL_TEMP_WORD(addr,data) __AddrToZWordToR1R0ByteToSPMCR_SPM( (void __flash *) (addr), data, 0x01 )
|
||||
# define _PAGE_ERASE(addr) __AddrToZByteToSPMCR_SPM( (void __flash *) (addr), 0x03 )
|
||||
# define _PAGE_WRITE(addr) __AddrToZByteToSPMCR_SPM( (void __flash *) (addr), 0x05 )
|
||||
# else /* LARGE_MEMORY */
|
||||
# define _LOAD_PROGRAM_MEMORY(addr) __extended_load_program_memory( (const unsigned char __farflash *) (addr) )
|
||||
# define _FILL_TEMP_WORD(addr,data) __AddrToZ24WordToR1R0ByteToSPMCR_SPM( (void __farflash *) (addr), data, 0x01 )
|
||||
# define _PAGE_ERASE(addr) __AddrToZ24ByteToSPMCR_SPM( (void __farflash *) (addr), 0x03 )
|
||||
# define _PAGE_WRITE(addr) __AddrToZ24ByteToSPMCR_SPM( (void __farflash *) (addr), 0x05 )
|
||||
# endif /* LARGE_MEMORY */
|
||||
#ifndef LARGE_MEMORY
|
||||
#define _LOAD_PROGRAM_MEMORY(addr) __load_program_memory( (const unsigned char __flash *) (addr) )
|
||||
#define _FILL_TEMP_WORD(addr,data) __AddrToZWordToR1R0ByteToSPMCR_SPM( (void __flash *) (addr), data, 0x01 )
|
||||
#define _PAGE_ERASE(addr) __AddrToZByteToSPMCR_SPM( (void __flash *) (addr), 0x03 )
|
||||
#define _PAGE_WRITE(addr) __AddrToZByteToSPMCR_SPM( (void __flash *) (addr), 0x05 )
|
||||
#else /* LARGE_MEMORY */
|
||||
#define _LOAD_PROGRAM_MEMORY(addr) __extended_load_program_memory( (const unsigned char __farflash *) (addr) )
|
||||
#define _FILL_TEMP_WORD(addr,data) __AddrToZ24WordToR1R0ByteToSPMCR_SPM( (void __farflash *) (addr), data, 0x01 )
|
||||
#define _PAGE_ERASE(addr) __AddrToZ24ByteToSPMCR_SPM( (void __farflash *) (addr), 0x03 )
|
||||
#define _PAGE_WRITE(addr) __AddrToZ24ByteToSPMCR_SPM( (void __farflash *) (addr), 0x05 )
|
||||
#endif /* LARGE_MEMORY */
|
||||
|
||||
#elif __GNUC__ > 0
|
||||
|
||||
/* AVR-GCC/avr-libc */
|
||||
# include <avr/boot.h>
|
||||
# include <avr/pgmspace.h>
|
||||
#include <avr/boot.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
# if defined(GET_LOCK_BITS) /* avr-libc >= 1.2.5 */
|
||||
# define _GET_LOCK_BITS() boot_lock_fuse_bits_get(GET_LOCK_BITS)
|
||||
# define _GET_LOW_FUSES() boot_lock_fuse_bits_get(GET_LOW_FUSE_BITS)
|
||||
# define _GET_HIGH_FUSES() boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS)
|
||||
# define _GET_EXTENDED_FUSES() boot_lock_fuse_bits_get(GET_EXTENDED_FUSE_BITS)
|
||||
# endif /* defined(GET_LOCK_BITS) */
|
||||
# define _SET_LOCK_BITS(data) boot_lock_bits_set(~data)
|
||||
# define _ENABLE_RWW_SECTION() boot_rww_enable()
|
||||
#if defined(GET_LOCK_BITS) /* avr-libc >= 1.2.5 */
|
||||
#define _GET_LOCK_BITS() boot_lock_fuse_bits_get(GET_LOCK_BITS)
|
||||
#define _GET_LOW_FUSES() boot_lock_fuse_bits_get(GET_LOW_FUSE_BITS)
|
||||
#define _GET_HIGH_FUSES() boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS)
|
||||
#define _GET_EXTENDED_FUSES() boot_lock_fuse_bits_get(GET_EXTENDED_FUSE_BITS)
|
||||
#endif /* defined(GET_LOCK_BITS) */
|
||||
#define _SET_LOCK_BITS(data) boot_lock_bits_set(~data)
|
||||
#define _ENABLE_RWW_SECTION() boot_rww_enable()
|
||||
|
||||
# define _WAIT_FOR_SPM() boot_spm_busy_wait()
|
||||
#define _WAIT_FOR_SPM() boot_spm_busy_wait()
|
||||
|
||||
# ifndef LARGE_MEMORY
|
||||
# define _LOAD_PROGRAM_MEMORY(addr) pgm_read_byte_near(addr)
|
||||
# else /* LARGE_MEMORY */
|
||||
# define _LOAD_PROGRAM_MEMORY(addr) pgm_read_byte_far(addr)
|
||||
# endif /* LARGE_MEMORY */
|
||||
# define _FILL_TEMP_WORD(addr,data) boot_page_fill(addr, data)
|
||||
# define _PAGE_ERASE(addr) boot_page_erase(addr)
|
||||
# define _PAGE_WRITE(addr) boot_page_write(addr)
|
||||
#ifndef LARGE_MEMORY
|
||||
#define _LOAD_PROGRAM_MEMORY(addr) pgm_read_byte_near(addr)
|
||||
#else /* LARGE_MEMORY */
|
||||
#define _LOAD_PROGRAM_MEMORY(addr) pgm_read_byte_far(addr)
|
||||
#endif /* LARGE_MEMORY */
|
||||
#define _FILL_TEMP_WORD(addr,data) boot_page_fill(addr, data)
|
||||
#define _PAGE_ERASE(addr) boot_page_erase(addr)
|
||||
#define _PAGE_WRITE(addr) boot_page_write(addr)
|
||||
|
||||
#else
|
||||
# error "Don't know your compiler."
|
||||
#error "Don't know your compiler."
|
||||
#endif
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
* smaller devices.
|
||||
*/
|
||||
#ifdef LARGE_MEMORY
|
||||
# define ADDR_T unsigned long
|
||||
#define ADDR_T unsigned long
|
||||
#else /* !LARGE_MEMORY */
|
||||
# define ADDR_T unsigned int
|
||||
#define ADDR_T unsigned int
|
||||
#endif /* LARGE_MEMORY */
|
||||
|
||||
#ifndef REMOVE_BLOCK_SUPPORT
|
||||
|
||||
@@ -561,8 +561,8 @@ int Device_Read_Property_Local(
|
||||
{
|
||||
int apdu_len = 0; /* return value */
|
||||
int len = 0; /* apdu len intermediate value */
|
||||
BACNET_BIT_STRING bit_string = {0};
|
||||
BACNET_CHARACTER_STRING char_string = {0};
|
||||
BACNET_BIT_STRING bit_string = { 0 };
|
||||
BACNET_CHARACTER_STRING char_string = { 0 };
|
||||
unsigned i = 0;
|
||||
int object_type = 0;
|
||||
uint32_t instance = 0;
|
||||
@@ -575,7 +575,7 @@ int Device_Read_Property_Local(
|
||||
return 0;
|
||||
}
|
||||
apdu = rpdata->application_data;
|
||||
switch ((int)rpdata->object_property) {
|
||||
switch ((int) rpdata->object_property) {
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
apdu_len =
|
||||
encode_application_object_id(&apdu[0], rpdata->object_type,
|
||||
@@ -584,13 +584,11 @@ int Device_Read_Property_Local(
|
||||
case PROP_OBJECT_NAME:
|
||||
Device_Object_Name(rpdata->object_instance, &char_string);
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0],
|
||||
&char_string);
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0],
|
||||
rpdata->object_type);
|
||||
encode_application_enumerated(&apdu[0], rpdata->object_type);
|
||||
break;
|
||||
case PROP_DESCRIPTION:
|
||||
bacnet_name(NV_EEPROM_DEVICE_DESCRIPTION, &char_string,
|
||||
@@ -801,12 +799,12 @@ bool Device_Write_Property_Local(
|
||||
wp_data->error_code = ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY;
|
||||
return false;
|
||||
}
|
||||
switch ((int)wp_data->object_property) {
|
||||
switch ((int) wp_data->object_property) {
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
|
||||
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
|
||||
(Device_Set_Object_Instance_Number(value.type.Object_Id.
|
||||
instance))) {
|
||||
(Device_Set_Object_Instance_Number(value.type.
|
||||
Object_Id.instance))) {
|
||||
eeprom_bytes_write(NV_EEPROM_DEVICE_0,
|
||||
(uint8_t *) & value.type.Object_Id.instance, 4);
|
||||
/* we could send an I-Am broadcast to let the world know */
|
||||
@@ -855,10 +853,8 @@ bool Device_Write_Property_Local(
|
||||
if (value.tag == BACNET_APPLICATION_TAG_CHARACTER_STRING) {
|
||||
status =
|
||||
bacnet_name_write_unique(NV_EEPROM_DEVICE_NAME,
|
||||
wp_data->object_type,
|
||||
wp_data->object_instance,
|
||||
&value.type.Character_String,
|
||||
&wp_data->error_class,
|
||||
wp_data->object_type, wp_data->object_instance,
|
||||
&value.type.Character_String, &wp_data->error_class,
|
||||
&wp_data->error_code);
|
||||
} else {
|
||||
wp_data->error_class = ERROR_CLASS_PROPERTY;
|
||||
|
||||
@@ -1129,8 +1129,8 @@ static bool MSTP_Master_Node_FSM(
|
||||
if (pkt != NULL) {
|
||||
matched =
|
||||
dlmstp_compare_data_expecting_reply(&InputBuffer[0],
|
||||
DataLength, SourceAddress, &pkt->buffer[0], pkt->length,
|
||||
pkt->destination_mac);
|
||||
DataLength, SourceAddress, &pkt->buffer[0],
|
||||
pkt->length, pkt->destination_mac);
|
||||
} else {
|
||||
matched = false;
|
||||
}
|
||||
@@ -1146,10 +1146,12 @@ static bool MSTP_Master_Node_FSM(
|
||||
if (pkt->data_expecting_reply) {
|
||||
frame_type = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY;
|
||||
} else {
|
||||
frame_type = FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY;
|
||||
frame_type =
|
||||
FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY;
|
||||
}
|
||||
MSTP_Send_Frame(frame_type, pkt->destination_mac, This_Station,
|
||||
(uint8_t *) & pkt->buffer[0], pkt->length);
|
||||
MSTP_Send_Frame(frame_type, pkt->destination_mac,
|
||||
This_Station, (uint8_t *) & pkt->buffer[0],
|
||||
pkt->length);
|
||||
Master_State = MSTP_MASTER_STATE_IDLE;
|
||||
/* clear our flag we were holding for comparison */
|
||||
MSTP_Flag.ReceivedValidFrame = false;
|
||||
@@ -1354,4 +1356,3 @@ void dlmstp_get_broadcast_address(
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -330,12 +330,12 @@ unsigned char __uint8_eeprom_load(
|
||||
#define power_timer2_enable() (PRR0 &= (uint8_t)~(1 << PRTIM2))
|
||||
#endif
|
||||
#if (defined(__GNUC__) && ((__GNUC__ == 4) && (__GNUC_MINOR__ < 5)))
|
||||
#if defined(__AVR_ATmega644P__)
|
||||
#if defined(__AVR_ATmega644P__)
|
||||
/* bug in WinAVR - fixed in later versions */
|
||||
#define power_usart1_enable() (PRR &= (uint8_t)~(1 << PRUSART1))
|
||||
#elif defined(__AVR_ATmega1284P__)
|
||||
#define power_usart1_enable() (PRR0 &= (uint8_t)~(1 << PRUSART1))
|
||||
#endif
|
||||
#define power_usart1_enable() (PRR &= (uint8_t)~(1 << PRUSART1))
|
||||
#elif defined(__AVR_ATmega1284P__)
|
||||
#define power_usart1_enable() (PRR0 &= (uint8_t)~(1 << PRUSART1))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__CROSSWORKS_AVR)
|
||||
|
||||
Reference in New Issue
Block a user