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( static bool cov_list_subscribe(
BACNET_ADDRESS * src, BACNET_ADDRESS * src,
BACNET_SUBSCRIBE_COV_DATA *cov_data) BACNET_SUBSCRIBE_COV_DATA * cov_data)
{ {
bool existing_entry = false; bool existing_entry = false;
int index; int index;
int first_invalid_index = -1; int first_invalid_index = -1;
bool found = true; bool found = true;
/* existing? - match Object ID and Process ID */ /* existing? - match Object ID and Process ID */
for (index = 0; index < MAX_COV_SUBCRIPTIONS; index++) { for (index = 0; index < MAX_COV_SUBCRIPTIONS; index++) {
if ((COV_Subscriptions[index].valid) && if ((COV_Subscriptions[index].valid) &&
(COV_Subscriptions[index].monitoredObjectIdentifier.type == (COV_Subscriptions[index].monitoredObjectIdentifier.type ==
cov_data->monitoredObjectIdentifier.type) && cov_data->monitoredObjectIdentifier.type) &&
(COV_Subscriptions[index].monitoredObjectIdentifier.instance == (COV_Subscriptions[index].monitoredObjectIdentifier.instance ==
cov_data->monitoredObjectIdentifier.instance) && cov_data->monitoredObjectIdentifier.instance) &&
(COV_Subscriptions[index].subscriberProcessIdentifier == (COV_Subscriptions[index].subscriberProcessIdentifier ==
cov_data->subscriberProcessIdentifier)) { cov_data->subscriberProcessIdentifier)) {
existing_entry = true; existing_entry = true;
if (cov_data->cancellationRequest) { if (cov_data->cancellationRequest) {
COV_Subscriptions[index].valid = false; COV_Subscriptions[index].valid = false;
@@ -107,8 +107,7 @@ static bool cov_list_subscribe(
bacnet_address_copy(&COV_Subscriptions[index].dest, src); bacnet_address_copy(&COV_Subscriptions[index].dest, src);
COV_Subscriptions[index].issueConfirmedNotifications = COV_Subscriptions[index].issueConfirmedNotifications =
cov_data->issueConfirmedNotifications; cov_data->issueConfirmedNotifications;
COV_Subscriptions[index].lifetime = COV_Subscriptions[index].lifetime = cov_data->lifetime;
cov_data->lifetime;
} }
break; break;
} else { } else {
@@ -131,8 +130,7 @@ static bool cov_list_subscribe(
cov_data->subscriberProcessIdentifier; cov_data->subscriberProcessIdentifier;
COV_Subscriptions[index].issueConfirmedNotifications = COV_Subscriptions[index].issueConfirmedNotifications =
cov_data->issueConfirmedNotifications; cov_data->issueConfirmedNotifications;
COV_Subscriptions[index].lifetime = COV_Subscriptions[index].lifetime = cov_data->lifetime;
cov_data->lifetime;
} else { } else {
found = false; found = false;
} }
@@ -149,7 +147,7 @@ void handler_cov_task(
int lifetime_milliseconds; int lifetime_milliseconds;
BACNET_OBJECT_ID object_id; BACNET_OBJECT_ID object_id;
/* existing? - match Object ID and Process ID */ /* existing? - match Object ID and Process ID */
for (index = 0; index < MAX_COV_SUBCRIPTIONS; index++) { for (index = 0; index < MAX_COV_SUBCRIPTIONS; index++) {
if (COV_Subscriptions[index].valid) { if (COV_Subscriptions[index].valid) {
@@ -164,8 +162,10 @@ void handler_cov_task(
COV_Subscriptions[index].valid = false; COV_Subscriptions[index].valid = false;
} }
/* handle COV notifications */ /* handle COV notifications */
object_id.type = COV_Subscriptions[index].monitoredObjectIdentifier.type; object_id.type =
object_id.instance = COV_Subscriptions[index].monitoredObjectIdentifier.instance; COV_Subscriptions[index].monitoredObjectIdentifier.type;
object_id.instance =
COV_Subscriptions[index].monitoredObjectIdentifier.instance;
switch (object_id.type) { switch (object_id.type) {
case OBJECT_BINARY_INPUT: case OBJECT_BINARY_INPUT:
if (Binary_Input_Change_Of_Value(object_id.instance)) { if (Binary_Input_Change_Of_Value(object_id.instance)) {
@@ -190,7 +190,7 @@ static bool cov_subscribe(
switch (cov_data->monitoredObjectIdentifier.type) { switch (cov_data->monitoredObjectIdentifier.type) {
case OBJECT_BINARY_INPUT: case OBJECT_BINARY_INPUT:
status = true; status = true;
status = cov_list_subscribe(src,cov_data); status = cov_list_subscribe(src, cov_data);
break; break;
default: default:
/* FIXME: what is the ERROR? */ /* 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( bool Binary_Input_Change_Of_Value(
uint32_t object_instance) uint32_t object_instance)
{ {
bool status = false; bool status = false;
unsigned index; unsigned index;
index = Binary_Input_Instance_To_Index(object_instance); index = Binary_Input_Instance_To_Index(object_instance);
if (index < MAX_BINARY_INPUTS) { if (index < MAX_BINARY_INPUTS) {
status = Change_Of_Value[index]; status = Change_Of_Value[index];
} }
return status; return status;
} }
@@ -214,7 +214,7 @@ static void Binary_Input_Out_Of_Service_Set(
if (Out_Of_Service[index] != value) { if (Out_Of_Service[index] != value) {
Change_Of_Value[index] = true; Change_Of_Value[index] = true;
} }
Out_Of_Service[index] = value; Out_Of_Service[index] = value;
return; 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_FAULT, false);
bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false); bitstring_set_bit(&bit_string, STATUS_FLAG_OVERRIDDEN, false);
if (Binary_Input_Out_Of_Service(object_instance)) { 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 { } 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); apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break; break;
+3 -2
View File
@@ -994,7 +994,8 @@ bool Device_Write_Property(
case PROP_MAX_INFO_FRAMES: case PROP_MAX_INFO_FRAMES:
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
if (value.type.Unsigned_Int <= 255) { 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; status = true;
} else { } else {
*error_class = ERROR_CLASS_PROPERTY; *error_class = ERROR_CLASS_PROPERTY;
@@ -1009,7 +1010,7 @@ bool Device_Write_Property(
if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { if (value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) {
if ((value.type.Unsigned_Int > 0) && if ((value.type.Unsigned_Int > 0) &&
(value.type.Unsigned_Int <= 127)) { (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; status = true;
} else { } else {
*error_class = ERROR_CLASS_PROPERTY; *error_class = ERROR_CLASS_PROPERTY;
+60 -60
View File
@@ -118,69 +118,69 @@ int main(
datalink_set("bip"); datalink_set("bip");
#endif #endif
#if defined(BACDL_BIP) #if defined(BACDL_BIP)
pEnv = getenv("BACNET_IP_PORT"); pEnv = getenv("BACNET_IP_PORT");
if (pEnv) { if (pEnv) {
bip_set_port(strtol(pEnv, NULL, 0)); bip_set_port(strtol(pEnv, NULL, 0));
} else { } else {
bip_set_port(0xBAC0); bip_set_port(0xBAC0);
} }
#elif defined(BACDL_MSTP) #elif defined(BACDL_MSTP)
pEnv = getenv("BACNET_MAX_INFO_FRAMES"); pEnv = getenv("BACNET_MAX_INFO_FRAMES");
if (pEnv) { if (pEnv) {
dlmstp_set_max_info_frames(strtol(pEnv, NULL, 0)); dlmstp_set_max_info_frames(strtol(pEnv, NULL, 0));
} else { } else {
dlmstp_set_max_info_frames(1); dlmstp_set_max_info_frames(1);
} }
pEnv = getenv("BACNET_MAX_MASTER"); pEnv = getenv("BACNET_MAX_MASTER");
if (pEnv) { if (pEnv) {
dlmstp_set_max_master(strtol(pEnv, NULL, 0)); dlmstp_set_max_master(strtol(pEnv, NULL, 0));
} else { } else {
dlmstp_set_max_master(127); dlmstp_set_max_master(127);
} }
pEnv = getenv("BACNET_MSTP_BAUD"); pEnv = getenv("BACNET_MSTP_BAUD");
if (pEnv) { if (pEnv) {
RS485_Set_Baud_Rate(strtol(pEnv, NULL, 0)); RS485_Set_Baud_Rate(strtol(pEnv, NULL, 0));
} else { } else {
RS485_Set_Baud_Rate(38400); RS485_Set_Baud_Rate(38400);
} }
pEnv = getenv("BACNET_MSTP_MAC"); pEnv = getenv("BACNET_MSTP_MAC");
if (pEnv) { if (pEnv) {
dlmstp_set_mac_address(strtol(pEnv, NULL, 0)); dlmstp_set_mac_address(strtol(pEnv, NULL, 0));
} else { } else {
dlmstp_set_mac_address(127); dlmstp_set_mac_address(127);
} }
#endif #endif
printf("BACnet Server Demo\n" "BACnet Stack Version %s\n" printf("BACnet Server Demo\n" "BACnet Stack Version %s\n"
"BACnet Device ID: %u\n" "Max APDU: %d\n", BACnet_Version, "BACnet Device ID: %u\n" "Max APDU: %d\n", BACnet_Version,
Device_Object_Instance_Number(), MAX_APDU); Device_Object_Instance_Number(), MAX_APDU);
Init_Service_Handlers(); Init_Service_Handlers();
BIP_Debug = true; BIP_Debug = true;
if (!datalink_init(getenv("BACNET_IFACE"))) if (!datalink_init(getenv("BACNET_IFACE")))
return 1; return 1;
atexit(cleanup); atexit(cleanup);
/* configure the timeout values */ /* configure the timeout values */
last_seconds = time(NULL); last_seconds = time(NULL);
/* broadcast an I-Am on startup */ /* broadcast an I-Am on startup */
iam_send(&Handler_Transmit_Buffer[0]); iam_send(&Handler_Transmit_Buffer[0]);
/* loop forever */ /* loop forever */
for (;;) { for (;;) {
/* input */ /* input */
current_seconds = time(NULL); current_seconds = time(NULL);
/* returns 0 bytes on timeout */ /* returns 0 bytes on timeout */
pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout); pdu_len = datalink_receive(&src, &Rx_Buf[0], MAX_MPDU, timeout);
/* process */ /* process */
if (pdu_len) { if (pdu_len) {
npdu_handler(&src, &Rx_Buf[0], 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; uint32_t device_id = 0;
unsigned max_apdu = 0; unsigned max_apdu = 0;
printf("%-7s %-14s %-4s %-5s %-14s\n", printf("%-7s %-14s %-4s %-5s %-14s\n", "Device", "MAC", "APDU", "SNET",
"Device","MAC","APDU","SNET","SADR"); "SADR");
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)) {
+1 -1
View File
@@ -90,7 +90,7 @@
#define MAX_HEADER (8) #define MAX_HEADER (8)
#define MAX_MPDU (MAX_HEADER+MAX_PDU) #define MAX_MPDU (MAX_HEADER+MAX_PDU)
int datalink_send_pdu( int datalink_send_pdu(
BACNET_ADDRESS * dest, BACNET_ADDRESS * dest,
BACNET_NPDU_DATA * npdu_data, BACNET_NPDU_DATA * npdu_data,
uint8_t * pdu, uint8_t * pdu,
+1 -1
View File
@@ -70,7 +70,7 @@ extern "C" {
int rp_ack_encode_apdu_object_property_end( int rp_ack_encode_apdu_object_property_end(
uint8_t * apdu); uint8_t * apdu);
/* method to encode the ack using extra buffer */ /* method to encode the ack using extra buffer */
int rp_ack_encode_apdu( int rp_ack_encode_apdu(
uint8_t * apdu, uint8_t * apdu,
+12 -12
View File
@@ -32,23 +32,23 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
unsigned disableIRQ( unsigned disableIRQ(
void); void);
unsigned restoreIRQ( unsigned restoreIRQ(
unsigned oldCPSR); unsigned oldCPSR);
unsigned enableIRQ( unsigned enableIRQ(
void); void);
unsigned disableFIQ( unsigned disableFIQ(
void); void);
unsigned restoreFIQ( unsigned restoreFIQ(
unsigned oldCPSR); unsigned oldCPSR);
unsigned enableFIQ( unsigned enableFIQ(
void); void);
#ifdef __cplusplus #ifdef __cplusplus
} }
+3 -3
View File
@@ -157,7 +157,7 @@ static inline void bacnet_init(
handler_device_communication_control); handler_device_communication_control);
} }
static uint8_t Receive_PDU[MAX_MPDU]; /* PDU data */ static uint8_t Receive_PDU[MAX_MPDU]; /* PDU data */
int main( int main(
void) void)
{ {
@@ -236,8 +236,8 @@ int main(
/* count # of times through the idle loop */ /* count # of times through the idle loop */
IdleCount++; IdleCount++;
/* BACnet handling */ /* BACnet handling */
pdu_len = datalink_receive(&src, pdu_len =
&Receive_PDU[0], sizeof(Receive_PDU), 0); datalink_receive(&src, &Receive_PDU[0], sizeof(Receive_PDU), 0);
if (pdu_len) { if (pdu_len) {
pPIO->PIO_CODR = LED3; pPIO->PIO_CODR = LED3;
npdu_handler(&src, &Receive_PDU[0], pdu_len); 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++) { for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) {
/* automatic lookup based on handlers set */ /* automatic lookup based on handlers set */
bitstring_set_bit(&bit_string, (uint8_t) i, 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); apdu_len = encode_application_bitstring(&apdu[0], &bit_string);
break; break;
+10 -9
View File
@@ -126,18 +126,19 @@ void handler_read_property(
} else { } else {
/* most cases will be error */ /* most cases will be error */
error = true; error = true;
ack_len = rp_ack_encode_apdu_init( ack_len =
&Handler_Transmit_Buffer[pdu_len], rp_ack_encode_apdu_init(&Handler_Transmit_Buffer[pdu_len],
service_data->invoke_id, &data); service_data->invoke_id, &data);
/* FIXME: add buffer len as passed into function or use smart buffer */ /* FIXME: add buffer len as passed into function or use smart buffer */
property_len = Encode_Property_APDU( property_len =
&Handler_Transmit_Buffer[pdu_len + ack_len], data.object_type, Encode_Property_APDU(&Handler_Transmit_Buffer[pdu_len + ack_len],
data.object_instance, data.object_property, data.array_index, data.object_type, data.object_instance, data.object_property,
&error_class, &error_code); data.array_index, &error_class, &error_code);
if (len >= 0) { if (len >= 0) {
len = rp_ack_encode_apdu_object_property_end( len =
&Handler_Transmit_Buffer[pdu_len + property_len + ack_len]); rp_ack_encode_apdu_object_property_end(&Handler_Transmit_Buffer
len += ack_len + property_len; [pdu_len + property_len + ack_len]);
len += ack_len + property_len;
error = false; error = false;
} }
} }
+5 -5
View File
@@ -27,15 +27,15 @@
#if !defined(F_CPU) #if !defined(F_CPU)
/* The processor clock frequency */ /* The processor clock frequency */
#define F_CPU (7372800) #define F_CPU (7372800)
#endif #endif
#if defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ASM__) #if defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ASM__)
#include <iom168.h> #include <iom168.h>
#else #else
#if !defined(__AVR_ATmega168__) #if !defined(__AVR_ATmega168__)
#error Firmware is configured for ATmega168 only (-mmcu=atmega168) #error Firmware is configured for ATmega168 only (-mmcu=atmega168)
#endif #endif
#endif #endif
#include "iar2gcc.h" #include "iar2gcc.h"
#include "avr035.h" #include "avr035.h"
+124 -124
View File
@@ -35,161 +35,161 @@
#define IAR2GCC_H #define IAR2GCC_H
#if defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ASM__) #if defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ASM__)
#include <inavr.h> #include <inavr.h>
#include <ioavr.h> #include <ioavr.h>
#define _BV(bit_num) (1 << (bit_num)) #define _BV(bit_num) (1 << (bit_num))
#define _delay_us(x) \ #define _delay_us(x) \
/* inline function */ /* inline function */
static inline void delay_us(uint8_t microseconds) static inline void delay_us(
uint8_t microseconds)
{ {
do { do {
__delay_cycles(F_CPU/1000000); __delay_cycles(F_CPU / 1000000);
} while (microseconds--); } while (microseconds--);
} }
#else #else
#if !defined(F_CPU) #if !defined(F_CPU)
#define F_CPU (7372800) #define F_CPU (7372800)
#endif #endif
#include <avr/io.h> #include <avr/io.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <util/delay.h> #include <util/delay.h>
typedef struct typedef struct {
{ unsigned char bit0:1;
unsigned char bit0:1; unsigned char bit1:1;
unsigned char bit1:1; unsigned char bit2:1;
unsigned char bit2:1; unsigned char bit3:1;
unsigned char bit3:1; unsigned char bit4:1;
unsigned char bit4:1; unsigned char bit5:1;
unsigned char bit5:1; unsigned char bit6:1;
unsigned char bit6:1; unsigned char bit7:1;
unsigned char bit7:1; } BitRegisterType;
} BitRegisterType;
#ifndef true #ifndef true
#define true 1 #define true 1
#endif #endif
#ifndef false #ifndef false
#define false 0 #define false 0
#endif #endif
#define GPIO_BITREG(port,bitnum) \ #define GPIO_BITREG(port,bitnum) \
((volatile BitRegisterType*)_SFR_MEM_ADDR(port) \ ((volatile BitRegisterType*)_SFR_MEM_ADDR(port) \
)->bit ## bitnum )->bit ## bitnum
#define PINA_Bit0 GPIO_BITREG(PINA,0) #define PINA_Bit0 GPIO_BITREG(PINA,0)
#define PINA_Bit1 GPIO_BITREG(PINA,1) #define PINA_Bit1 GPIO_BITREG(PINA,1)
#define PINA_Bit2 GPIO_BITREG(PINA,2) #define PINA_Bit2 GPIO_BITREG(PINA,2)
#define PINA_Bit3 GPIO_BITREG(PINA,3) #define PINA_Bit3 GPIO_BITREG(PINA,3)
#define PINA_Bit4 GPIO_BITREG(PINA,4) #define PINA_Bit4 GPIO_BITREG(PINA,4)
#define PINA_Bit5 GPIO_BITREG(PINA,5) #define PINA_Bit5 GPIO_BITREG(PINA,5)
#define PINA_Bit6 GPIO_BITREG(PINA,6) #define PINA_Bit6 GPIO_BITREG(PINA,6)
#define PINA_Bit7 GPIO_BITREG(PINA,7) #define PINA_Bit7 GPIO_BITREG(PINA,7)
#define PORTA_Bit0 GPIO_BITREG(PORTA,0) #define PORTA_Bit0 GPIO_BITREG(PORTA,0)
#define PORTA_Bit1 GPIO_BITREG(PORTA,1) #define PORTA_Bit1 GPIO_BITREG(PORTA,1)
#define PORTA_Bit2 GPIO_BITREG(PORTA,2) #define PORTA_Bit2 GPIO_BITREG(PORTA,2)
#define PORTA_Bit3 GPIO_BITREG(PORTA,3) #define PORTA_Bit3 GPIO_BITREG(PORTA,3)
#define PORTA_Bit4 GPIO_BITREG(PORTA,4) #define PORTA_Bit4 GPIO_BITREG(PORTA,4)
#define PORTA_Bit5 GPIO_BITREG(PORTA,5) #define PORTA_Bit5 GPIO_BITREG(PORTA,5)
#define PORTA_Bit6 GPIO_BITREG(PORTA,6) #define PORTA_Bit6 GPIO_BITREG(PORTA,6)
#define PORTA_Bit7 GPIO_BITREG(PORTA,7) #define PORTA_Bit7 GPIO_BITREG(PORTA,7)
#define PINB_Bit0 GPIO_BITREG(PINB,0) #define PINB_Bit0 GPIO_BITREG(PINB,0)
#define PINB_Bit1 GPIO_BITREG(PINB,1) #define PINB_Bit1 GPIO_BITREG(PINB,1)
#define PINB_Bit2 GPIO_BITREG(PINB,2) #define PINB_Bit2 GPIO_BITREG(PINB,2)
#define PINB_Bit3 GPIO_BITREG(PINB,3) #define PINB_Bit3 GPIO_BITREG(PINB,3)
#define PINB_Bit4 GPIO_BITREG(PINB,4) #define PINB_Bit4 GPIO_BITREG(PINB,4)
#define PINB_Bit5 GPIO_BITREG(PINB,5) #define PINB_Bit5 GPIO_BITREG(PINB,5)
#define PINB_Bit6 GPIO_BITREG(PINB,6) #define PINB_Bit6 GPIO_BITREG(PINB,6)
#define PINB_Bit7 GPIO_BITREG(PINB,7) #define PINB_Bit7 GPIO_BITREG(PINB,7)
#define PORTB_Bit0 GPIO_BITREG(PORTB,0) #define PORTB_Bit0 GPIO_BITREG(PORTB,0)
#define PORTB_Bit1 GPIO_BITREG(PORTB,1) #define PORTB_Bit1 GPIO_BITREG(PORTB,1)
#define PORTB_Bit2 GPIO_BITREG(PORTB,2) #define PORTB_Bit2 GPIO_BITREG(PORTB,2)
#define PORTB_Bit3 GPIO_BITREG(PORTB,3) #define PORTB_Bit3 GPIO_BITREG(PORTB,3)
#define PORTB_Bit4 GPIO_BITREG(PORTB,4) #define PORTB_Bit4 GPIO_BITREG(PORTB,4)
#define PORTB_Bit5 GPIO_BITREG(PORTB,5) #define PORTB_Bit5 GPIO_BITREG(PORTB,5)
#define PORTB_Bit6 GPIO_BITREG(PORTB,6) #define PORTB_Bit6 GPIO_BITREG(PORTB,6)
#define PORTB_Bit7 GPIO_BITREG(PORTB,7) #define PORTB_Bit7 GPIO_BITREG(PORTB,7)
#define PINC_Bit0 GPIO_BITREG(PINC,0) #define PINC_Bit0 GPIO_BITREG(PINC,0)
#define PINC_Bit1 GPIO_BITREG(PINC,1) #define PINC_Bit1 GPIO_BITREG(PINC,1)
#define PINC_Bit2 GPIO_BITREG(PINC,2) #define PINC_Bit2 GPIO_BITREG(PINC,2)
#define PINC_Bit3 GPIO_BITREG(PINC,3) #define PINC_Bit3 GPIO_BITREG(PINC,3)
#define PINC_Bit4 GPIO_BITREG(PINC,4) #define PINC_Bit4 GPIO_BITREG(PINC,4)
#define PINC_Bit5 GPIO_BITREG(PINC,5) #define PINC_Bit5 GPIO_BITREG(PINC,5)
#define PINC_Bit6 GPIO_BITREG(PINC,6) #define PINC_Bit6 GPIO_BITREG(PINC,6)
#define PINC_Bit7 GPIO_BITREG(PINC,7) #define PINC_Bit7 GPIO_BITREG(PINC,7)
#define PORTC_Bit0 GPIO_BITREG(PORTC,0) #define PORTC_Bit0 GPIO_BITREG(PORTC,0)
#define PORTC_Bit1 GPIO_BITREG(PORTC,1) #define PORTC_Bit1 GPIO_BITREG(PORTC,1)
#define PORTC_Bit2 GPIO_BITREG(PORTC,2) #define PORTC_Bit2 GPIO_BITREG(PORTC,2)
#define PORTC_Bit3 GPIO_BITREG(PORTC,3) #define PORTC_Bit3 GPIO_BITREG(PORTC,3)
#define PORTC_Bit4 GPIO_BITREG(PORTC,4) #define PORTC_Bit4 GPIO_BITREG(PORTC,4)
#define PORTC_Bit5 GPIO_BITREG(PORTC,5) #define PORTC_Bit5 GPIO_BITREG(PORTC,5)
#define PORTC_Bit6 GPIO_BITREG(PORTC,6) #define PORTC_Bit6 GPIO_BITREG(PORTC,6)
#define PORTC_Bit7 GPIO_BITREG(PORTC,7) #define PORTC_Bit7 GPIO_BITREG(PORTC,7)
#define PIND_Bit0 GPIO_BITREG(PIND,0) #define PIND_Bit0 GPIO_BITREG(PIND,0)
#define PIND_Bit1 GPIO_BITREG(PIND,1) #define PIND_Bit1 GPIO_BITREG(PIND,1)
#define PIND_Bit2 GPIO_BITREG(PIND,2) #define PIND_Bit2 GPIO_BITREG(PIND,2)
#define PIND_Bit3 GPIO_BITREG(PIND,3) #define PIND_Bit3 GPIO_BITREG(PIND,3)
#define PIND_Bit4 GPIO_BITREG(PIND,4) #define PIND_Bit4 GPIO_BITREG(PIND,4)
#define PIND_Bit5 GPIO_BITREG(PIND,5) #define PIND_Bit5 GPIO_BITREG(PIND,5)
#define PIND_Bit6 GPIO_BITREG(PIND,6) #define PIND_Bit6 GPIO_BITREG(PIND,6)
#define PIND_Bit7 GPIO_BITREG(PIND,7) #define PIND_Bit7 GPIO_BITREG(PIND,7)
#define PORTD_Bit0 GPIO_BITREG(PORTD,0) #define PORTD_Bit0 GPIO_BITREG(PORTD,0)
#define PORTD_Bit1 GPIO_BITREG(PORTD,1) #define PORTD_Bit1 GPIO_BITREG(PORTD,1)
#define PORTD_Bit2 GPIO_BITREG(PORTD,2) #define PORTD_Bit2 GPIO_BITREG(PORTD,2)
#define PORTD_Bit3 GPIO_BITREG(PORTD,3) #define PORTD_Bit3 GPIO_BITREG(PORTD,3)
#define PORTD_Bit4 GPIO_BITREG(PORTD,4) #define PORTD_Bit4 GPIO_BITREG(PORTD,4)
#define PORTD_Bit5 GPIO_BITREG(PORTD,5) #define PORTD_Bit5 GPIO_BITREG(PORTD,5)
#define PORTD_Bit6 GPIO_BITREG(PORTD,6) #define PORTD_Bit6 GPIO_BITREG(PORTD,6)
#define PORTD_Bit7 GPIO_BITREG(PORTD,7) #define PORTD_Bit7 GPIO_BITREG(PORTD,7)
#define GPIOR0_Bit0 GPIO_BITREG(GPIOR0,0) #define GPIOR0_Bit0 GPIO_BITREG(GPIOR0,0)
#define GPIOR0_Bit1 GPIO_BITREG(GPIOR0,1) #define GPIOR0_Bit1 GPIO_BITREG(GPIOR0,1)
#define GPIOR0_Bit2 GPIO_BITREG(GPIOR0,2) #define GPIOR0_Bit2 GPIO_BITREG(GPIOR0,2)
#define GPIOR0_Bit3 GPIO_BITREG(GPIOR0,3) #define GPIOR0_Bit3 GPIO_BITREG(GPIOR0,3)
#define GPIOR0_Bit4 GPIO_BITREG(GPIOR0,4) #define GPIOR0_Bit4 GPIO_BITREG(GPIOR0,4)
#define GPIOR0_Bit5 GPIO_BITREG(GPIOR0,5) #define GPIOR0_Bit5 GPIO_BITREG(GPIOR0,5)
#define GPIOR0_Bit6 GPIO_BITREG(GPIOR0,6) #define GPIOR0_Bit6 GPIO_BITREG(GPIOR0,6)
#define GPIOR0_Bit7 GPIO_BITREG(GPIOR0,7) #define GPIOR0_Bit7 GPIO_BITREG(GPIOR0,7)
#define GPIOR1_Bit0 GPIO_BITREG(GPIOR1,0) #define GPIOR1_Bit0 GPIO_BITREG(GPIOR1,0)
#define GPIOR1_Bit1 GPIO_BITREG(GPIOR1,1) #define GPIOR1_Bit1 GPIO_BITREG(GPIOR1,1)
#define GPIOR1_Bit2 GPIO_BITREG(GPIOR1,2) #define GPIOR1_Bit2 GPIO_BITREG(GPIOR1,2)
#define GPIOR1_Bit3 GPIO_BITREG(GPIOR1,3) #define GPIOR1_Bit3 GPIO_BITREG(GPIOR1,3)
#define GPIOR1_Bit4 GPIO_BITREG(GPIOR1,4) #define GPIOR1_Bit4 GPIO_BITREG(GPIOR1,4)
#define GPIOR1_Bit5 GPIO_BITREG(GPIOR1,5) #define GPIOR1_Bit5 GPIO_BITREG(GPIOR1,5)
#define GPIOR1_Bit6 GPIO_BITREG(GPIOR1,6) #define GPIOR1_Bit6 GPIO_BITREG(GPIOR1,6)
#define GPIOR1_Bit7 GPIO_BITREG(GPIOR1,7) #define GPIOR1_Bit7 GPIO_BITREG(GPIOR1,7)
#define GPIOR2_Bit0 GPIO_BITREG(GPIOR2,0) #define GPIOR2_Bit0 GPIO_BITREG(GPIOR2,0)
#define GPIOR2_Bit1 GPIO_BITREG(GPIOR2,1) #define GPIOR2_Bit1 GPIO_BITREG(GPIOR2,1)
#define GPIOR2_Bit2 GPIO_BITREG(GPIOR2,2) #define GPIOR2_Bit2 GPIO_BITREG(GPIOR2,2)
#define GPIOR2_Bit3 GPIO_BITREG(GPIOR2,3) #define GPIOR2_Bit3 GPIO_BITREG(GPIOR2,3)
#define GPIOR2_Bit4 GPIO_BITREG(GPIOR2,4) #define GPIOR2_Bit4 GPIO_BITREG(GPIOR2,4)
#define GPIOR2_Bit5 GPIO_BITREG(GPIOR2,5) #define GPIOR2_Bit5 GPIO_BITREG(GPIOR2,5)
#define GPIOR2_Bit6 GPIO_BITREG(GPIOR2,6) #define GPIOR2_Bit6 GPIO_BITREG(GPIOR2,6)
#define GPIOR2_Bit7 GPIO_BITREG(GPIOR2,7) #define GPIOR2_Bit7 GPIO_BITREG(GPIOR2,7)
/* FIXME: intrinsic routines: map to assembler for size/speed */ /* 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 */ /* memory location */
#define __eeprom __attribute__((section (".eeprom"))) #define __eeprom __attribute__((section (".eeprom")))
#define __flash __attribute__((progmem)) #define __flash __attribute__((progmem))
/* __root means to not optimize or strip */ /* __root means to not optimize or strip */
#define __root #define __root
#define __enable_interrupt() sei() #define __enable_interrupt() sei()
#define __disable_interrupt() cli() #define __disable_interrupt() cli()
#endif #endif
+2 -1
View File
@@ -73,7 +73,8 @@ void Timer_Initialize(
/* Timer Overflowed! Increment the time. */ /* Timer Overflowed! Increment the time. */
#if defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ASM__) #if defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ASM__)
#pragma vector=TIMER0_OVF_vect #pragma vector=TIMER0_OVF_vect
__interrupt void myTIMER0_OVF_vect() __interrupt void myTIMER0_OVF_vect(
)
#else #else
ISR(TIMER0_OVF_vect) ISR(TIMER0_OVF_vect)
#endif #endif
+3 -3
View File
@@ -132,9 +132,9 @@ static void RS485_Configure_Status(
/* update DCB rate, byte size, parity, and stop bits size */ /* update DCB rate, byte size, parity, and stop bits size */
dcb.BaudRate = RS485_Baud; dcb.BaudRate = RS485_Baud;
dcb.ByteSize = (unsigned char)RS485_ByteSize; dcb.ByteSize = (unsigned char) RS485_ByteSize;
dcb.Parity = (unsigned char)RS485_Parity; dcb.Parity = (unsigned char) RS485_Parity;
dcb.StopBits = (unsigned char)RS485_StopBits; dcb.StopBits = (unsigned char) RS485_StopBits;
/* update flow control settings */ /* update flow control settings */
dcb.fDtrControl = RS485_DTRControl; dcb.fDtrControl = RS485_DTRControl;
+4 -5
View File
@@ -63,28 +63,28 @@ void (
void datalink_set( void datalink_set(
char *datalink_string) char *datalink_string)
{ {
if (strcasecmp("bip",datalink_string) == 0) { if (strcasecmp("bip", datalink_string) == 0) {
datalink_init = bip_init; datalink_init = bip_init;
datalink_send_pdu = bip_send_pdu; datalink_send_pdu = bip_send_pdu;
datalink_receive = bip_receive; datalink_receive = bip_receive;
datalink_cleanup = bip_cleanup; datalink_cleanup = bip_cleanup;
datalink_get_broadcast_address = bip_get_broadcast_address; datalink_get_broadcast_address = bip_get_broadcast_address;
datalink_get_my_address = bip_get_my_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_init = ethernet_init;
datalink_send_pdu = ethernet_send_pdu; datalink_send_pdu = ethernet_send_pdu;
datalink_receive = ethernet_receive; datalink_receive = ethernet_receive;
datalink_cleanup = ethernet_cleanup; datalink_cleanup = ethernet_cleanup;
datalink_get_broadcast_address = ethernet_get_broadcast_address; datalink_get_broadcast_address = ethernet_get_broadcast_address;
datalink_get_my_address = ethernet_get_my_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_init = arcnet_init;
datalink_send_pdu = arcnet_send_pdu; datalink_send_pdu = arcnet_send_pdu;
datalink_receive = arcnet_receive; datalink_receive = arcnet_receive;
datalink_cleanup = arcnet_cleanup; datalink_cleanup = arcnet_cleanup;
datalink_get_broadcast_address = arcnet_get_broadcast_address; datalink_get_broadcast_address = arcnet_get_broadcast_address;
datalink_get_my_address = arcnet_get_my_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_init = dlmstp_init;
datalink_send_pdu = dlmstp_send_pdu; datalink_send_pdu = dlmstp_send_pdu;
datalink_receive = dlmstp_receive; datalink_receive = dlmstp_receive;
@@ -94,4 +94,3 @@ void datalink_set(
} }
} }
#endif #endif
+2 -2
View File
@@ -134,8 +134,8 @@ int rp_ack_encode_apdu_init(
apdu_len = 3; apdu_len = 3;
/* service ack follows */ /* service ack follows */
len = len =
encode_context_object_id(&apdu[apdu_len], 0, encode_context_object_id(&apdu[apdu_len], 0, rpdata->object_type,
rpdata->object_type, rpdata->object_instance); rpdata->object_instance);
apdu_len += len; apdu_len += len;
len = len =
encode_context_enumerated(&apdu[apdu_len], 1, encode_context_enumerated(&apdu[apdu_len], 1,