From 89432a85c336ed2d278afe4baafaafac995a987f Mon Sep 17 00:00:00 2001 From: skarg Date: Tue, 8 Jan 2008 23:13:51 +0000 Subject: [PATCH] Applied standard indentation to files. --- bacnet-stack/demo/handler/h_cov.c | 26 +-- bacnet-stack/demo/object/bi.c | 14 +- bacnet-stack/demo/object/device.c | 5 +- bacnet-stack/demo/server/main.c | 120 ++++++------ bacnet-stack/demo/whois/main.c | 4 +- bacnet-stack/include/datalink.h | 2 +- bacnet-stack/include/rp.h | 2 +- bacnet-stack/ports/at91sam7s/isr.h | 24 +-- bacnet-stack/ports/at91sam7s/main.c | 6 +- bacnet-stack/ports/atmega168/device.c | 2 +- bacnet-stack/ports/atmega168/h_rp.c | 19 +- bacnet-stack/ports/atmega168/hardware.h | 10 +- bacnet-stack/ports/atmega168/iar2gcc.h | 248 ++++++++++++------------ bacnet-stack/ports/atmega168/timer.c | 3 +- bacnet-stack/ports/win32/rs485.c | 6 +- bacnet-stack/src/datalink.c | 9 +- bacnet-stack/src/rp.c | 4 +- 17 files changed, 254 insertions(+), 250 deletions(-) diff --git a/bacnet-stack/demo/handler/h_cov.c b/bacnet-stack/demo/handler/h_cov.c index ab2b4e03..61db1836 100644 --- a/bacnet-stack/demo/handler/h_cov.c +++ b/bacnet-stack/demo/handler/h_cov.c @@ -84,22 +84,22 @@ void handler_cov_init( static bool cov_list_subscribe( BACNET_ADDRESS * src, - BACNET_SUBSCRIBE_COV_DATA *cov_data) + BACNET_SUBSCRIBE_COV_DATA * cov_data) { bool existing_entry = false; int index; int first_invalid_index = -1; bool found = true; - + /* existing? - match Object ID and Process ID */ for (index = 0; index < MAX_COV_SUBCRIPTIONS; index++) { if ((COV_Subscriptions[index].valid) && (COV_Subscriptions[index].monitoredObjectIdentifier.type == - cov_data->monitoredObjectIdentifier.type) && + cov_data->monitoredObjectIdentifier.type) && (COV_Subscriptions[index].monitoredObjectIdentifier.instance == - cov_data->monitoredObjectIdentifier.instance) && + cov_data->monitoredObjectIdentifier.instance) && (COV_Subscriptions[index].subscriberProcessIdentifier == - cov_data->subscriberProcessIdentifier)) { + cov_data->subscriberProcessIdentifier)) { existing_entry = true; if (cov_data->cancellationRequest) { COV_Subscriptions[index].valid = false; @@ -107,8 +107,7 @@ static bool cov_list_subscribe( bacnet_address_copy(&COV_Subscriptions[index].dest, src); COV_Subscriptions[index].issueConfirmedNotifications = cov_data->issueConfirmedNotifications; - COV_Subscriptions[index].lifetime = - cov_data->lifetime; + COV_Subscriptions[index].lifetime = cov_data->lifetime; } break; } else { @@ -131,8 +130,7 @@ static bool cov_list_subscribe( cov_data->subscriberProcessIdentifier; COV_Subscriptions[index].issueConfirmedNotifications = cov_data->issueConfirmedNotifications; - COV_Subscriptions[index].lifetime = - cov_data->lifetime; + COV_Subscriptions[index].lifetime = cov_data->lifetime; } else { found = false; } @@ -149,7 +147,7 @@ void handler_cov_task( int lifetime_milliseconds; BACNET_OBJECT_ID object_id; - + /* existing? - match Object ID and Process ID */ for (index = 0; index < MAX_COV_SUBCRIPTIONS; index++) { if (COV_Subscriptions[index].valid) { @@ -164,8 +162,10 @@ void handler_cov_task( COV_Subscriptions[index].valid = false; } /* handle COV notifications */ - object_id.type = COV_Subscriptions[index].monitoredObjectIdentifier.type; - object_id.instance = COV_Subscriptions[index].monitoredObjectIdentifier.instance; + object_id.type = + COV_Subscriptions[index].monitoredObjectIdentifier.type; + object_id.instance = + COV_Subscriptions[index].monitoredObjectIdentifier.instance; switch (object_id.type) { case OBJECT_BINARY_INPUT: if (Binary_Input_Change_Of_Value(object_id.instance)) { @@ -190,7 +190,7 @@ static bool cov_subscribe( switch (cov_data->monitoredObjectIdentifier.type) { case OBJECT_BINARY_INPUT: status = true; - status = cov_list_subscribe(src,cov_data); + status = cov_list_subscribe(src, cov_data); break; default: /* FIXME: what is the ERROR? */ diff --git a/bacnet-stack/demo/object/bi.c b/bacnet-stack/demo/object/bi.c index 86510cbc..066faaca 100644 --- a/bacnet-stack/demo/object/bi.c +++ b/bacnet-stack/demo/object/bi.c @@ -171,16 +171,16 @@ static bool Binary_Input_Out_Of_Service( } bool Binary_Input_Change_Of_Value( - uint32_t object_instance) + uint32_t object_instance) { bool status = false; unsigned index; - + index = Binary_Input_Instance_To_Index(object_instance); if (index < MAX_BINARY_INPUTS) { status = Change_Of_Value[index]; } - + return status; } @@ -214,7 +214,7 @@ static void Binary_Input_Out_Of_Service_Set( if (Out_Of_Service[index] != value) { Change_Of_Value[index] = true; } - Out_Of_Service[index] = value; + Out_Of_Service[index] = value; return; } @@ -281,9 +281,11 @@ int Binary_Input_Encode_Property_APDU( bitstring_set_bit(&bit_string, STATUS_FLAG_FAULT, false); bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); if (Binary_Input_Out_Of_Service(object_instance)) { - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, true); + bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, + true); } else { - bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, false); + bitstring_set_bit(&bit_string, STATUS_FLAG_OUT_OF_SERVICE, + false); } apdu_len = encode_application_bitstring(&apdu[0], &bit_string); break; diff --git a/bacnet-stack/demo/object/device.c b/bacnet-stack/demo/object/device.c index 30fb4984..fb5a4baa 100644 --- a/bacnet-stack/demo/object/device.c +++ b/bacnet-stack/demo/object/device.c @@ -994,7 +994,8 @@ bool Device_Write_Property( case PROP_MAX_INFO_FRAMES: if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { if (value.type.Unsigned_Int <= 255) { - dlmstp_set_max_info_frames((uint8_t)value.type.Unsigned_Int); + dlmstp_set_max_info_frames((uint8_t) value.type. + Unsigned_Int); status = true; } else { *error_class = ERROR_CLASS_PROPERTY; @@ -1009,7 +1010,7 @@ bool Device_Write_Property( if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { if ((value.type.Unsigned_Int > 0) && (value.type.Unsigned_Int <= 127)) { - dlmstp_set_max_master((uint8_t)value.type.Unsigned_Int); + dlmstp_set_max_master((uint8_t) value.type.Unsigned_Int); status = true; } else { *error_class = ERROR_CLASS_PROPERTY; diff --git a/bacnet-stack/demo/server/main.c b/bacnet-stack/demo/server/main.c index 6d5d3f37..57475234 100644 --- a/bacnet-stack/demo/server/main.c +++ b/bacnet-stack/demo/server/main.c @@ -118,69 +118,69 @@ int main( datalink_set("bip"); #endif #if defined(BACDL_BIP) - pEnv = getenv("BACNET_IP_PORT"); - if (pEnv) { - bip_set_port(strtol(pEnv, NULL, 0)); - } else { - bip_set_port(0xBAC0); - } + pEnv = getenv("BACNET_IP_PORT"); + if (pEnv) { + bip_set_port(strtol(pEnv, NULL, 0)); + } else { + bip_set_port(0xBAC0); + } #elif defined(BACDL_MSTP) - pEnv = getenv("BACNET_MAX_INFO_FRAMES"); - if (pEnv) { - dlmstp_set_max_info_frames(strtol(pEnv, NULL, 0)); - } else { - dlmstp_set_max_info_frames(1); - } - pEnv = getenv("BACNET_MAX_MASTER"); - if (pEnv) { - dlmstp_set_max_master(strtol(pEnv, NULL, 0)); - } else { - dlmstp_set_max_master(127); - } - pEnv = getenv("BACNET_MSTP_BAUD"); - if (pEnv) { - RS485_Set_Baud_Rate(strtol(pEnv, NULL, 0)); - } else { - RS485_Set_Baud_Rate(38400); - } - pEnv = getenv("BACNET_MSTP_MAC"); - if (pEnv) { - dlmstp_set_mac_address(strtol(pEnv, NULL, 0)); - } else { - dlmstp_set_mac_address(127); - } + pEnv = getenv("BACNET_MAX_INFO_FRAMES"); + if (pEnv) { + dlmstp_set_max_info_frames(strtol(pEnv, NULL, 0)); + } else { + dlmstp_set_max_info_frames(1); + } + pEnv = getenv("BACNET_MAX_MASTER"); + if (pEnv) { + dlmstp_set_max_master(strtol(pEnv, NULL, 0)); + } else { + dlmstp_set_max_master(127); + } + pEnv = getenv("BACNET_MSTP_BAUD"); + if (pEnv) { + RS485_Set_Baud_Rate(strtol(pEnv, NULL, 0)); + } else { + RS485_Set_Baud_Rate(38400); + } + pEnv = getenv("BACNET_MSTP_MAC"); + if (pEnv) { + dlmstp_set_mac_address(strtol(pEnv, NULL, 0)); + } else { + dlmstp_set_mac_address(127); + } #endif - printf("BACnet Server Demo\n" "BACnet Stack Version %s\n" - "BACnet Device ID: %u\n" "Max APDU: %d\n", BACnet_Version, - Device_Object_Instance_Number(), MAX_APDU); - Init_Service_Handlers(); - BIP_Debug = true; - if (!datalink_init(getenv("BACNET_IFACE"))) - return 1; - atexit(cleanup); - /* configure the timeout values */ - last_seconds = time(NULL); - /* broadcast an I-Am on startup */ - iam_send(&Handler_Transmit_Buffer[0]); - /* loop forever */ - for (;;) { - /* input */ - current_seconds = time(NULL); + printf("BACnet Server Demo\n" "BACnet Stack Version %s\n" + "BACnet Device ID: %u\n" "Max APDU: %d\n", BACnet_Version, + Device_Object_Instance_Number(), MAX_APDU); + Init_Service_Handlers(); + BIP_Debug = true; + if (!datalink_init(getenv("BACNET_IFACE"))) + return 1; + atexit(cleanup); + /* configure the timeout values */ + last_seconds = time(NULL); + /* broadcast an I-Am on startup */ + iam_send(&Handler_Transmit_Buffer[0]); + /* loop forever */ + for (;;) { + /* input */ + current_seconds = time(NULL); - /* returns 0 bytes on timeout */ - pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout); + /* returns 0 bytes on timeout */ + pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout); - /* process */ - if (pdu_len) { - npdu_handler(&src, &Rx_Buf[0], pdu_len); + /* process */ + if (pdu_len) { + npdu_handler(&src, &Rx_Buf[0], pdu_len); + } + /* at least one second has passed */ + if (current_seconds != last_seconds) { + dcc_timer_seconds(current_seconds - last_seconds); + Load_Control_State_Machine_Handler(); + } + /* output */ + + /* blink LEDs, Turn on or off outputs, etc */ } - /* at least one second has passed */ - if (current_seconds != last_seconds) { - dcc_timer_seconds(current_seconds - last_seconds); - Load_Control_State_Machine_Handler(); - } - /* output */ - - /* blink LEDs, Turn on or off outputs, etc */ } -} diff --git a/bacnet-stack/demo/whois/main.c b/bacnet-stack/demo/whois/main.c index 6f93ef32..f7b062b2 100644 --- a/bacnet-stack/demo/whois/main.c +++ b/bacnet-stack/demo/whois/main.c @@ -109,8 +109,8 @@ static void print_address_cache( uint32_t device_id = 0; unsigned max_apdu = 0; - printf("%-7s %-14s %-4s %-5s %-14s\n", - "Device","MAC","APDU","SNET","SADR"); + printf("%-7s %-14s %-4s %-5s %-14s\n", "Device", "MAC", "APDU", "SNET", + "SADR"); printf("------- -------------- ---- ----- --------------\n"); for (i = 0; i < MAX_ADDRESS_CACHE; i++) { if (address_get_by_index(i, &device_id, &max_apdu, &address)) { diff --git a/bacnet-stack/include/datalink.h b/bacnet-stack/include/datalink.h index a6087bc6..7bb1855f 100644 --- a/bacnet-stack/include/datalink.h +++ b/bacnet-stack/include/datalink.h @@ -90,7 +90,7 @@ #define MAX_HEADER (8) #define MAX_MPDU (MAX_HEADER+MAX_PDU) - int datalink_send_pdu( +int datalink_send_pdu( BACNET_ADDRESS * dest, BACNET_NPDU_DATA * npdu_data, uint8_t * pdu, diff --git a/bacnet-stack/include/rp.h b/bacnet-stack/include/rp.h index 2c583291..687c0ea5 100644 --- a/bacnet-stack/include/rp.h +++ b/bacnet-stack/include/rp.h @@ -70,7 +70,7 @@ extern "C" { int rp_ack_encode_apdu_object_property_end( uint8_t * apdu); - + /* method to encode the ack using extra buffer */ int rp_ack_encode_apdu( uint8_t * apdu, diff --git a/bacnet-stack/ports/at91sam7s/isr.h b/bacnet-stack/ports/at91sam7s/isr.h index 882a3a22..79b4511b 100644 --- a/bacnet-stack/ports/at91sam7s/isr.h +++ b/bacnet-stack/ports/at91sam7s/isr.h @@ -32,23 +32,23 @@ extern "C" { #endif /* __cplusplus */ -unsigned disableIRQ( - void); + unsigned disableIRQ( + void); -unsigned restoreIRQ( - unsigned oldCPSR); + unsigned restoreIRQ( + unsigned oldCPSR); -unsigned enableIRQ( - void); + unsigned enableIRQ( + void); -unsigned disableFIQ( - void); + unsigned disableFIQ( + void); -unsigned restoreFIQ( - unsigned oldCPSR); + unsigned restoreFIQ( + unsigned oldCPSR); -unsigned enableFIQ( - void); + unsigned enableFIQ( + void); #ifdef __cplusplus } diff --git a/bacnet-stack/ports/at91sam7s/main.c b/bacnet-stack/ports/at91sam7s/main.c index 0b60f60d..fe398a80 100644 --- a/bacnet-stack/ports/at91sam7s/main.c +++ b/bacnet-stack/ports/at91sam7s/main.c @@ -157,7 +157,7 @@ static inline void bacnet_init( handler_device_communication_control); } -static uint8_t Receive_PDU[MAX_MPDU]; /* PDU data */ +static uint8_t Receive_PDU[MAX_MPDU]; /* PDU data */ int main( void) { @@ -236,8 +236,8 @@ int main( /* count # of times through the idle loop */ IdleCount++; /* BACnet handling */ - pdu_len = datalink_receive(&src, - &Receive_PDU[0], sizeof(Receive_PDU), 0); + pdu_len = + datalink_receive(&src, &Receive_PDU[0], sizeof(Receive_PDU), 0); if (pdu_len) { pPIO->PIO_CODR = LED3; npdu_handler(&src, &Receive_PDU[0], pdu_len); diff --git a/bacnet-stack/ports/atmega168/device.c b/bacnet-stack/ports/atmega168/device.c index a112e5ba..f6a9e8c4 100644 --- a/bacnet-stack/ports/atmega168/device.c +++ b/bacnet-stack/ports/atmega168/device.c @@ -270,7 +270,7 @@ int Device_Encode_Property_APDU( for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) { /* automatic lookup based on handlers set */ bitstring_set_bit(&bit_string, (uint8_t) i, - apdu_service_supported((BACNET_SERVICES_SUPPORTED)i)); + apdu_service_supported((BACNET_SERVICES_SUPPORTED) i)); } apdu_len = encode_application_bitstring(&apdu[0], &bit_string); break; diff --git a/bacnet-stack/ports/atmega168/h_rp.c b/bacnet-stack/ports/atmega168/h_rp.c index f8ec7c29..a3cc31d3 100644 --- a/bacnet-stack/ports/atmega168/h_rp.c +++ b/bacnet-stack/ports/atmega168/h_rp.c @@ -126,18 +126,19 @@ void handler_read_property( } else { /* most cases will be error */ error = true; - ack_len = rp_ack_encode_apdu_init( - &Handler_Transmit_Buffer[pdu_len], + ack_len = + rp_ack_encode_apdu_init(&Handler_Transmit_Buffer[pdu_len], service_data->invoke_id, &data); /* FIXME: add buffer len as passed into function or use smart buffer */ - property_len = Encode_Property_APDU( - &Handler_Transmit_Buffer[pdu_len + ack_len], data.object_type, - data.object_instance, data.object_property, data.array_index, - &error_class, &error_code); + property_len = + Encode_Property_APDU(&Handler_Transmit_Buffer[pdu_len + ack_len], + data.object_type, data.object_instance, data.object_property, + data.array_index, &error_class, &error_code); if (len >= 0) { - len = rp_ack_encode_apdu_object_property_end( - &Handler_Transmit_Buffer[pdu_len + property_len + ack_len]); - len += ack_len + property_len; + len = + rp_ack_encode_apdu_object_property_end(&Handler_Transmit_Buffer + [pdu_len + property_len + ack_len]); + len += ack_len + property_len; error = false; } } diff --git a/bacnet-stack/ports/atmega168/hardware.h b/bacnet-stack/ports/atmega168/hardware.h index b5cfc2db..e096ec22 100644 --- a/bacnet-stack/ports/atmega168/hardware.h +++ b/bacnet-stack/ports/atmega168/hardware.h @@ -27,15 +27,15 @@ #if !defined(F_CPU) /* The processor clock frequency */ - #define F_CPU (7372800) +#define F_CPU (7372800) #endif #if defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ASM__) - #include +#include #else - #if !defined(__AVR_ATmega168__) - #error Firmware is configured for ATmega168 only (-mmcu=atmega168) - #endif +#if !defined(__AVR_ATmega168__) +#error Firmware is configured for ATmega168 only (-mmcu=atmega168) +#endif #endif #include "iar2gcc.h" #include "avr035.h" diff --git a/bacnet-stack/ports/atmega168/iar2gcc.h b/bacnet-stack/ports/atmega168/iar2gcc.h index 40521e42..7afbfd41 100644 --- a/bacnet-stack/ports/atmega168/iar2gcc.h +++ b/bacnet-stack/ports/atmega168/iar2gcc.h @@ -35,161 +35,161 @@ #define IAR2GCC_H #if defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ASM__) - #include - #include - #define _BV(bit_num) (1 << (bit_num)) - #define _delay_us(x) \ +#include +#include +#define _BV(bit_num) (1 << (bit_num)) +#define _delay_us(x) \ /* inline function */ -static inline void delay_us(uint8_t microseconds) +static inline void delay_us( + uint8_t microseconds) { do { - __delay_cycles(F_CPU/1000000); + __delay_cycles(F_CPU / 1000000); } while (microseconds--); } #else - #if !defined(F_CPU) - #define F_CPU (7372800) - #endif - #include - #include - #include +#if !defined(F_CPU) +#define F_CPU (7372800) +#endif +#include +#include +#include - typedef struct - { - unsigned char bit0:1; - unsigned char bit1:1; - unsigned char bit2:1; - unsigned char bit3:1; - unsigned char bit4:1; - unsigned char bit5:1; - unsigned char bit6:1; - unsigned char bit7:1; - } BitRegisterType; +typedef struct { + unsigned char bit0:1; + unsigned char bit1:1; + unsigned char bit2:1; + unsigned char bit3:1; + unsigned char bit4:1; + unsigned char bit5:1; + unsigned char bit6:1; + unsigned char bit7:1; +} BitRegisterType; - #ifndef true - #define true 1 - #endif +#ifndef true +#define true 1 +#endif - #ifndef false - #define false 0 - #endif +#ifndef false +#define false 0 +#endif - #define GPIO_BITREG(port,bitnum) \ +#define GPIO_BITREG(port,bitnum) \ ((volatile BitRegisterType*)_SFR_MEM_ADDR(port) \ )->bit ## bitnum - #define PINA_Bit0 GPIO_BITREG(PINA,0) - #define PINA_Bit1 GPIO_BITREG(PINA,1) - #define PINA_Bit2 GPIO_BITREG(PINA,2) - #define PINA_Bit3 GPIO_BITREG(PINA,3) - #define PINA_Bit4 GPIO_BITREG(PINA,4) - #define PINA_Bit5 GPIO_BITREG(PINA,5) - #define PINA_Bit6 GPIO_BITREG(PINA,6) - #define PINA_Bit7 GPIO_BITREG(PINA,7) +#define PINA_Bit0 GPIO_BITREG(PINA,0) +#define PINA_Bit1 GPIO_BITREG(PINA,1) +#define PINA_Bit2 GPIO_BITREG(PINA,2) +#define PINA_Bit3 GPIO_BITREG(PINA,3) +#define PINA_Bit4 GPIO_BITREG(PINA,4) +#define PINA_Bit5 GPIO_BITREG(PINA,5) +#define PINA_Bit6 GPIO_BITREG(PINA,6) +#define PINA_Bit7 GPIO_BITREG(PINA,7) - #define PORTA_Bit0 GPIO_BITREG(PORTA,0) - #define PORTA_Bit1 GPIO_BITREG(PORTA,1) - #define PORTA_Bit2 GPIO_BITREG(PORTA,2) - #define PORTA_Bit3 GPIO_BITREG(PORTA,3) - #define PORTA_Bit4 GPIO_BITREG(PORTA,4) - #define PORTA_Bit5 GPIO_BITREG(PORTA,5) - #define PORTA_Bit6 GPIO_BITREG(PORTA,6) - #define PORTA_Bit7 GPIO_BITREG(PORTA,7) +#define PORTA_Bit0 GPIO_BITREG(PORTA,0) +#define PORTA_Bit1 GPIO_BITREG(PORTA,1) +#define PORTA_Bit2 GPIO_BITREG(PORTA,2) +#define PORTA_Bit3 GPIO_BITREG(PORTA,3) +#define PORTA_Bit4 GPIO_BITREG(PORTA,4) +#define PORTA_Bit5 GPIO_BITREG(PORTA,5) +#define PORTA_Bit6 GPIO_BITREG(PORTA,6) +#define PORTA_Bit7 GPIO_BITREG(PORTA,7) - #define PINB_Bit0 GPIO_BITREG(PINB,0) - #define PINB_Bit1 GPIO_BITREG(PINB,1) - #define PINB_Bit2 GPIO_BITREG(PINB,2) - #define PINB_Bit3 GPIO_BITREG(PINB,3) - #define PINB_Bit4 GPIO_BITREG(PINB,4) - #define PINB_Bit5 GPIO_BITREG(PINB,5) - #define PINB_Bit6 GPIO_BITREG(PINB,6) - #define PINB_Bit7 GPIO_BITREG(PINB,7) +#define PINB_Bit0 GPIO_BITREG(PINB,0) +#define PINB_Bit1 GPIO_BITREG(PINB,1) +#define PINB_Bit2 GPIO_BITREG(PINB,2) +#define PINB_Bit3 GPIO_BITREG(PINB,3) +#define PINB_Bit4 GPIO_BITREG(PINB,4) +#define PINB_Bit5 GPIO_BITREG(PINB,5) +#define PINB_Bit6 GPIO_BITREG(PINB,6) +#define PINB_Bit7 GPIO_BITREG(PINB,7) - #define PORTB_Bit0 GPIO_BITREG(PORTB,0) - #define PORTB_Bit1 GPIO_BITREG(PORTB,1) - #define PORTB_Bit2 GPIO_BITREG(PORTB,2) - #define PORTB_Bit3 GPIO_BITREG(PORTB,3) - #define PORTB_Bit4 GPIO_BITREG(PORTB,4) - #define PORTB_Bit5 GPIO_BITREG(PORTB,5) - #define PORTB_Bit6 GPIO_BITREG(PORTB,6) - #define PORTB_Bit7 GPIO_BITREG(PORTB,7) +#define PORTB_Bit0 GPIO_BITREG(PORTB,0) +#define PORTB_Bit1 GPIO_BITREG(PORTB,1) +#define PORTB_Bit2 GPIO_BITREG(PORTB,2) +#define PORTB_Bit3 GPIO_BITREG(PORTB,3) +#define PORTB_Bit4 GPIO_BITREG(PORTB,4) +#define PORTB_Bit5 GPIO_BITREG(PORTB,5) +#define PORTB_Bit6 GPIO_BITREG(PORTB,6) +#define PORTB_Bit7 GPIO_BITREG(PORTB,7) - #define PINC_Bit0 GPIO_BITREG(PINC,0) - #define PINC_Bit1 GPIO_BITREG(PINC,1) - #define PINC_Bit2 GPIO_BITREG(PINC,2) - #define PINC_Bit3 GPIO_BITREG(PINC,3) - #define PINC_Bit4 GPIO_BITREG(PINC,4) - #define PINC_Bit5 GPIO_BITREG(PINC,5) - #define PINC_Bit6 GPIO_BITREG(PINC,6) - #define PINC_Bit7 GPIO_BITREG(PINC,7) +#define PINC_Bit0 GPIO_BITREG(PINC,0) +#define PINC_Bit1 GPIO_BITREG(PINC,1) +#define PINC_Bit2 GPIO_BITREG(PINC,2) +#define PINC_Bit3 GPIO_BITREG(PINC,3) +#define PINC_Bit4 GPIO_BITREG(PINC,4) +#define PINC_Bit5 GPIO_BITREG(PINC,5) +#define PINC_Bit6 GPIO_BITREG(PINC,6) +#define PINC_Bit7 GPIO_BITREG(PINC,7) - #define PORTC_Bit0 GPIO_BITREG(PORTC,0) - #define PORTC_Bit1 GPIO_BITREG(PORTC,1) - #define PORTC_Bit2 GPIO_BITREG(PORTC,2) - #define PORTC_Bit3 GPIO_BITREG(PORTC,3) - #define PORTC_Bit4 GPIO_BITREG(PORTC,4) - #define PORTC_Bit5 GPIO_BITREG(PORTC,5) - #define PORTC_Bit6 GPIO_BITREG(PORTC,6) - #define PORTC_Bit7 GPIO_BITREG(PORTC,7) +#define PORTC_Bit0 GPIO_BITREG(PORTC,0) +#define PORTC_Bit1 GPIO_BITREG(PORTC,1) +#define PORTC_Bit2 GPIO_BITREG(PORTC,2) +#define PORTC_Bit3 GPIO_BITREG(PORTC,3) +#define PORTC_Bit4 GPIO_BITREG(PORTC,4) +#define PORTC_Bit5 GPIO_BITREG(PORTC,5) +#define PORTC_Bit6 GPIO_BITREG(PORTC,6) +#define PORTC_Bit7 GPIO_BITREG(PORTC,7) - #define PIND_Bit0 GPIO_BITREG(PIND,0) - #define PIND_Bit1 GPIO_BITREG(PIND,1) - #define PIND_Bit2 GPIO_BITREG(PIND,2) - #define PIND_Bit3 GPIO_BITREG(PIND,3) - #define PIND_Bit4 GPIO_BITREG(PIND,4) - #define PIND_Bit5 GPIO_BITREG(PIND,5) - #define PIND_Bit6 GPIO_BITREG(PIND,6) - #define PIND_Bit7 GPIO_BITREG(PIND,7) +#define PIND_Bit0 GPIO_BITREG(PIND,0) +#define PIND_Bit1 GPIO_BITREG(PIND,1) +#define PIND_Bit2 GPIO_BITREG(PIND,2) +#define PIND_Bit3 GPIO_BITREG(PIND,3) +#define PIND_Bit4 GPIO_BITREG(PIND,4) +#define PIND_Bit5 GPIO_BITREG(PIND,5) +#define PIND_Bit6 GPIO_BITREG(PIND,6) +#define PIND_Bit7 GPIO_BITREG(PIND,7) - #define PORTD_Bit0 GPIO_BITREG(PORTD,0) - #define PORTD_Bit1 GPIO_BITREG(PORTD,1) - #define PORTD_Bit2 GPIO_BITREG(PORTD,2) - #define PORTD_Bit3 GPIO_BITREG(PORTD,3) - #define PORTD_Bit4 GPIO_BITREG(PORTD,4) - #define PORTD_Bit5 GPIO_BITREG(PORTD,5) - #define PORTD_Bit6 GPIO_BITREG(PORTD,6) - #define PORTD_Bit7 GPIO_BITREG(PORTD,7) +#define PORTD_Bit0 GPIO_BITREG(PORTD,0) +#define PORTD_Bit1 GPIO_BITREG(PORTD,1) +#define PORTD_Bit2 GPIO_BITREG(PORTD,2) +#define PORTD_Bit3 GPIO_BITREG(PORTD,3) +#define PORTD_Bit4 GPIO_BITREG(PORTD,4) +#define PORTD_Bit5 GPIO_BITREG(PORTD,5) +#define PORTD_Bit6 GPIO_BITREG(PORTD,6) +#define PORTD_Bit7 GPIO_BITREG(PORTD,7) - #define GPIOR0_Bit0 GPIO_BITREG(GPIOR0,0) - #define GPIOR0_Bit1 GPIO_BITREG(GPIOR0,1) - #define GPIOR0_Bit2 GPIO_BITREG(GPIOR0,2) - #define GPIOR0_Bit3 GPIO_BITREG(GPIOR0,3) - #define GPIOR0_Bit4 GPIO_BITREG(GPIOR0,4) - #define GPIOR0_Bit5 GPIO_BITREG(GPIOR0,5) - #define GPIOR0_Bit6 GPIO_BITREG(GPIOR0,6) - #define GPIOR0_Bit7 GPIO_BITREG(GPIOR0,7) +#define GPIOR0_Bit0 GPIO_BITREG(GPIOR0,0) +#define GPIOR0_Bit1 GPIO_BITREG(GPIOR0,1) +#define GPIOR0_Bit2 GPIO_BITREG(GPIOR0,2) +#define GPIOR0_Bit3 GPIO_BITREG(GPIOR0,3) +#define GPIOR0_Bit4 GPIO_BITREG(GPIOR0,4) +#define GPIOR0_Bit5 GPIO_BITREG(GPIOR0,5) +#define GPIOR0_Bit6 GPIO_BITREG(GPIOR0,6) +#define GPIOR0_Bit7 GPIO_BITREG(GPIOR0,7) - #define GPIOR1_Bit0 GPIO_BITREG(GPIOR1,0) - #define GPIOR1_Bit1 GPIO_BITREG(GPIOR1,1) - #define GPIOR1_Bit2 GPIO_BITREG(GPIOR1,2) - #define GPIOR1_Bit3 GPIO_BITREG(GPIOR1,3) - #define GPIOR1_Bit4 GPIO_BITREG(GPIOR1,4) - #define GPIOR1_Bit5 GPIO_BITREG(GPIOR1,5) - #define GPIOR1_Bit6 GPIO_BITREG(GPIOR1,6) - #define GPIOR1_Bit7 GPIO_BITREG(GPIOR1,7) +#define GPIOR1_Bit0 GPIO_BITREG(GPIOR1,0) +#define GPIOR1_Bit1 GPIO_BITREG(GPIOR1,1) +#define GPIOR1_Bit2 GPIO_BITREG(GPIOR1,2) +#define GPIOR1_Bit3 GPIO_BITREG(GPIOR1,3) +#define GPIOR1_Bit4 GPIO_BITREG(GPIOR1,4) +#define GPIOR1_Bit5 GPIO_BITREG(GPIOR1,5) +#define GPIOR1_Bit6 GPIO_BITREG(GPIOR1,6) +#define GPIOR1_Bit7 GPIO_BITREG(GPIOR1,7) - #define GPIOR2_Bit0 GPIO_BITREG(GPIOR2,0) - #define GPIOR2_Bit1 GPIO_BITREG(GPIOR2,1) - #define GPIOR2_Bit2 GPIO_BITREG(GPIOR2,2) - #define GPIOR2_Bit3 GPIO_BITREG(GPIOR2,3) - #define GPIOR2_Bit4 GPIO_BITREG(GPIOR2,4) - #define GPIOR2_Bit5 GPIO_BITREG(GPIOR2,5) - #define GPIOR2_Bit6 GPIO_BITREG(GPIOR2,6) - #define GPIOR2_Bit7 GPIO_BITREG(GPIOR2,7) +#define GPIOR2_Bit0 GPIO_BITREG(GPIOR2,0) +#define GPIOR2_Bit1 GPIO_BITREG(GPIOR2,1) +#define GPIOR2_Bit2 GPIO_BITREG(GPIOR2,2) +#define GPIOR2_Bit3 GPIO_BITREG(GPIOR2,3) +#define GPIOR2_Bit4 GPIO_BITREG(GPIOR2,4) +#define GPIOR2_Bit5 GPIO_BITREG(GPIOR2,5) +#define GPIOR2_Bit6 GPIO_BITREG(GPIOR2,6) +#define GPIOR2_Bit7 GPIO_BITREG(GPIOR2,7) /* FIXME: intrinsic routines: map to assembler for size/speed */ - #define __multiply_unsigned(x,y) ((x)*(y)) +#define __multiply_unsigned(x,y) ((x)*(y)) /* memory location */ - #define __eeprom __attribute__((section (".eeprom"))) - #define __flash __attribute__((progmem)) +#define __eeprom __attribute__((section (".eeprom"))) +#define __flash __attribute__((progmem)) /* __root means to not optimize or strip */ - #define __root - #define __enable_interrupt() sei() - #define __disable_interrupt() cli() +#define __root +#define __enable_interrupt() sei() +#define __disable_interrupt() cli() #endif diff --git a/bacnet-stack/ports/atmega168/timer.c b/bacnet-stack/ports/atmega168/timer.c index 3745a756..51fcff4b 100644 --- a/bacnet-stack/ports/atmega168/timer.c +++ b/bacnet-stack/ports/atmega168/timer.c @@ -73,7 +73,8 @@ void Timer_Initialize( /* Timer Overflowed! Increment the time. */ #if defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ASM__) #pragma vector=TIMER0_OVF_vect -__interrupt void myTIMER0_OVF_vect() +__interrupt void myTIMER0_OVF_vect( + ) #else ISR(TIMER0_OVF_vect) #endif diff --git a/bacnet-stack/ports/win32/rs485.c b/bacnet-stack/ports/win32/rs485.c index d869f4e0..f4ba123a 100644 --- a/bacnet-stack/ports/win32/rs485.c +++ b/bacnet-stack/ports/win32/rs485.c @@ -132,9 +132,9 @@ static void RS485_Configure_Status( /* update DCB rate, byte size, parity, and stop bits size */ dcb.BaudRate = RS485_Baud; - dcb.ByteSize = (unsigned char)RS485_ByteSize; - dcb.Parity = (unsigned char)RS485_Parity; - dcb.StopBits = (unsigned char)RS485_StopBits; + dcb.ByteSize = (unsigned char) RS485_ByteSize; + dcb.Parity = (unsigned char) RS485_Parity; + dcb.StopBits = (unsigned char) RS485_StopBits; /* update flow control settings */ dcb.fDtrControl = RS485_DTRControl; diff --git a/bacnet-stack/src/datalink.c b/bacnet-stack/src/datalink.c index 9ebce488..d9d6b5d8 100644 --- a/bacnet-stack/src/datalink.c +++ b/bacnet-stack/src/datalink.c @@ -63,28 +63,28 @@ void ( void datalink_set( char *datalink_string) { - if (strcasecmp("bip",datalink_string) == 0) { + if (strcasecmp("bip", datalink_string) == 0) { datalink_init = bip_init; datalink_send_pdu = bip_send_pdu; datalink_receive = bip_receive; datalink_cleanup = bip_cleanup; datalink_get_broadcast_address = bip_get_broadcast_address; datalink_get_my_address = bip_get_my_address; - } else if (strcasecmp("ethernet",datalink_string) == 0) { + } else if (strcasecmp("ethernet", datalink_string) == 0) { datalink_init = ethernet_init; datalink_send_pdu = ethernet_send_pdu; datalink_receive = ethernet_receive; datalink_cleanup = ethernet_cleanup; datalink_get_broadcast_address = ethernet_get_broadcast_address; datalink_get_my_address = ethernet_get_my_address; - } else if (strcasecmp("arcnet",datalink_string) == 0) { + } else if (strcasecmp("arcnet", datalink_string) == 0) { datalink_init = arcnet_init; datalink_send_pdu = arcnet_send_pdu; datalink_receive = arcnet_receive; datalink_cleanup = arcnet_cleanup; datalink_get_broadcast_address = arcnet_get_broadcast_address; datalink_get_my_address = arcnet_get_my_address; - } else if (strcasecmp("mstp",datalink_string) == 0) { + } else if (strcasecmp("mstp", datalink_string) == 0) { datalink_init = dlmstp_init; datalink_send_pdu = dlmstp_send_pdu; datalink_receive = dlmstp_receive; @@ -94,4 +94,3 @@ void datalink_set( } } #endif - diff --git a/bacnet-stack/src/rp.c b/bacnet-stack/src/rp.c index e8764efa..917772ad 100644 --- a/bacnet-stack/src/rp.c +++ b/bacnet-stack/src/rp.c @@ -134,8 +134,8 @@ int rp_ack_encode_apdu_init( apdu_len = 3; /* service ack follows */ len = - encode_context_object_id(&apdu[apdu_len], 0, - rpdata->object_type, rpdata->object_instance); + encode_context_object_id(&apdu[apdu_len], 0, rpdata->object_type, + rpdata->object_instance); apdu_len += len; len = encode_context_enumerated(&apdu[apdu_len], 1,