Applied standard indentation to files.

This commit is contained in:
skarg
2008-01-08 23:13:51 +00:00
parent 401dbaa89d
commit 89432a85c3
17 changed files with 254 additions and 250 deletions
+13 -13
View File
@@ -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? */
+8 -6
View File
@@ -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;
+3 -2
View File
@@ -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;
+60 -60
View File
@@ -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 */
}
}
+2 -2
View File
@@ -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)) {
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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,
+12 -12
View File
@@ -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
}
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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;
+10 -9
View File
@@ -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;
}
}
+5 -5
View File
@@ -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 <iom168.h>
#include <iom168.h>
#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"
+124 -124
View File
@@ -35,161 +35,161 @@
#define IAR2GCC_H
#if defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ASM__)
#include <inavr.h>
#include <ioavr.h>
#define _BV(bit_num) (1 << (bit_num))
#define _delay_us(x) \
#include <inavr.h>
#include <ioavr.h>
#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 <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#if !defined(F_CPU)
#define F_CPU (7372800)
#endif
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
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
+2 -1
View File
@@ -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
+3 -3
View File
@@ -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;
+4 -5
View File
@@ -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
+2 -2
View File
@@ -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,