Ran indent script.

This commit is contained in:
skarg
2009-07-29 18:06:33 +00:00
parent 551f2767e0
commit db61a1122f
37 changed files with 227 additions and 218 deletions
+13 -16
View File
@@ -61,8 +61,7 @@ static uint8_t RxBuffer[MAX_MPDU];
static uint8_t TxBuffer[MAX_MPDU]; static uint8_t TxBuffer[MAX_MPDU];
/* statistics derived from monitoring the network for each node */ /* statistics derived from monitoring the network for each node */
struct mstp_statistics struct mstp_statistics {
{
/* counts how many times the node passes the token */ /* counts how many times the node passes the token */
uint32_t token_count; uint32_t token_count;
/* counts how many times the node gets a second token */ /* counts how many times the node gets a second token */
@@ -90,8 +89,8 @@ static uint32_t timeval_diff_ms(
uint32_t ms = 0; uint32_t ms = 0;
/* convert to milliseconds */ /* convert to milliseconds */
ms = (now->tv_sec-old->tv_sec)*1000+ ms = (now->tv_sec - old->tv_sec) * 1000 + (now->tv_usec -
(now->tv_usec-old->tv_usec)/1000; old->tv_usec) / 1000;
return ms; return ms;
} }
@@ -189,7 +188,8 @@ static void packet_statistics(
old_tv.tv_usec = tv->tv_usec; old_tv.tv_usec = tv->tv_usec;
} }
static void packet_statistics_save(void) static void packet_statistics_save(
void)
{ {
unsigned i; /* loop counter */ unsigned i; /* loop counter */
@@ -201,18 +201,15 @@ static void packet_statistics_save(void)
fprintf(stdout, "\r\n"); fprintf(stdout, "\r\n");
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {
/* check for masters or slaves */ /* check for masters or slaves */
if ((MSTP_Statistics[i].token_count) || if ((MSTP_Statistics[i].token_count) || (MSTP_Statistics[i].der_reply)) {
(MSTP_Statistics[i].der_reply)) {
fprintf(stdout, "%u\t%u", i, fprintf(stdout, "%u\t%u", i,
(unsigned) MSTP_Statistics[i].max_master); (unsigned) MSTP_Statistics[i].max_master);
fprintf(stdout, fprintf(stdout, "\t%lu\t%lu\t%lu\t%lu",
"\t%lu\t%lu\t%lu\t%lu",
(long unsigned int) MSTP_Statistics[i].token_count, (long unsigned int) MSTP_Statistics[i].token_count,
(long unsigned int) MSTP_Statistics[i].token_retries, (long unsigned int) MSTP_Statistics[i].token_retries,
(long unsigned int) MSTP_Statistics[i].token_reply, (long unsigned int) MSTP_Statistics[i].token_reply,
(long unsigned int) MSTP_Statistics[i].tusage_timeout); (long unsigned int) MSTP_Statistics[i].tusage_timeout);
fprintf(stdout, fprintf(stdout, "\t%lu\t%lu\t%lu",
"\t%lu\t%lu\t%lu",
(long unsigned int) MSTP_Statistics[i].pfm_reply, (long unsigned int) MSTP_Statistics[i].pfm_reply,
(long unsigned int) MSTP_Statistics[i].der_reply, (long unsigned int) MSTP_Statistics[i].der_reply,
(long unsigned int) MSTP_Statistics[i].reply_postponed); (long unsigned int) MSTP_Statistics[i].reply_postponed);
@@ -221,7 +218,8 @@ static void packet_statistics_save(void)
} }
} }
static void packet_statistics_clear(void) static void packet_statistics_clear(
void)
{ {
unsigned i; /* loop counter */ unsigned i; /* loop counter */
@@ -391,7 +389,8 @@ static void cleanup(
} }
#if defined(_WIN32) #if defined(_WIN32)
static BOOL WINAPI CtrlCHandler(DWORD dwCtrlType) static BOOL WINAPI CtrlCHandler(
DWORD dwCtrlType)
{ {
dwCtrlType = dwCtrlType; dwCtrlType = dwCtrlType;
exit(0); exit(0);
@@ -472,9 +471,7 @@ int main(
RS485_Interface(), (long) RS485_Get_Baud_Rate()); RS485_Interface(), (long) RS485_Get_Baud_Rate());
atexit(cleanup); atexit(cleanup);
#if defined(_WIN32) #if defined(_WIN32)
SetConsoleMode( SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_PROCESSED_INPUT);
GetStdHandle(STD_INPUT_HANDLE),
ENABLE_PROCESSED_INPUT);
SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlCHandler, TRUE); SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlCHandler, TRUE);
#else #else
signal_init(); signal_init();
+2 -1
View File
@@ -175,7 +175,8 @@ int Analog_Input_Encode_Property_APDU(
encode_application_enumerated(&apdu[0], OBJECT_ANALOG_INPUT); encode_application_enumerated(&apdu[0], OBJECT_ANALOG_INPUT);
break; break;
case PROP_PRESENT_VALUE: case PROP_PRESENT_VALUE:
apdu_len = encode_application_real(&apdu[0], apdu_len =
encode_application_real(&apdu[0],
Analog_Input_Present_Value(object_instance)); Analog_Input_Present_Value(object_instance));
break; break;
case PROP_STATUS_FLAGS: case PROP_STATUS_FLAGS:
+2 -4
View File
@@ -377,10 +377,8 @@ bool Analog_Value_Write_Property(
/* Command priority 6 is reserved for use by Minimum On/Off /* Command priority 6 is reserved for use by Minimum On/Off
algorithm and may not be used for other purposes in any algorithm and may not be used for other purposes in any
object. */ object. */
if (Analog_Value_Present_Value_Set( if (Analog_Value_Present_Value_Set(wp_data->object_instance,
wp_data->object_instance, value.type.Real, wp_data->priority)) {
value.type.Real,
wp_data->priority)) {
status = true; status = true;
} else if (wp_data->priority == 6) { } else if (wp_data->priority == 6) {
/* Command priority 6 is reserved for use by Minimum On/Off /* Command priority 6 is reserved for use by Minimum On/Off
+4 -1
View File
@@ -67,7 +67,10 @@ static void Init_Service_Handlers(
handler_read_property); handler_read_property);
} }
int main(int argc, char *argv[]) { int main(
int argc,
char *argv[])
{
char *value_string = NULL; char *value_string = NULL;
bool status = false; bool status = false;
BACNET_COV_DATA cov_data; BACNET_COV_DATA cov_data;
+10 -5
View File
@@ -67,7 +67,8 @@ void MyAbortHandler(
(void) src; (void) src;
(void) invoke_id; (void) invoke_id;
(void) server; (void) server;
fprintf(stderr,"BACnet Abort: %s\r\n", bactext_abort_reason_name(abort_reason)); fprintf(stderr, "BACnet Abort: %s\r\n",
bactext_abort_reason_name(abort_reason));
Error_Detected = true; Error_Detected = true;
} }
@@ -79,7 +80,8 @@ void MyRejectHandler(
/* FIXME: verify src and invoke id */ /* FIXME: verify src and invoke id */
(void) src; (void) src;
(void) invoke_id; (void) invoke_id;
fprintf(stderr, "BACnet Reject: %s\r\n", bactext_reject_reason_name(reject_reason)); fprintf(stderr, "BACnet Reject: %s\r\n",
bactext_reject_reason_name(reject_reason));
Error_Detected = true; Error_Detected = true;
} }
@@ -111,14 +113,16 @@ static void print_address_cache(
unsigned max_apdu = 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(";%-7s %-17s %-5s %-17s %-4s\n", "Device", "MAC", "SNET", "SADR", "APDU"); printf(";%-7s %-17s %-5s %-17s %-4s\n", "Device", "MAC", "SNET", "SADR",
"APDU");
printf(";------- ----------------- ----- ----------------- ----\n"); printf(";------- ----------------- ----- ----------------- ----\n");
for (i = 0; i < MAX_ADDRESS_CACHE; i++) { for (i = 0; i < MAX_ADDRESS_CACHE; i++) {
if (address_get_by_index(i, &device_id, &max_apdu, &address)) { if (address_get_by_index(i, &device_id, &max_apdu, &address)) {
printf(" %-7u ", device_id); printf(" %-7u ", device_id);
for (j = 0; j < MAX_MAC_LEN; j++) { for (j = 0; j < MAX_MAC_LEN; j++) {
if (j < address.mac_len) { if (j < address.mac_len) {
if(j > 0) printf(":"); if (j > 0)
printf(":");
printf("%02X", address.mac[j]); printf("%02X", address.mac[j]);
} else { } else {
printf(" "); printf(" ");
@@ -128,7 +132,8 @@ static void print_address_cache(
if (address.net) { if (address.net) {
for (j = 0; j < MAX_MAC_LEN; j++) { for (j = 0; j < MAX_MAC_LEN; j++) {
if (j < address.len) { if (j < address.len) {
if(j > 0) printf(":"); if (j > 0)
printf(":");
printf("%02X", address.adr[j]); printf("%02X", address.adr[j]);
} else { } else {
printf(" "); printf(" ");
-1
View File
@@ -219,5 +219,4 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif #endif
+4 -3
View File
@@ -55,12 +55,13 @@ ISR(ADC_vect)
} }
uint8_t adc_result( uint8_t adc_result(
uint8_t channel) /* 0..7 = ADC0..ADC7, respectively */ uint8_t channel)
{ { /* 0..7 = ADC0..ADC7, respectively */
return Sample_Result; return Sample_Result;
} }
void adc_init(void) void adc_init(
void)
{ {
/* set prescaler */ /* set prescaler */
ADCSRA |= ADPS_8BIT; ADCSRA |= ADPS_8BIT;
+4 -3
View File
@@ -30,11 +30,12 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
uint8_t adc_result(uint8_t channel); uint8_t adc_result(
void adc_init(void); uint8_t channel);
void adc_init(
void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif #endif
+4 -8
View File
@@ -346,10 +346,8 @@ bool Analog_Value_Write_Property(
switch (wp_data->object_property) { switch (wp_data->object_property) {
case PROP_PRESENT_VALUE: case PROP_PRESENT_VALUE:
if (value.tag == BACNET_APPLICATION_TAG_REAL) { if (value.tag == BACNET_APPLICATION_TAG_REAL) {
if (Analog_Value_Present_Value_Set( if (Analog_Value_Present_Value_Set(wp_data->object_instance,
wp_data->object_instance, value.type.Real, wp_data->priority)) {
value.type.Real,
wp_data->priority)) {
status = true; status = true;
} else if (wp_data->priority == 6) { } else if (wp_data->priority == 6) {
/* Command priority 6 is reserved for use by Minimum On/Off /* Command priority 6 is reserved for use by Minimum On/Off
@@ -363,10 +361,8 @@ bool Analog_Value_Write_Property(
} }
#if 0 #if 0
} else if (value.tag == BACNET_APPLICATION_TAG_NULL) { } else if (value.tag == BACNET_APPLICATION_TAG_NULL) {
if (Analog_Value_Present_Value_Set( if (Analog_Value_Present_Value_Set(wp_data->object_instance,
wp_data->object_instance, NAN, wp_data->priority)) {
NAN,
wp_data->priority)) {
status = true; status = true;
} else { } else {
*error_class = ERROR_CLASS_PROPERTY; *error_class = ERROR_CLASS_PROPERTY;
@@ -33,7 +33,6 @@ FUSES = {
/* note: fuses are enabled by clearing the bit, so /* note: fuses are enabled by clearing the bit, so
any fuses listed below are cleared fuses. */ any fuses listed below are cleared fuses. */
.low = (FUSE_CKSEL3 & FUSE_SUT0 & FUSE_SUT1), .low = (FUSE_CKSEL3 & FUSE_SUT0 & FUSE_SUT1),
/* BOOTSZ configuration: /* BOOTSZ configuration:
BOOTSZ1 BOOTSZ0 Boot Size BOOTSZ1 BOOTSZ0 Boot Size
------- ------- --------- ------- ------- ---------
+2 -1
View File
@@ -34,7 +34,8 @@ static uint8_t Buttons;
#if BDK_V1_HACK #if BDK_V1_HACK
/* version 1 BDK workaournd for floating inputs */ /* version 1 BDK workaournd for floating inputs */
static void input_switch_workaround(void) static void input_switch_workaround(
void)
{ {
/* configure the port pins for the switch - as outputs */ /* configure the port pins for the switch - as outputs */
BIT_SET(DDRA, DDA0); BIT_SET(DDRA, DDA0);
+2 -1
View File
@@ -162,7 +162,8 @@ void idle_task(
/* do nothing */ /* do nothing */
} }
void test_init(void) void test_init(
void)
{ {
timer_reset(TIMER_LED_3); timer_reset(TIMER_LED_3);
timer_reset(TIMER_LED_4); timer_reset(TIMER_LED_4);
+2 -1
View File
@@ -117,7 +117,8 @@ void serial_byte_send(
return; return;
} }
void serial_byte_transmit_complete(void) void serial_byte_transmit_complete(
void)
{ {
/* was the frame sent? */ /* was the frame sent? */
while (!BIT_CHECK(UCSR1A, TXC1)) { while (!BIT_CHECK(UCSR1A, TXC1)) {
+2 -1
View File
@@ -42,7 +42,8 @@ extern "C" {
/* byte transmit */ /* byte transmit */
void serial_byte_send( void serial_byte_send(
uint8_t ch); uint8_t ch);
void serial_byte_transmit_complete(void); void serial_byte_transmit_complete(
void);
uint32_t serial_baud_rate( uint32_t serial_baud_rate(
void); void);
+5 -3
View File
@@ -33,15 +33,17 @@ static volatile uint32_t Millisecond_Counter[MAX_MILLISECOND_TIMERS];
/* start time for the clock */ /* start time for the clock */
static struct timespec start; static struct timespec start;
uint32_t timeGetTime(void) uint32_t timeGetTime(
void)
{ {
struct timespec now; struct timespec now;
uint32_t ticks; uint32_t ticks;
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
ticks = (now.tv_sec-start.tv_sec)*1000+ ticks =
(now.tv_nsec-start.tv_nsec)/1000000; (now.tv_sec - start.tv_sec) * 1000 + (now.tv_nsec -
start.tv_nsec) / 1000000;
return ticks; return ticks;
} }
+2 -1
View File
@@ -36,7 +36,8 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
uint32_t timeGetTime(void); uint32_t timeGetTime(
void);
void timer_init( void timer_init(
void); void);
+2 -1
View File
@@ -661,7 +661,8 @@ bool dlmstp_init(
if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) != TIMERR_NOERROR) { if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) != TIMERR_NOERROR) {
fprintf(stderr, "Failed to set timer resolution\n"); fprintf(stderr, "Failed to set timer resolution\n");
} }
TimeBeginPeriod = min(max(tc.wPeriodMin, TARGET_RESOLUTION), tc.wPeriodMax); TimeBeginPeriod =
min(max(tc.wPeriodMin, TARGET_RESOLUTION), tc.wPeriodMax);
timeBeginPeriod(TimeBeginPeriod); timeBeginPeriod(TimeBeginPeriod);
/* start the threads */ /* start the threads */
+1 -2
View File
@@ -141,8 +141,7 @@ int alarm_ack_decode_service_request(
len += section_len; len += section_len;
if (-1 == (section_len = if (-1 == (section_len =
decode_context_enumerated(&apdu[len], 2, decode_context_enumerated(&apdu[len], 2, &enumValue))) {
&enumValue))) {
return -1; return -1;
} }
data->eventTypeAcked = (BACNET_EVENT_TYPE) enumValue; data->eventTypeAcked = (BACNET_EVENT_TYPE) enumValue;
+1 -2
View File
@@ -105,8 +105,7 @@ int bacapp_decode_device_obj_property_ref(
apdu_len += len; apdu_len += len;
if (-1 == (len = if (-1 == (len =
decode_context_enumerated(&apdu[apdu_len], 1, decode_context_enumerated(&apdu[apdu_len], 1, &enumValue))) {
&enumValue))) {
return -1; return -1;
} }
value->propertyIdentifier = (BACNET_PROPERTY_ID) enumValue; value->propertyIdentifier = (BACNET_PROPERTY_ID) enumValue;
+2 -1
View File
@@ -175,7 +175,8 @@ int bacapp_decode_property_state(
&enumValue))) { &enumValue))) {
return -1; return -1;
} }
value->state.lifeSafetyState = (BACNET_LIFE_SAFETY_STATE)enumValue; value->state.lifeSafetyState =
(BACNET_LIFE_SAFETY_STATE) enumValue;
break; break;
default: default:
+2 -1
View File
@@ -572,7 +572,8 @@ int cov_subscribe_property_decode_service_request(
decode_tag_number_and_value(&apdu[len], &tag_number, decode_tag_number_and_value(&apdu[len], &tag_number,
&len_value); &len_value);
len += decode_enumerated(&apdu[len], len_value, &property); len += decode_enumerated(&apdu[len], len_value, &property);
data->monitoredProperty.propertyIdentifier = (BACNET_PROPERTY_ID)property; data->monitoredProperty.propertyIdentifier =
(BACNET_PROPERTY_ID) property;
} else } else
return -4; return -4;
/* the optional array index is tag 1 */ /* the optional array index is tag 1 */
+2 -1
View File
@@ -776,7 +776,8 @@ int event_notify_decode_service_request(
return -1; return -1;
} }
data->notificationParams.changeOfLifeSafety. data->notificationParams.changeOfLifeSafety.
operationExpected = (BACNET_LIFE_SAFETY_OPERATION)value; operationExpected =
(BACNET_LIFE_SAFETY_OPERATION) value;
len += section_length; len += section_length;
break; break;