Issue 2 move folders and use deep path include file names to prevent collisions (#4)

* moving folders and files and adjust server demo build

* Fix Makefile for apps/server on Linux

* fix unit test source file folders

* fix datetime convert UTC functions. Add Code::Blocks project for datetime testing

* added some ignore extensions

* disable parallel make option

* fix build for abort, dcc, and epics apps

* fix build for dcc, epics, error, and getevent apps.

* Fixed building of all apps

* fix the ipv4 to ipv6 router app build

* Change indent style from Google to Webkit

* make pretty to re-format style

* removed common Makefile since we already had one and two was too many

* remove scripts from root folder that are no longer maintained or used

* remove mercurial EOL and ignore files for git repo

* remove .vscodeconfig files from repo

* tweak clang-format style

* clang-format src and apps with tweaked style

* added clang-tidy to fix readability if braces in src

* result of make tidy for src and apps

* fix clang-tidy mangling

* Added code::blocks project for BACnet server simulation

* added code::blocks linux project for WhoIs app

* update text files for EOL

* fix EOL in some files

* fixed make win32 apps for older gcc

* Removed Borland C++ Makefile in apps. Unable to maintain support for Borland C++ compiler.

* created codeblocks project for apps/epics for Windows

* fixing ports/xplained to work with new data structure.

* fix ports/xplained example for Atmel Studio compile

* fix ports/stm32f10x example for gcc Makefile compile

* fix ports/stm32f10x example for IAR EWARM compile

* fix ports/xplained timer callback

* fix ports/bdk_atxx_mspt build with subdirs

* fix ports/bdk_atxx_mspt build with subdirs

* updated git ignore for IAR build artifacts

* updated gitignore for non-tracked files and folders

* fixed bdk-atxx4-mstp port for Rowley Crossworks project file

* fixed bdk-atxx4-mstp port for GCC AVR Makefile

* fixed atmega168 port for IAR AVR and GCC AVR Makefile

* fixed at91sam7s port for IAR ARM and GCC ARM Makefile

* removed unmaintainable DOS, RTOS32, and atmega8 ports.  Updated rx62n (untested).

* changed arm7 to uip port
This commit is contained in:
Steve Karg
2019-12-13 15:19:10 -06:00
committed by GitHub
parent 8a38dbe2cf
commit d50c190957
912 changed files with 36206 additions and 52502 deletions
+26 -28
View File
@@ -68,13 +68,11 @@ endif
# Source locations
BACNET_CORE = ../../src
BACNET_INCLUDE = ../../include
BACNET_HANDLER = ../../demo/handler
BACNET_OBJECT = ../../demo/object
BACNET_DEMO = ../../demo
BACNET_INCLUDE = $(BACNET_CORE)
BACNET_BASIC = $(BACNET_CORE)/basic
# local files for this project
CSRC = main.c \
HALSRC = main.c \
fuses.c \
init.c \
stack.c \
@@ -82,8 +80,7 @@ CSRC = main.c \
input.c \
serial.c \
rs485.c \
timer2.c \
timer.c \
mstimer-init.c \
led.c \
eeprom.c \
seeprom.c \
@@ -99,23 +96,27 @@ CSRC = main.c \
bo.c
# common demo files needed
DEMOSRC = $(BACNET_DEMO)/handler/h_dcc.c \
$(BACNET_DEMO)/handler/h_npdu.c \
$(BACNET_DEMO)/handler/h_rd.c \
$(BACNET_DEMO)/handler/h_rp.c \
$(BACNET_DEMO)/handler/h_rpm.c \
$(BACNET_DEMO)/handler/h_whohas.c \
$(BACNET_DEMO)/handler/h_whois.c \
$(BACNET_DEMO)/handler/h_wp.c \
$(BACNET_DEMO)/handler/noserv.c \
$(BACNET_DEMO)/handler/s_iam.c \
$(BACNET_DEMO)/handler/s_ihave.c \
$(BACNET_DEMO)/handler/txbuf.c
BASICSRC = $(BACNET_BASIC)/service/h_dcc.c \
$(BACNET_BASIC)/service/h_apdu.c \
$(BACNET_BASIC)/service/h_rd.c \
$(BACNET_BASIC)/service/h_rp.c \
$(BACNET_BASIC)/service/h_rpm.c \
$(BACNET_BASIC)/service/h_whohas.c \
$(BACNET_BASIC)/service/h_whois.c \
$(BACNET_BASIC)/service/h_wp.c \
$(BACNET_BASIC)/service/h_noserv.c \
$(BACNET_BASIC)/service/s_iam.c \
$(BACNET_BASIC)/service/s_ihave.c \
$(BACNET_BASIC)/sys/fifo.c \
$(BACNET_BASIC)/sys/mstimer.c \
$(BACNET_BASIC)/sys/ringbuf.c \
$(BACNET_BASIC)/npdu/h_npdu.c \
$(BACNET_BASIC)/tsm/tsm.c
# core BACnet stack files
CORESRC = \
$(BACNET_CORE)/datalink/crc.c \
$(BACNET_CORE)/abort.c \
$(BACNET_CORE)/apdu.c \
$(BACNET_CORE)/bacaddr.c \
$(BACNET_CORE)/bacapp.c \
$(BACNET_CORE)/bacdcode.c \
@@ -123,16 +124,13 @@ CORESRC = \
$(BACNET_CORE)/bacint.c \
$(BACNET_CORE)/bacreal.c \
$(BACNET_CORE)/bacstr.c \
$(BACNET_CORE)/crc.c \
$(BACNET_CORE)/dcc.c \
$(BACNET_CORE)/fifo.c \
$(BACNET_CORE)/iam.c \
$(BACNET_CORE)/ihave.c \
$(BACNET_CORE)/memcopy.c \
$(BACNET_CORE)/npdu.c \
$(BACNET_CORE)/rd.c \
$(BACNET_CORE)/reject.c \
$(BACNET_CORE)/ringbuf.c \
$(BACNET_CORE)/rp.c \
$(BACNET_CORE)/rpm.c \
$(BACNET_CORE)/whohas.c \
@@ -157,11 +155,11 @@ CORESRC = \
# $(BACNET_CORE)/address.c \
## Include Directories
INCLUDES = -I. -I$(BACNET_INCLUDE) -I$(BACNET_HANDLER) -I$(BACNET_OBJECT)
INCLUDES = -I. -I$(BACNET_INCLUDE)
# Source to Object conversion
COBJ = $(CSRC:%.c=%.o)
DEMOOBJ = $(DEMOSRC:.c=.o)
HALOBJ = $(HALSRC:%.c=%.o)
BASICOBJ = $(BASICSRC:.c=.o)
COREOBJ = $(CORESRC:.c=.o)
LIBRARY = lib$(TARGET).a
@@ -327,7 +325,7 @@ AVRDUDE_INSTALL = $(AVRDUDE_WRITE_FLASH)
#AVRDUDE_INSTALL += $(AVRDUDE_WRITE_FUSES)
## Objects not in library that must be built in order to link
OBJECTS = $(COBJ) $(DEMOOBJ)
OBJECTS = $(HALOBJ) $(BASICOBJ)
## Build
TARGET_ELF=$(TARGET).elf
@@ -370,7 +368,7 @@ size: ${TARGET_ELF}
@${SIZE} ${SIZE_OPTIONS} ${TARGET_ELF}
lint:
$(LINT) -exportlocal -D$(LINT_MCU) $(BFLAGS) $(CSRC)
$(LINT) -exportlocal -D$(LINT_MCU) $(BFLAGS) $(HALSRC)
install: $(TARGET_ELF)
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_INSTALL)
+6 -6
View File
@@ -28,12 +28,12 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "bacdef.h"
#include "bacdcode.h"
#include "bacenum.h"
#include "config.h"
#include "ai.h"
#include "handlers.h"
#include "bacnet/bacdef.h"
#include "bacnet/bacdcode.h"
#include "bacnet/bacenum.h"
#include "bacnet/config.h"
#include "bacnet/basic/object/ai.h"
#include "bacnet/basic/services.h"
#ifndef MAX_ANALOG_INPUTS
#define MAX_ANALOG_INPUTS 2
+8 -8
View File
@@ -29,14 +29,14 @@
#include <stdint.h>
#include <stdio.h>
#include "bacdef.h"
#include "bacdcode.h"
#include "bacenum.h"
#include "bacapp.h"
#include "config.h" /* the custom stuff */
#include "wp.h"
#include "av.h"
#include "handlers.h"
#include "bacnet/bacdef.h"
#include "bacnet/bacdcode.h"
#include "bacnet/bacenum.h"
#include "bacnet/bacapp.h"
#include "bacnet/config.h" /* the custom stuff */
#include "bacnet/wp.h"
#include "bacnet/basic/object/av.h"
#include "bacnet/basic/services.h"
#include "hardware.h"
#ifndef MAX_ANALOG_VALUES
File diff suppressed because it is too large Load Diff
+84 -84
View File
@@ -1,84 +1,84 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRBootloader.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing an interface to the AVR bootloader
* described in Application Note AVR109.
* This class is derived from AVRPRogrammer.
*
*
****************************************************************************/
#ifndef AVRBOOTLOADER_HPP
#define AVRBOOTLOADER_HPP
using namespace std;
#include "AVRProgrammer.hpp"
#include "Utility.hpp"
class AVRBootloader : public AVRProgrammer
{
protected:
virtual void setAddress( long address );
virtual void writeFlashLowByte( long value ); // Alwyas low byte first...
virtual void writeFlashHighByte( long value ); // ...then high byte.
virtual void writeFlashPage();
virtual bool writeFlashBlock( HEXFile * data );
virtual bool readFlashBlock( HEXFile * data );
virtual bool writeEEPROMBlock( HEXFile * data );
virtual bool readEEPROMBlock( HEXFile * data );
public:
/* Constructor */
AVRBootloader( CommChannel * _comm );
/* Destructor */
~AVRBootloader();
/* Methods */
virtual bool enterProgrammingMode();
virtual bool leaveProgrammingMode();
virtual bool chipErase();
virtual bool readOSCCAL( long pos, long * value );
virtual bool readSignature( long * sig0, long * sig1, long * sig2 );
virtual bool checkSignature( long sig0, long sig1, long sig2 );
virtual bool writeFlashByte( long address, long value );
virtual bool writeEEPROMByte( long address, long value );
virtual bool writeFlash( HEXFile * data );
virtual bool readFlash( HEXFile * data );
virtual bool writeEEPROM( HEXFile * data );
virtual bool readEEPROM( HEXFile * data );
virtual bool writeLockBits( long bits );
virtual bool readLockBits( long * bits );
virtual bool writeFuseBits( long bits );
virtual bool readFuseBits( long * bits );
virtual bool writeExtendedFuseBits( long bits );
virtual bool readExtendedFuseBits( long * bits );
virtual bool programmerSoftwareVersion( long * major, long * minor );
virtual bool programmerHardwareVersion( long * major, long * minor );
};
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRBootloader.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing an interface to the AVR bootloader
* described in Application Note AVR109.
* This class is derived from AVRPRogrammer.
*
*
****************************************************************************/
#ifndef AVRBOOTLOADER_HPP
#define AVRBOOTLOADER_HPP
using namespace std;
#include "AVRProgrammer.hpp"
#include "Utility.hpp"
class AVRBootloader : public AVRProgrammer
{
protected:
virtual void setAddress( long address );
virtual void writeFlashLowByte( long value ); // Alwyas low byte first...
virtual void writeFlashHighByte( long value ); // ...then high byte.
virtual void writeFlashPage();
virtual bool writeFlashBlock( HEXFile * data );
virtual bool readFlashBlock( HEXFile * data );
virtual bool writeEEPROMBlock( HEXFile * data );
virtual bool readEEPROMBlock( HEXFile * data );
public:
/* Constructor */
AVRBootloader( CommChannel * _comm );
/* Destructor */
~AVRBootloader();
/* Methods */
virtual bool enterProgrammingMode();
virtual bool leaveProgrammingMode();
virtual bool chipErase();
virtual bool readOSCCAL( long pos, long * value );
virtual bool readSignature( long * sig0, long * sig1, long * sig2 );
virtual bool checkSignature( long sig0, long sig1, long sig2 );
virtual bool writeFlashByte( long address, long value );
virtual bool writeEEPROMByte( long address, long value );
virtual bool writeFlash( HEXFile * data );
virtual bool readFlash( HEXFile * data );
virtual bool writeEEPROM( HEXFile * data );
virtual bool readEEPROM( HEXFile * data );
virtual bool writeLockBits( long bits );
virtual bool readLockBits( long * bits );
virtual bool writeFuseBits( long bits );
virtual bool readFuseBits( long * bits );
virtual bool writeExtendedFuseBits( long bits );
virtual bool readExtendedFuseBits( long * bits );
virtual bool programmerSoftwareVersion( long * major, long * minor );
virtual bool programmerHardwareVersion( long * major, long * minor );
};
#endif
+157 -157
View File
@@ -1,157 +1,157 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRDevice.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 4017 $
* Date : $Date: 2008-06-02 14:26:03 +0200 (ma, 02 jun 2008) $
* Updated by : $Author: khole $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class containing information of device memory sizes etc.
* It also provides funcitons for reading these parameters from
* the PartDescriptionFiles supplied with AVR Studio 4.
*
*
****************************************************************************/
#include "AVRDevice.hpp"
/* Constructor */
AVRDevice::AVRDevice( const string & _deviceName ) :
deviceName( _deviceName )
{
flashSize =
eepromSize = 0;
hasFuseBits = false;
hasExtendedFuseBits = false;
signature0 =
signature1 =
signature2 = 0;
pagesize = -1;
}
/* Destructor */
AVRDevice::~AVRDevice()
{
/* no code here */
}
/* Read parameters from AVR Studio XML files */
void AVRDevice::readParametersFromAVRStudio( vector<string> & searchpath )
{
string path;
string signature;
string cache;
#ifndef NOREGISTRY
/* Locate the directory containing the XML files from the Windows registry database */
try
{
path = Util.getRegistryValue( "SOFTWARE\\Atmel\\AVRTools\\", "AVRToolsPath" );
path += "\\PartDescriptionFiles";
searchpath.push_back( path );
} catch( ErrorMsg * e )
{
delete e;
}
#endif
/* Search for file */
path.erase();
int i;
for( i = 0; i < searchpath.size(); i++ )
{
path = searchpath[i] + "\\" + deviceName + ".xml";
if( Util.fileExists( path ) )
break;
}
if( i == searchpath.size() )
throw new ErrorMsg( "Device XML file not found in search path!" );
/* Parse the file for required info */
Util.log( "Parsing '" + path + "'...\r\n" );
XMLFile f( path ); // Load XML info
flashSize = atoi( f.getValue( "AVRPART\\MEMORY\\PROG_FLASH" ).c_str() );
eepromSize = atoi( f.getValue( "AVRPART\\MEMORY\\EEPROM" ).c_str() );
cache += "<AVRPART><MEMORY><PROG_FLASH>";
cache += f.getValue( "AVRPART\\MEMORY\\PROG_FLASH" );
cache += "</PROG_FLASH><EEPROM>";
cache += f.getValue( "AVRPART\\MEMORY\\EEPROM" );
cache += "</EEPROM>";
if( f.exists( "AVRPART\\MEMORY\\BOOT_CONFIG" ) )
{
pagesize = atoi( f.getValue( "AVRPART\\MEMORY\\BOOT_CONFIG\\PAGESIZE" ).c_str() );
pagesize <<= 1; // We want pagesize in bytes.
cache += "<BOOT_CONFIG><PAGESIZE>";
cache += f.getValue( "AVRPART\\MEMORY\\BOOT_CONFIG\\PAGESIZE" );
cache += "</PAGESIZE></BOOT_CONFIG>";
}
cache += "</MEMORY>";
if( f.exists( "AVRPART\\FUSE" ) )
{
hasFuseBits = true;
cache += "<FUSE>";
if( f.exists( "AVRPART\\FUSE\\EXTENDED" ) )
{
hasExtendedFuseBits = true;
cache += "<EXTENDED></EXTENDED>";
}
cache += "</FUSE>";
}
signature = f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR000" );
signature.erase( 0, 1 ); // Remove the $ character.
signature0 = Util.convertHex( signature );
signature = f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR001" );
signature.erase( 0, 1 ); // Remove the $ character.
signature1 = Util.convertHex( signature );
signature = f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR002" );
signature.erase( 0, 1 ); // Remove the $ character.
signature2 = Util.convertHex( signature );
cache += "<ADMIN><SIGNATURE><ADDR000>";
cache += f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR000" );
cache += "</ADDR000><ADDR001>";
cache += f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR001" );
cache += "</ADDR001><ADDR002>";
cache += f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR002" );
cache += "</ADDR002></SIGNATURE></ADMIN></AVRPART>\r\n";
/* Save cached file to application directory */
Util.log( "Saving cached XML parameters...\r\n" );
Util.saveString( cache, searchpath[1] + "\\" + deviceName + ".xml" );
}
void AVRDevice::getSignature( long * sig0, long * sig1, long * sig2 )
{
if( sig0 == NULL || sig1 == NULL || sig2 == NULL )
throw new ErrorMsg( "Cannot copy signature bytes to NULL-pointers!" );
*sig0 = signature0;
*sig1 = signature1;
*sig2 = signature2;
}
/* end of file */
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRDevice.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 4017 $
* Date : $Date: 2008-06-02 14:26:03 +0200 (ma, 02 jun 2008) $
* Updated by : $Author: khole $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class containing information of device memory sizes etc.
* It also provides funcitons for reading these parameters from
* the PartDescriptionFiles supplied with AVR Studio 4.
*
*
****************************************************************************/
#include "AVRDevice.hpp"
/* Constructor */
AVRDevice::AVRDevice( const string & _deviceName ) :
deviceName( _deviceName )
{
flashSize =
eepromSize = 0;
hasFuseBits = false;
hasExtendedFuseBits = false;
signature0 =
signature1 =
signature2 = 0;
pagesize = -1;
}
/* Destructor */
AVRDevice::~AVRDevice()
{
/* no code here */
}
/* Read parameters from AVR Studio XML files */
void AVRDevice::readParametersFromAVRStudio( vector<string> & searchpath )
{
string path;
string signature;
string cache;
#ifndef NOREGISTRY
/* Locate the directory containing the XML files from the Windows registry database */
try
{
path = Util.getRegistryValue( "SOFTWARE\\Atmel\\AVRTools\\", "AVRToolsPath" );
path += "\\PartDescriptionFiles";
searchpath.push_back( path );
} catch( ErrorMsg * e )
{
delete e;
}
#endif
/* Search for file */
path.erase();
int i;
for( i = 0; i < searchpath.size(); i++ )
{
path = searchpath[i] + "\\" + deviceName + ".xml";
if( Util.fileExists( path ) )
break;
}
if( i == searchpath.size() )
throw new ErrorMsg( "Device XML file not found in search path!" );
/* Parse the file for required info */
Util.log( "Parsing '" + path + "'...\r\n" );
XMLFile f( path ); // Load XML info
flashSize = atoi( f.getValue( "AVRPART\\MEMORY\\PROG_FLASH" ).c_str() );
eepromSize = atoi( f.getValue( "AVRPART\\MEMORY\\EEPROM" ).c_str() );
cache += "<AVRPART><MEMORY><PROG_FLASH>";
cache += f.getValue( "AVRPART\\MEMORY\\PROG_FLASH" );
cache += "</PROG_FLASH><EEPROM>";
cache += f.getValue( "AVRPART\\MEMORY\\EEPROM" );
cache += "</EEPROM>";
if( f.exists( "AVRPART\\MEMORY\\BOOT_CONFIG" ) )
{
pagesize = atoi( f.getValue( "AVRPART\\MEMORY\\BOOT_CONFIG\\PAGESIZE" ).c_str() );
pagesize <<= 1; // We want pagesize in bytes.
cache += "<BOOT_CONFIG><PAGESIZE>";
cache += f.getValue( "AVRPART\\MEMORY\\BOOT_CONFIG\\PAGESIZE" );
cache += "</PAGESIZE></BOOT_CONFIG>";
}
cache += "</MEMORY>";
if( f.exists( "AVRPART\\FUSE" ) )
{
hasFuseBits = true;
cache += "<FUSE>";
if( f.exists( "AVRPART\\FUSE\\EXTENDED" ) )
{
hasExtendedFuseBits = true;
cache += "<EXTENDED></EXTENDED>";
}
cache += "</FUSE>";
}
signature = f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR000" );
signature.erase( 0, 1 ); // Remove the $ character.
signature0 = Util.convertHex( signature );
signature = f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR001" );
signature.erase( 0, 1 ); // Remove the $ character.
signature1 = Util.convertHex( signature );
signature = f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR002" );
signature.erase( 0, 1 ); // Remove the $ character.
signature2 = Util.convertHex( signature );
cache += "<ADMIN><SIGNATURE><ADDR000>";
cache += f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR000" );
cache += "</ADDR000><ADDR001>";
cache += f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR001" );
cache += "</ADDR001><ADDR002>";
cache += f.getValue( "AVRPART\\ADMIN\\SIGNATURE\\ADDR002" );
cache += "</ADDR002></SIGNATURE></ADMIN></AVRPART>\r\n";
/* Save cached file to application directory */
Util.log( "Saving cached XML parameters...\r\n" );
Util.saveString( cache, searchpath[1] + "\\" + deviceName + ".xml" );
}
void AVRDevice::getSignature( long * sig0, long * sig1, long * sig2 )
{
if( sig0 == NULL || sig1 == NULL || sig2 == NULL )
throw new ErrorMsg( "Cannot copy signature bytes to NULL-pointers!" );
*sig0 = signature0;
*sig1 = signature1;
*sig2 = signature2;
}
/* end of file */
+69 -69
View File
@@ -1,69 +1,69 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRDevice.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class containing information of device memory sizes etc.
* It also provides funcitons for reading these parameters from
* the PartDescriptionFiles supplied with AVR Studio 4.
*
*
****************************************************************************/
#ifndef AVRDEVICE_HPP
#define AVRDEVICE_HPP
using namespace std;
#include <string>
#include <vector>
#include "Utility.hpp"
#include "XMLParser.hpp"
#include "ErrorMsg.hpp"
class AVRDevice
{
protected:
string deviceName; // The name of the device, eg. ATmega128.
long flashSize; // Size of Flash memory in bytes.
long eepromSize; // Size of EEPROM memory in bytes.
bool hasFuseBits; // Does this device have fuse bits at all?
bool hasExtendedFuseBits; // Does this device have extended fuses?
long signature0;
long signature1;
long signature2; // The three signature bytes, read from XML PartDescriptionFiles.
long pagesize; // Flash page size.
public:
/* Constructor */
AVRDevice( const string & _deviceName );
/* Destructor */
~AVRDevice();
/* Methods */
void readParametersFromAVRStudio( vector<string> & searchpath );
long getFlashSize() { return flashSize; }
long getEEPROMSize() { return eepromSize; }
long getPageSize() { return pagesize; }
bool getFuseStatus() { return hasFuseBits; }
bool getXFuseStatus() { return hasExtendedFuseBits; }
void getSignature( long * sig0, long * sig1, long * sig2 );
};
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRDevice.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class containing information of device memory sizes etc.
* It also provides funcitons for reading these parameters from
* the PartDescriptionFiles supplied with AVR Studio 4.
*
*
****************************************************************************/
#ifndef AVRDEVICE_HPP
#define AVRDEVICE_HPP
using namespace std;
#include <string>
#include <vector>
#include "Utility.hpp"
#include "XMLParser.hpp"
#include "ErrorMsg.hpp"
class AVRDevice
{
protected:
string deviceName; // The name of the device, eg. ATmega128.
long flashSize; // Size of Flash memory in bytes.
long eepromSize; // Size of EEPROM memory in bytes.
bool hasFuseBits; // Does this device have fuse bits at all?
bool hasExtendedFuseBits; // Does this device have extended fuses?
long signature0;
long signature1;
long signature2; // The three signature bytes, read from XML PartDescriptionFiles.
long pagesize; // Flash page size.
public:
/* Constructor */
AVRDevice( const string & _deviceName );
/* Destructor */
~AVRDevice();
/* Methods */
void readParametersFromAVRStudio( vector<string> & searchpath );
long getFlashSize() { return flashSize; }
long getEEPROMSize() { return eepromSize; }
long getPageSize() { return pagesize; }
bool getFuseStatus() { return hasFuseBits; }
bool getXFuseStatus() { return hasExtendedFuseBits; }
void getSignature( long * sig0, long * sig1, long * sig2 );
};
#endif
File diff suppressed because it is too large Load Diff
+78 -78
View File
@@ -1,78 +1,78 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRInSystemProg.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing an interface to the AVR ISP described
* in Application Note AVR910. This class is derived from AVRPRogrammer.
*
*
****************************************************************************/
#ifndef AVRINSYSTEMPROG_HPP
#define AVRINSYSTEMPROG_HPP
using namespace std;
#include "AVRProgrammer.hpp"
#include "Utility.hpp"
class AVRInSystemProg : public AVRProgrammer
{
protected:
void setAddress( long address );
void writeFlashLowByte( long value ); // Alwyas low byte first...
void writeFlashHighByte( long value ); // ...then high byte.
void writeFlashPage();
public:
/* Constructor */
AVRInSystemProg( CommChannel * _comm );
/* Destructor */
~AVRInSystemProg();
/* Methods */
virtual bool enterProgrammingMode();
virtual bool leaveProgrammingMode();
virtual bool chipErase();
virtual bool readOSCCAL( long pos, long * value );
virtual bool readSignature( long * sig0, long * sig1, long * sig2 );
virtual bool checkSignature( long sig0, long sig1, long sig2 );
virtual bool writeFlashByte( long address, long value );
virtual bool writeEEPROMByte( long address, long value );
virtual bool writeFlash( HEXFile * data );
virtual bool readFlash( HEXFile * data );
virtual bool writeEEPROM( HEXFile * data );
virtual bool readEEPROM( HEXFile * data );
virtual bool writeLockBits( long bits );
virtual bool readLockBits( long * bits );
virtual bool writeFuseBits( long bits );
virtual bool readFuseBits( long * bits );
virtual bool writeExtendedFuseBits( long bits );
virtual bool readExtendedFuseBits( long * bits );
virtual bool programmerSoftwareVersion( long * major, long * minor );
virtual bool programmerHardwareVersion( long * major, long * minor );
};
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRInSystemProg.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing an interface to the AVR ISP described
* in Application Note AVR910. This class is derived from AVRPRogrammer.
*
*
****************************************************************************/
#ifndef AVRINSYSTEMPROG_HPP
#define AVRINSYSTEMPROG_HPP
using namespace std;
#include "AVRProgrammer.hpp"
#include "Utility.hpp"
class AVRInSystemProg : public AVRProgrammer
{
protected:
void setAddress( long address );
void writeFlashLowByte( long value ); // Alwyas low byte first...
void writeFlashHighByte( long value ); // ...then high byte.
void writeFlashPage();
public:
/* Constructor */
AVRInSystemProg( CommChannel * _comm );
/* Destructor */
~AVRInSystemProg();
/* Methods */
virtual bool enterProgrammingMode();
virtual bool leaveProgrammingMode();
virtual bool chipErase();
virtual bool readOSCCAL( long pos, long * value );
virtual bool readSignature( long * sig0, long * sig1, long * sig2 );
virtual bool checkSignature( long sig0, long sig1, long sig2 );
virtual bool writeFlashByte( long address, long value );
virtual bool writeEEPROMByte( long address, long value );
virtual bool writeFlash( HEXFile * data );
virtual bool readFlash( HEXFile * data );
virtual bool writeEEPROM( HEXFile * data );
virtual bool readEEPROM( HEXFile * data );
virtual bool writeLockBits( long bits );
virtual bool readLockBits( long * bits );
virtual bool writeFuseBits( long bits );
virtual bool readFuseBits( long * bits );
virtual bool writeExtendedFuseBits( long bits );
virtual bool readExtendedFuseBits( long * bits );
virtual bool programmerSoftwareVersion( long * major, long * minor );
virtual bool programmerHardwareVersion( long * major, long * minor );
};
#endif
+169 -169
View File
@@ -1,169 +1,169 @@
[Project]
FileName=AVROSP.dev
Name=AVROSP
UnitCount=12
Type=1
Ver=1
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=
IsCpp=1
Icon=
ExeOutput=
ObjectOutput=
OverrideOutput=0
OverrideOutputName=AVROSP.exe
HostApplication=
Folders=
CommandLine= -dATmega16 -if\temp\rnd8KB.hex -pf
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=000000000000000100
UseCustomMakefile=0
CustomMakefile=
[Unit1]
FileName=main.cpp
CompileCpp=1
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit2]
FileName=CommChannel.cpp
CompileCpp=1
Folder=Serialtest
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit3]
FileName=ErrorMsg.cpp
CompileCpp=1
Folder=Serialtest
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit4]
FileName=JobInfo.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit5]
FileName=AVRDevice.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit6]
FileName=HEXParser.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit7]
FileName=XMLParser.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit8]
FileName=AVRBootloader.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit9]
FileName=AVRProgrammer.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit10]
FileName=Utility.cpp
CompileCpp=1
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit11]
FileName=SerialPort.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit12]
FileName=AVRInSystemProg.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Project]
FileName=AVROSP.dev
Name=AVROSP
UnitCount=12
Type=1
Ver=1
ObjFiles=
Includes=
Libs=
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=
CppCompiler=
Linker=
IsCpp=1
Icon=
ExeOutput=
ObjectOutput=
OverrideOutput=0
OverrideOutputName=AVROSP.exe
HostApplication=
Folders=
CommandLine= -dATmega16 -if\temp\rnd8KB.hex -pf
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=000000000000000100
UseCustomMakefile=0
CustomMakefile=
[Unit1]
FileName=main.cpp
CompileCpp=1
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0
[Unit2]
FileName=CommChannel.cpp
CompileCpp=1
Folder=Serialtest
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit3]
FileName=ErrorMsg.cpp
CompileCpp=1
Folder=Serialtest
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit4]
FileName=JobInfo.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit5]
FileName=AVRDevice.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit6]
FileName=HEXParser.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit7]
FileName=XMLParser.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit8]
FileName=AVRBootloader.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit9]
FileName=AVRProgrammer.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit10]
FileName=Utility.cpp
CompileCpp=1
Folder=
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit11]
FileName=SerialPort.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit12]
FileName=AVRInSystemProg.cpp
CompileCpp=1
Folder=AVROSP
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
+70 -70
View File
@@ -1,70 +1,70 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRProgrammer.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : An abstract class containing a framework for a generic
* programmer for AVR parts. Reading and writing Flash, EEPROM
* lock bits and all fuse bits and reading OSCCAL and reading
* signature bytes are supported.
*
*
****************************************************************************/
#include "AVRProgrammer.hpp"
/* Constructor */
AVRProgrammer::AVRProgrammer( CommChannel * _comm ) :
pagesize( -1 )
{
if( _comm == NULL )
throw new ErrorMsg( "NULL pointer provided for communication channel!" );
comm = _comm;
}
/* Destructor */
AVRProgrammer::~AVRProgrammer()
{
/* No code here */
}
string AVRProgrammer::readProgrammerID( CommChannel * _comm )
{
string id( "1234567" ); // Reserve 7 characters.
if( _comm == NULL )
throw new ErrorMsg( "NULL pointer provided for communication channel!" );
/* Synchonize with programmer */
for( int i = 0; i < 10; i++ )
_comm->sendByte( 27 ); // Send ESC
/* Send 'S' command to programmer */
_comm->sendByte( 'S' );
_comm->flushTX();
/* Read 7 characters */
for( long i = 0; i < id.size(); i++ )
{
id[i] = _comm->getByte();
}
return id;
}
/* end of file */
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRProgrammer.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : An abstract class containing a framework for a generic
* programmer for AVR parts. Reading and writing Flash, EEPROM
* lock bits and all fuse bits and reading OSCCAL and reading
* signature bytes are supported.
*
*
****************************************************************************/
#include "AVRProgrammer.hpp"
/* Constructor */
AVRProgrammer::AVRProgrammer( CommChannel * _comm ) :
pagesize( -1 )
{
if( _comm == NULL )
throw new ErrorMsg( "NULL pointer provided for communication channel!" );
comm = _comm;
}
/* Destructor */
AVRProgrammer::~AVRProgrammer()
{
/* No code here */
}
string AVRProgrammer::readProgrammerID( CommChannel * _comm )
{
string id( "1234567" ); // Reserve 7 characters.
if( _comm == NULL )
throw new ErrorMsg( "NULL pointer provided for communication channel!" );
/* Synchonize with programmer */
for( int i = 0; i < 10; i++ )
_comm->sendByte( 27 ); // Send ESC
/* Send 'S' command to programmer */
_comm->sendByte( 'S' );
_comm->flushTX();
/* Read 7 characters */
for( long i = 0; i < id.size(); i++ )
{
id[i] = _comm->getByte();
}
return id;
}
/* end of file */
+84 -84
View File
@@ -1,84 +1,84 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRProgrammer.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : An abstract class containing a framework for a generic
* programmer for AVR parts. Reading and writing Flash, EEPROM
* lock bits and all fuse bits and reading OSCCAL and reading
* signature bytes are supported.
*
*
****************************************************************************/
#ifndef AVRPROGRAMMER_HPP
#define AVRPROGRAMMER_HPP
using namespace std;
#include "ErrorMsg.hpp"
#include "HEXParser.hpp"
#include "CommChannel.hpp"
class AVRProgrammer
{
protected:
long pagesize; // Flash page size.
CommChannel * comm;
public:
/* Constructor */
AVRProgrammer( CommChannel * _comm );
/* Destructor */
~AVRProgrammer();
/* Static member */
static string readProgrammerID( CommChannel * _comm ); // Reads 7-character ID.
/* Methods */
void setPagesize( long _pagesize ) { pagesize = _pagesize; }
virtual bool enterProgrammingMode() = 0;
virtual bool leaveProgrammingMode() = 0;
virtual bool chipErase() = 0;
virtual bool readOSCCAL( long pos, long * value ) = 0;
virtual bool readSignature( long * sig0, long * sig1, long * sig2 ) = 0;
virtual bool checkSignature( long sig0, long sig1, long sig2 ) = 0;
virtual bool writeFlashByte( long address, long value ) = 0;
virtual bool writeEEPROMByte( long address, long value ) = 0;
virtual bool writeFlash( HEXFile * data ) = 0;
virtual bool readFlash( HEXFile * data ) = 0;
virtual bool writeEEPROM( HEXFile * data ) = 0;
virtual bool readEEPROM( HEXFile * data ) = 0;
virtual bool writeLockBits( long bits ) = 0;
virtual bool readLockBits( long * bits ) = 0;
virtual bool writeFuseBits( long bits ) = 0;
virtual bool readFuseBits( long * bits ) = 0;
virtual bool writeExtendedFuseBits( long bits ) = 0;
virtual bool readExtendedFuseBits( long * bits ) = 0;
virtual bool programmerSoftwareVersion( long * major, long * minor ) = 0;
virtual bool programmerHardwareVersion( long * major, long * minor ) = 0;
};
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : AVRProgrammer.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : An abstract class containing a framework for a generic
* programmer for AVR parts. Reading and writing Flash, EEPROM
* lock bits and all fuse bits and reading OSCCAL and reading
* signature bytes are supported.
*
*
****************************************************************************/
#ifndef AVRPROGRAMMER_HPP
#define AVRPROGRAMMER_HPP
using namespace std;
#include "ErrorMsg.hpp"
#include "HEXParser.hpp"
#include "CommChannel.hpp"
class AVRProgrammer
{
protected:
long pagesize; // Flash page size.
CommChannel * comm;
public:
/* Constructor */
AVRProgrammer( CommChannel * _comm );
/* Destructor */
~AVRProgrammer();
/* Static member */
static string readProgrammerID( CommChannel * _comm ); // Reads 7-character ID.
/* Methods */
void setPagesize( long _pagesize ) { pagesize = _pagesize; }
virtual bool enterProgrammingMode() = 0;
virtual bool leaveProgrammingMode() = 0;
virtual bool chipErase() = 0;
virtual bool readOSCCAL( long pos, long * value ) = 0;
virtual bool readSignature( long * sig0, long * sig1, long * sig2 ) = 0;
virtual bool checkSignature( long sig0, long sig1, long sig2 ) = 0;
virtual bool writeFlashByte( long address, long value ) = 0;
virtual bool writeEEPROMByte( long address, long value ) = 0;
virtual bool writeFlash( HEXFile * data ) = 0;
virtual bool readFlash( HEXFile * data ) = 0;
virtual bool writeEEPROM( HEXFile * data ) = 0;
virtual bool readEEPROM( HEXFile * data ) = 0;
virtual bool writeLockBits( long bits ) = 0;
virtual bool readLockBits( long * bits ) = 0;
virtual bool writeFuseBits( long bits ) = 0;
virtual bool readFuseBits( long * bits ) = 0;
virtual bool writeExtendedFuseBits( long bits ) = 0;
virtual bool readExtendedFuseBits( long * bits ) = 0;
virtual bool programmerSoftwareVersion( long * major, long * minor ) = 0;
virtual bool programmerHardwareVersion( long * major, long * minor ) = 0;
};
#endif
+38 -38
View File
@@ -1,38 +1,38 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : CommChannel.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : An abstract class for general byte-by-byte communication.
* Serialport, USB, TCP/IP or similar implementations can be derived
* from this class to create a technology-independent
* communication interface.
*
* This abstract class does not provide any constructor as it is
* too specific for this generalized class. Derived classes should
* implement their own constructors for specific communication devices.
*
*
****************************************************************************/
#include "CommChannel.hpp"
/* Destructor */
CommChannel::~CommChannel()
{
/* no code here */
}
/* end of file */
/*****************************************************************************
*
* Atmel Corporation
*
* File : CommChannel.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : An abstract class for general byte-by-byte communication.
* Serialport, USB, TCP/IP or similar implementations can be derived
* from this class to create a technology-independent
* communication interface.
*
* This abstract class does not provide any constructor as it is
* too specific for this generalized class. Derived classes should
* implement their own constructors for specific communication devices.
*
*
****************************************************************************/
#include "CommChannel.hpp"
/* Destructor */
CommChannel::~CommChannel()
{
/* no code here */
}
/* end of file */
+61 -61
View File
@@ -1,61 +1,61 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : CommChannel.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : An abstract class for general byte-by-byte communication.
* Serialport, USB, TCP/IP or similar implementations can be derived
* from this class to create a technology-independent
* communication interface.
*
* This abstract class does not provide any constructor as it is
* too specific for this generalized class. Derived classes should
* implement their own constructors for specific communication devices.
*
*
****************************************************************************/
#ifndef COMMCHANNEL_HPP
#define COMMCHANNEL_HPP
using namespace std;
class CommChannel
{
public:
// Destructor
virtual ~CommChannel() = 0;
// Open the communication channel.
virtual void openChannel() = 0;
// Close the communication channel.
virtual void closeChannel() = 0;
// Transmit a single byte.
virtual void sendByte( long data ) = 0;
// Receive a single byte.
virtual long getByte() = 0;
// Flush the transmit buffer.
virtual void flushTX() = 0;
// Flush the receive buffer.
virtual void flushRX() = 0;
// Transmit multiple bytes.
virtual void sendMultiple( unsigned char * data, long bufsize ) = 0;
};
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : CommChannel.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : An abstract class for general byte-by-byte communication.
* Serialport, USB, TCP/IP or similar implementations can be derived
* from this class to create a technology-independent
* communication interface.
*
* This abstract class does not provide any constructor as it is
* too specific for this generalized class. Derived classes should
* implement their own constructors for specific communication devices.
*
*
****************************************************************************/
#ifndef COMMCHANNEL_HPP
#define COMMCHANNEL_HPP
using namespace std;
class CommChannel
{
public:
// Destructor
virtual ~CommChannel() = 0;
// Open the communication channel.
virtual void openChannel() = 0;
// Close the communication channel.
virtual void closeChannel() = 0;
// Transmit a single byte.
virtual void sendByte( long data ) = 0;
// Receive a single byte.
virtual long getByte() = 0;
// Flush the transmit buffer.
virtual void flushTX() = 0;
// Flush the receive buffer.
virtual void flushRX() = 0;
// Transmit multiple bytes.
virtual void sendMultiple( unsigned char * data, long bufsize ) = 0;
};
#endif
+46 -46
View File
@@ -1,46 +1,46 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : ErrorMsg.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing a container for general error messages. This
* class can be thrown as an exception.
*
*
****************************************************************************/
#include "ErrorMsg.hpp"
ErrorMsg::ErrorMsg( const string & _message ) :
message( _message )
{
// No code here.
}
/* Destructor */
ErrorMsg::~ErrorMsg()
{
// No code here.
}
/* Get message */
const string & ErrorMsg::What()
{
return message;
}
/* end of file */
/*****************************************************************************
*
* Atmel Corporation
*
* File : ErrorMsg.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing a container for general error messages. This
* class can be thrown as an exception.
*
*
****************************************************************************/
#include "ErrorMsg.hpp"
ErrorMsg::ErrorMsg( const string & _message ) :
message( _message )
{
// No code here.
}
/* Destructor */
ErrorMsg::~ErrorMsg()
{
// No code here.
}
/* Get message */
const string & ErrorMsg::What()
{
return message;
}
/* end of file */
+49 -49
View File
@@ -1,49 +1,49 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : ErrorMsg.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing a container for general error messages. This
* class can be thrown as an exception.
*
*
****************************************************************************/
#ifndef ERRORMSG_HPP
#define ERRORMSG_HPP
using namespace std;
#include <stdlib.h>
#include <iostream>
#include <string>
class ErrorMsg
{
protected:
string message; // Contains the error message.
public:
// Constructors taking the string as parameter.
ErrorMsg( const string & _message );
// Destructor
~ErrorMsg();
// Function returning the error msg.
virtual const string & What();
};
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : ErrorMsg.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing a container for general error messages. This
* class can be thrown as an exception.
*
*
****************************************************************************/
#ifndef ERRORMSG_HPP
#define ERRORMSG_HPP
using namespace std;
#include <stdlib.h>
#include <iostream>
#include <string>
class ErrorMsg
{
protected:
string message; // Contains the error message.
public:
// Constructors taking the string as parameter.
ErrorMsg( const string & _message );
// Destructor
~ErrorMsg();
// Function returning the error msg.
virtual const string & What();
};
#endif
+364 -364
View File
@@ -1,364 +1,364 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : HEXParser.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A simple Intel HEX file format reader/writer.
*
*
****************************************************************************/
#include "HEXParser.hpp"
/* Internal struct for managing HEX records */
struct HEXRecord // Intel HEX file record
{
unsigned char length; // Record length in number of data bytes.
unsigned long offset; // Offset address.
unsigned char type; // Record type.
unsigned char * data; // Optional data bytes.
};
void HEXFile::writeRecord( ofstream & f, HEXRecord * recp )
{
unsigned char checksum;
long recordPos; // Position inside record data field
/* Calculate checksum */
checksum = recp->length;
checksum += (unsigned char) ((recp->offset >> 8) & 0xff);
checksum += (unsigned char) (recp->offset & 0xff);
checksum += recp->type;
/* Write record header */
f.fill('0');
f << ":" << hex
<< setw(2) << (long) recp->length
<< setw(4) << (long) recp->offset
<< setw(2) << (long) recp->type;
/* Write data bytes */
for( recordPos = 0; recordPos < recp->length; recordPos++ )
{
checksum += recp->data[ recordPos ]; // Further checksum calculation
f << hex << setw(2) << (long) recp->data[ recordPos ];
}
/* Write checksum */
checksum = 0 - checksum; // Final checksum preparation
f << setw(2) << (long) checksum << endl;
/* Check for errors */
if( !f.good() )
throw new ErrorMsg( "Error writing HEX record to file!" );
}
void HEXFile::parseRecord( const string & hexLine, HEXRecord * recp )
{
unsigned char checksum;
long recordPos; // Position inside record data fields.
if( hexLine.size() < 11 ) // At least 11 characters.
throw new ErrorMsg( "Wrong HEX file format, missing fields! "
"Line from file was: (" + hexLine + ")." );
/* Check format for line */
if( hexLine[0] != ':' ) // Always start with colon.
throw new ErrorMsg( "Wrong HEX file format, does not start with colon! "
"Line from file was: (" + hexLine + ")." );
/* Parse length, offset and type */
recp->length = Util.convertHex( hexLine.substr( 1, 2 ) );
recp->offset = Util.convertHex( hexLine.substr( 3, 4 ) );
recp->type = Util.convertHex( hexLine.substr( 7, 2 ) );
/* We now know how long the record should be */
if( hexLine.size() < (11+recp->length*2) )
throw new ErrorMsg( "Wrong HEX file format, missing fields! "
"Line from file was: (" + hexLine + ")." );
/* Process checksum */
checksum = recp->length;
checksum += (unsigned char) ((recp->offset >> 8) & 0xff);
checksum += (unsigned char) (recp->offset & 0xff);
checksum += recp->type;
/* Parse data fields */
if( recp->length )
{
recp->data = new unsigned char[ recp->length ];
/* Read data from record */
for( recordPos = 0; recordPos < recp->length; recordPos++ )
{
recp->data[ recordPos ] = Util.convertHex( hexLine.substr( 9 + recordPos*2, 2 ) );
checksum += recp->data[ recordPos ];
}
}
/* Correct checksum? */
checksum += Util.convertHex( hexLine.substr( 9 + recp->length*2, 2 ) );
if( checksum != 0 )
{
throw new ErrorMsg( "Wrong checksum for HEX record! "
"Line from file was: (" + hexLine + ")." );
}
}
/* Constructor */
HEXFile::HEXFile( long buffersize, long value )
{
if( buffersize <= 0 )
throw new ErrorMsg( "Cannot have zero-size HEX buffer!" );
data = new unsigned char[ buffersize ];
if( !data )
throw new ErrorMsg( "Memory allocation failed for HEX-line-buffer!" );
size = buffersize;
clearAll( value );
}
/* Destructor */
HEXFile::~HEXFile()
{
if( data ) delete data;
}
void HEXFile::readFile( const string & _filename )
{
ifstream f;
string hexLine; // Contains one line of the HEX file.
HEXRecord rec; // Temp record.
long baseAddress; // Base address for extended addressing modes.
long dataPos; // Data position in record.
/* Attempt to open file */
f.open( _filename.c_str(), ios::in );
if( !f )
throw new ErrorMsg( "Error opening HEX file for input!" );
/* Prepare */
baseAddress = 0;
start = size;
end = 0;
/* Parse records */
f >> hexLine; // Read one line.
while( !f.eof() )
{
Util.progress( "#" ); // Advance progress indicator.
/* Process record according to type */
parseRecord( hexLine, &rec );
switch( rec.type )
{
case 0x00 : // Data record ?
/* Copy data */
if( baseAddress + rec.offset + rec.length > size )
throw new ErrorMsg( "HEX file defines data outside buffer limits! "
"Make sure file does not contain data outside device "
"memory limits. "
"Line from file was: (" + hexLine + ")." );
for( dataPos = 0; dataPos < rec.length; dataPos++ )
data[ baseAddress + rec.offset + dataPos ] = rec.data[ dataPos ];
/* Update byte usage */
if( baseAddress + rec.offset < start )
start = baseAddress + rec.offset;
if( baseAddress + rec.offset + rec.length - 1 > end )
end = baseAddress + rec.offset + rec.length - 1;
break;
case 0x02 : // Extended segment address record ?
baseAddress = (rec.data[0] << 8) | rec.data[1];
baseAddress <<= 4;
break;
case 0x03 : // Start segment address record ?
break; // Ignore it, since we have no influence on execution start address.
case 0x04 : // Extended linear address record ?
baseAddress = (rec.data[0] << 8) | rec.data[1];
baseAddress <<= 16;
break;
case 0x05 : // Start linear address record ?
break; // Ignore it, since we have no influence on exectuion start address.
case 0x01 : // End of file record ?
f.close();
Util.progress( "\r\n" ); // Finish progress indicator.
return;
default:
throw new ErrorMsg( "Unsupported HEX record format! "
"Line from file was: (" + hexLine + ")." );
}
f >> hexLine; // Read next line.
}
/* We should not end up here */
throw new ErrorMsg( "Premature end of file encountered! Make sure file "
"contains an EOF-record." );
}
void HEXFile::writeFile( const string & _filename )
{
ofstream f;
HEXRecord rec; // Temp record.
long baseAddress; // Absolute data position.
long offset; // Offset from base address.
long dataPos; // Position inside data record.
enum
{
_first,
_writing,
_passed64k
} status; // Write status, see usage below.
/* Attempt to create file */
f.open( _filename.c_str(), ios::out );
if( !f )
throw new ErrorMsg( "Error opening HEX file for output!" );
/* Prepare */
status = _first;
rec.data = new unsigned char[ 16 ]; // Use only 16 byte records.
baseAddress = start & ~0xffff; // 64K aligned address.
offset = start & 0xffff; // Offset from the aligned address.
dataPos = 0;
/* Write first base address record to HEX file */
rec.length = 2;
rec.offset = 0;
rec.type = 0x02;
rec.data[1] = 0x00;
rec.data[0] = baseAddress >> 12; // Give 4k page index.
writeRecord( f, &rec ); // Write the HEX record to file.
/* Write all bytes in used range */
do
{
/* Put data into record */
rec.data[ dataPos ] = data[ baseAddress + offset + dataPos ];
dataPos++;
/* Check if we need to write out the current data record */
if( offset + dataPos >= 0x10000 || // Reached 64k boundary?
dataPos >= 16 || // Data record full?
baseAddress + offset + dataPos > end ) // End of used range reached?
{
/* Write current data record */
rec.length = dataPos;
rec.offset = offset;
rec.type = 0x00; // Data record.
Util.progress( "#" ); // Advance progress indicator.
writeRecord( f, &rec );
offset += dataPos;
dataPos = 0;
}
/* Check if we have passed a 64k boundary */
if( offset + dataPos >= 0x10000 )
{
/* Update address pointers */
offset -= 0x10000;
baseAddress += 0x10000;
/* Write new base address record to HEX file */
rec.length = 2;
rec.offset = 0;
rec.type = 0x02;
rec.data[0] = baseAddress >> 12; // Give 4k page index.
rec.data[1] = 0x00;
writeRecord( f, &rec ); // Write the HEX record to file.
}
} while( baseAddress + offset + dataPos <= end );
/* Write EOF record */
rec.length = 0;
rec.offset = 0;
rec.type = 0x01;
writeRecord( f, &rec );
f.close();
Util.progress( "\r\n" ); // Finish progress indicator.
}
void HEXFile::setUsedRange( long _start, long _end )
{
if( _start < 0 || _end >= size || _start > _end )
throw new ErrorMsg( "Invalid range! Start must be 0 or larger, end must be "
"inside allowed memory range." );
start = _start;
end = _end;
}
void HEXFile::clearAll( long value )
{
for( long i = 0; i < size; i++ )
data[i] = (unsigned char) (value & 0xff);
}
long HEXFile::getData( long address )
{
if( address < 0 || address >= size )
throw new ErrorMsg( "Address outside legal range!" );
return data[ address ];
}
void HEXFile::setData( long address, long value )
{
if( address < 0 || address >= size )
throw new ErrorMsg( "Address outside legal range!" );
data[ address ] = (unsigned char) (value & 0xff);
}
/* end of file */
/*****************************************************************************
*
* Atmel Corporation
*
* File : HEXParser.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A simple Intel HEX file format reader/writer.
*
*
****************************************************************************/
#include "HEXParser.hpp"
/* Internal struct for managing HEX records */
struct HEXRecord // Intel HEX file record
{
unsigned char length; // Record length in number of data bytes.
unsigned long offset; // Offset address.
unsigned char type; // Record type.
unsigned char * data; // Optional data bytes.
};
void HEXFile::writeRecord( ofstream & f, HEXRecord * recp )
{
unsigned char checksum;
long recordPos; // Position inside record data field
/* Calculate checksum */
checksum = recp->length;
checksum += (unsigned char) ((recp->offset >> 8) & 0xff);
checksum += (unsigned char) (recp->offset & 0xff);
checksum += recp->type;
/* Write record header */
f.fill('0');
f << ":" << hex
<< setw(2) << (long) recp->length
<< setw(4) << (long) recp->offset
<< setw(2) << (long) recp->type;
/* Write data bytes */
for( recordPos = 0; recordPos < recp->length; recordPos++ )
{
checksum += recp->data[ recordPos ]; // Further checksum calculation
f << hex << setw(2) << (long) recp->data[ recordPos ];
}
/* Write checksum */
checksum = 0 - checksum; // Final checksum preparation
f << setw(2) << (long) checksum << endl;
/* Check for errors */
if( !f.good() )
throw new ErrorMsg( "Error writing HEX record to file!" );
}
void HEXFile::parseRecord( const string & hexLine, HEXRecord * recp )
{
unsigned char checksum;
long recordPos; // Position inside record data fields.
if( hexLine.size() < 11 ) // At least 11 characters.
throw new ErrorMsg( "Wrong HEX file format, missing fields! "
"Line from file was: (" + hexLine + ")." );
/* Check format for line */
if( hexLine[0] != ':' ) // Always start with colon.
throw new ErrorMsg( "Wrong HEX file format, does not start with colon! "
"Line from file was: (" + hexLine + ")." );
/* Parse length, offset and type */
recp->length = Util.convertHex( hexLine.substr( 1, 2 ) );
recp->offset = Util.convertHex( hexLine.substr( 3, 4 ) );
recp->type = Util.convertHex( hexLine.substr( 7, 2 ) );
/* We now know how long the record should be */
if( hexLine.size() < (11+recp->length*2) )
throw new ErrorMsg( "Wrong HEX file format, missing fields! "
"Line from file was: (" + hexLine + ")." );
/* Process checksum */
checksum = recp->length;
checksum += (unsigned char) ((recp->offset >> 8) & 0xff);
checksum += (unsigned char) (recp->offset & 0xff);
checksum += recp->type;
/* Parse data fields */
if( recp->length )
{
recp->data = new unsigned char[ recp->length ];
/* Read data from record */
for( recordPos = 0; recordPos < recp->length; recordPos++ )
{
recp->data[ recordPos ] = Util.convertHex( hexLine.substr( 9 + recordPos*2, 2 ) );
checksum += recp->data[ recordPos ];
}
}
/* Correct checksum? */
checksum += Util.convertHex( hexLine.substr( 9 + recp->length*2, 2 ) );
if( checksum != 0 )
{
throw new ErrorMsg( "Wrong checksum for HEX record! "
"Line from file was: (" + hexLine + ")." );
}
}
/* Constructor */
HEXFile::HEXFile( long buffersize, long value )
{
if( buffersize <= 0 )
throw new ErrorMsg( "Cannot have zero-size HEX buffer!" );
data = new unsigned char[ buffersize ];
if( !data )
throw new ErrorMsg( "Memory allocation failed for HEX-line-buffer!" );
size = buffersize;
clearAll( value );
}
/* Destructor */
HEXFile::~HEXFile()
{
if( data ) delete data;
}
void HEXFile::readFile( const string & _filename )
{
ifstream f;
string hexLine; // Contains one line of the HEX file.
HEXRecord rec; // Temp record.
long baseAddress; // Base address for extended addressing modes.
long dataPos; // Data position in record.
/* Attempt to open file */
f.open( _filename.c_str(), ios::in );
if( !f )
throw new ErrorMsg( "Error opening HEX file for input!" );
/* Prepare */
baseAddress = 0;
start = size;
end = 0;
/* Parse records */
f >> hexLine; // Read one line.
while( !f.eof() )
{
Util.progress( "#" ); // Advance progress indicator.
/* Process record according to type */
parseRecord( hexLine, &rec );
switch( rec.type )
{
case 0x00 : // Data record ?
/* Copy data */
if( baseAddress + rec.offset + rec.length > size )
throw new ErrorMsg( "HEX file defines data outside buffer limits! "
"Make sure file does not contain data outside device "
"memory limits. "
"Line from file was: (" + hexLine + ")." );
for( dataPos = 0; dataPos < rec.length; dataPos++ )
data[ baseAddress + rec.offset + dataPos ] = rec.data[ dataPos ];
/* Update byte usage */
if( baseAddress + rec.offset < start )
start = baseAddress + rec.offset;
if( baseAddress + rec.offset + rec.length - 1 > end )
end = baseAddress + rec.offset + rec.length - 1;
break;
case 0x02 : // Extended segment address record ?
baseAddress = (rec.data[0] << 8) | rec.data[1];
baseAddress <<= 4;
break;
case 0x03 : // Start segment address record ?
break; // Ignore it, since we have no influence on execution start address.
case 0x04 : // Extended linear address record ?
baseAddress = (rec.data[0] << 8) | rec.data[1];
baseAddress <<= 16;
break;
case 0x05 : // Start linear address record ?
break; // Ignore it, since we have no influence on exectuion start address.
case 0x01 : // End of file record ?
f.close();
Util.progress( "\r\n" ); // Finish progress indicator.
return;
default:
throw new ErrorMsg( "Unsupported HEX record format! "
"Line from file was: (" + hexLine + ")." );
}
f >> hexLine; // Read next line.
}
/* We should not end up here */
throw new ErrorMsg( "Premature end of file encountered! Make sure file "
"contains an EOF-record." );
}
void HEXFile::writeFile( const string & _filename )
{
ofstream f;
HEXRecord rec; // Temp record.
long baseAddress; // Absolute data position.
long offset; // Offset from base address.
long dataPos; // Position inside data record.
enum
{
_first,
_writing,
_passed64k
} status; // Write status, see usage below.
/* Attempt to create file */
f.open( _filename.c_str(), ios::out );
if( !f )
throw new ErrorMsg( "Error opening HEX file for output!" );
/* Prepare */
status = _first;
rec.data = new unsigned char[ 16 ]; // Use only 16 byte records.
baseAddress = start & ~0xffff; // 64K aligned address.
offset = start & 0xffff; // Offset from the aligned address.
dataPos = 0;
/* Write first base address record to HEX file */
rec.length = 2;
rec.offset = 0;
rec.type = 0x02;
rec.data[1] = 0x00;
rec.data[0] = baseAddress >> 12; // Give 4k page index.
writeRecord( f, &rec ); // Write the HEX record to file.
/* Write all bytes in used range */
do
{
/* Put data into record */
rec.data[ dataPos ] = data[ baseAddress + offset + dataPos ];
dataPos++;
/* Check if we need to write out the current data record */
if( offset + dataPos >= 0x10000 || // Reached 64k boundary?
dataPos >= 16 || // Data record full?
baseAddress + offset + dataPos > end ) // End of used range reached?
{
/* Write current data record */
rec.length = dataPos;
rec.offset = offset;
rec.type = 0x00; // Data record.
Util.progress( "#" ); // Advance progress indicator.
writeRecord( f, &rec );
offset += dataPos;
dataPos = 0;
}
/* Check if we have passed a 64k boundary */
if( offset + dataPos >= 0x10000 )
{
/* Update address pointers */
offset -= 0x10000;
baseAddress += 0x10000;
/* Write new base address record to HEX file */
rec.length = 2;
rec.offset = 0;
rec.type = 0x02;
rec.data[0] = baseAddress >> 12; // Give 4k page index.
rec.data[1] = 0x00;
writeRecord( f, &rec ); // Write the HEX record to file.
}
} while( baseAddress + offset + dataPos <= end );
/* Write EOF record */
rec.length = 0;
rec.offset = 0;
rec.type = 0x01;
writeRecord( f, &rec );
f.close();
Util.progress( "\r\n" ); // Finish progress indicator.
}
void HEXFile::setUsedRange( long _start, long _end )
{
if( _start < 0 || _end >= size || _start > _end )
throw new ErrorMsg( "Invalid range! Start must be 0 or larger, end must be "
"inside allowed memory range." );
start = _start;
end = _end;
}
void HEXFile::clearAll( long value )
{
for( long i = 0; i < size; i++ )
data[i] = (unsigned char) (value & 0xff);
}
long HEXFile::getData( long address )
{
if( address < 0 || address >= size )
throw new ErrorMsg( "Address outside legal range!" );
return data[ address ];
}
void HEXFile::setData( long address, long value )
{
if( address < 0 || address >= size )
throw new ErrorMsg( "Address outside legal range!" );
data[ address ] = (unsigned char) (value & 0xff);
}
/* end of file */
+67 -67
View File
@@ -1,67 +1,67 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : HEXParser.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A simple Intel HEX file format reader/writer.
*
*
****************************************************************************/
#ifndef HEXPARSER_HPP
#define HEXPARSER_HPP
using namespace std;
#include "ErrorMsg.hpp"
#include "Utility.hpp"
#include <iostream>
#include <fstream>
#include <iomanip>
struct HEXRecord; // Preliminary definition.
class HEXFile
{
protected:
unsigned char * data; // Holds the data bytes.
long start, end; // Used data range.
long size; // Size of databuffer.
void writeRecord( ofstream & f, HEXRecord * recp );
void parseRecord( const string & hexLine, HEXRecord * recp );
public:
/* Constructor */
HEXFile( long buffersize, long value = 0xff );
/* Destructor */
~HEXFile();
/* Methods */
void readFile( const string & _filename ); // Read data from HEX file.
void writeFile( const string & _filename ); // Write data to HEX file.
void setUsedRange( long _start, long _end ); // Sets the used range.
void clearAll( long value = 0xff ); // Set databuffer to this value.
long getRangeStart() { return start; }
long getRangeEnd() { return end; }
long getData( long address );
void setData( long address, long value );
long getSize() { return size; }
};
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : HEXParser.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A simple Intel HEX file format reader/writer.
*
*
****************************************************************************/
#ifndef HEXPARSER_HPP
#define HEXPARSER_HPP
using namespace std;
#include "ErrorMsg.hpp"
#include "Utility.hpp"
#include <iostream>
#include <fstream>
#include <iomanip>
struct HEXRecord; // Preliminary definition.
class HEXFile
{
protected:
unsigned char * data; // Holds the data bytes.
long start, end; // Used data range.
long size; // Size of databuffer.
void writeRecord( ofstream & f, HEXRecord * recp );
void parseRecord( const string & hexLine, HEXRecord * recp );
public:
/* Constructor */
HEXFile( long buffersize, long value = 0xff );
/* Destructor */
~HEXFile();
/* Methods */
void readFile( const string & _filename ); // Read data from HEX file.
void writeFile( const string & _filename ); // Write data to HEX file.
void setUsedRange( long _start, long _end ); // Sets the used range.
void clearAll( long value = 0xff ); // Set databuffer to this value.
long getRangeStart() { return start; }
long getRangeEnd() { return end; }
long getData( long address );
void setData( long address, long value );
long getSize() { return size; }
};
#endif
File diff suppressed because it is too large Load Diff
+105 -105
View File
@@ -1,105 +1,105 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : JobInfo.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class holding information on what the AVR Open-Source Programmer
* should do. The information is derived from the command-line.
*
*
****************************************************************************/
#ifndef JOBINFO_HPP
#define JOBINFO_HPP
using namespace std;
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#include "ErrorMsg.hpp"
#include "AVRProgrammer.hpp"
#include "AVRBootloader.hpp"
#include "AVRInSystemProg.hpp"
#include "AVRDevice.hpp"
#include "SerialPort.hpp"
#include "Utility.hpp"
class JobInfo
{
protected:
long convertHex( char * txt );
void help();
void doDeviceIndependent( AVRProgrammer * prog );
void doDeviceDependent( AVRProgrammer * prog, AVRDevice * avr );
bool showHelp; // Show help screen?
bool silentMode; // No text output?
bool noProgressIndicator; // Do not show progress indicators?
bool readSignature; // Output signature bytes to screen?
bool chipErase; // Erase chip before any programming operations?
bool getHWrevision; // Get hardware revision of programmer?
bool getSWrevision; // Get software revision of programmer?
bool programFlash; // Flash programming desired?
bool programEEPROM; // E2 programming desired?
bool readFlash; // Flash readout desired?
bool readEEPROM; // E2 readout desired?
bool verifyFlash; // Flash verification desired?
bool verifyEEPROM; // E2 verification desired?
bool readLockBits; // Lock bit readout desired?
bool readFuseBits; // Fuse bit readout desired?
bool readOSCCAL; // Read or use specified OSCCAL value, if -O is used?
string deviceName; // Specified device name.
string inputFileFlash; // Input file for Flash writing and verification.
string inputFileEEPROM; // Input file for E2 writing and verification.
string outputFileFlash; // Output file for Flash readout.
string outputFileEEPROM; // Output file for E2 readout.
long OSCCAL_Parameter; // Value of the -O parameter, -1 if unspecified.
long OSCCAL_FlashAddress; // Where to put OSCCAL value in flash, -1 if not.
long OSCCAL_EEPROMAddress; // Where to put OSCCAL value in E2, -1 if not.
long programLockBits; // Change lock bits to this value, -1 if not.
long verifyLockBits; // Verify lock bits against this value, -1 if not.
long programFuseBits; // Change fuse bits to this value, -1 if not.
long programExtendedFuseBits; // Same as above for extended fuse bits.
long verifyFuseBits; // Verify fuse bits against this value, -1 if not.
long verifyExtendedFuseBits; // Same as above for extended fuse bits.
long memoryFillPattern; // Fill unspecified locations, -1 if not.
long flashStartAddress; // Limit Flash operations, -1 if not.
long flashEndAddress; // ...to this address, inclusive, -1 if not.
long eepromStartAddress; // Same as above for E2.
long eepromEndAddress; // ...
long comPort; // Desired COM port to use, -1 if unspecified.
vector<string> searchpath; // Search path for XML-files.
public:
JobInfo(); // Constructor
void parseCommandline( int argc, char *argv[] );
void doJob();
};
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : JobInfo.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class holding information on what the AVR Open-Source Programmer
* should do. The information is derived from the command-line.
*
*
****************************************************************************/
#ifndef JOBINFO_HPP
#define JOBINFO_HPP
using namespace std;
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#include "ErrorMsg.hpp"
#include "AVRProgrammer.hpp"
#include "AVRBootloader.hpp"
#include "AVRInSystemProg.hpp"
#include "AVRDevice.hpp"
#include "SerialPort.hpp"
#include "Utility.hpp"
class JobInfo
{
protected:
long convertHex( char * txt );
void help();
void doDeviceIndependent( AVRProgrammer * prog );
void doDeviceDependent( AVRProgrammer * prog, AVRDevice * avr );
bool showHelp; // Show help screen?
bool silentMode; // No text output?
bool noProgressIndicator; // Do not show progress indicators?
bool readSignature; // Output signature bytes to screen?
bool chipErase; // Erase chip before any programming operations?
bool getHWrevision; // Get hardware revision of programmer?
bool getSWrevision; // Get software revision of programmer?
bool programFlash; // Flash programming desired?
bool programEEPROM; // E2 programming desired?
bool readFlash; // Flash readout desired?
bool readEEPROM; // E2 readout desired?
bool verifyFlash; // Flash verification desired?
bool verifyEEPROM; // E2 verification desired?
bool readLockBits; // Lock bit readout desired?
bool readFuseBits; // Fuse bit readout desired?
bool readOSCCAL; // Read or use specified OSCCAL value, if -O is used?
string deviceName; // Specified device name.
string inputFileFlash; // Input file for Flash writing and verification.
string inputFileEEPROM; // Input file for E2 writing and verification.
string outputFileFlash; // Output file for Flash readout.
string outputFileEEPROM; // Output file for E2 readout.
long OSCCAL_Parameter; // Value of the -O parameter, -1 if unspecified.
long OSCCAL_FlashAddress; // Where to put OSCCAL value in flash, -1 if not.
long OSCCAL_EEPROMAddress; // Where to put OSCCAL value in E2, -1 if not.
long programLockBits; // Change lock bits to this value, -1 if not.
long verifyLockBits; // Verify lock bits against this value, -1 if not.
long programFuseBits; // Change fuse bits to this value, -1 if not.
long programExtendedFuseBits; // Same as above for extended fuse bits.
long verifyFuseBits; // Verify fuse bits against this value, -1 if not.
long verifyExtendedFuseBits; // Same as above for extended fuse bits.
long memoryFillPattern; // Fill unspecified locations, -1 if not.
long flashStartAddress; // Limit Flash operations, -1 if not.
long flashEndAddress; // ...to this address, inclusive, -1 if not.
long eepromStartAddress; // Same as above for E2.
long eepromEndAddress; // ...
long comPort; // Desired COM port to use, -1 if unspecified.
vector<string> searchpath; // Search path for XML-files.
public:
JobInfo(); // Constructor
void parseCommandline( int argc, char *argv[] );
void doJob();
};
#endif
+203 -203
View File
@@ -1,203 +1,203 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : SerialPort.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing serial communication through the PC COM port.
* This class is derived from the CommChannel abstract class.
*
*
****************************************************************************/
#include "SerialPort.hpp"
/* Constructor */
SerialPort::SerialPort( long _portNumber, long _timeout )
{
if( _timeout < 0 )
throw new ErrorMsg( "Negative COM-port timeout not allowed!" );
if( _portNumber < 1 || _portNumber > 99 )
throw new ErrorMsg( "Only COM1 to COM99 is supported!" );
/* Initialize internal parameters */
portNumber = _portNumber;
timeout = _timeout;
channelOpen = false;
}
/* Destructor */
SerialPort::~SerialPort()
{
closeChannel();
}
/* Open the communication channel */
void SerialPort::openChannel()
{
/* CreateFile expects a constant char, or char from the heap */
static char comName[64] = "COM1";
COMMTIMEOUTS comTimeouts;
/* Check if channel already open */
if( channelOpen )
throw new ErrorMsg( "Channel already open! Cannot open port twice." );
/* Generate COM filename and attempt open */
if (portNumber < 10) {
comName[3] = '0' + portNumber;
} else if (portNumber < 100) {
/* For COM ports greater than 9 you have to use a special syntax
for CreateFile. The syntax also works for COM ports 1-9. */
/* http://support.microsoft.com/kb/115831 */
sprintf(comName, "\\\\.\\COM%ld", portNumber);
}
serialHandle = CreateFile( comName, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
/* Print error and return if failed opening port */
if( serialHandle == INVALID_HANDLE_VALUE )
throw new ErrorMsg( "Error opening COM port!" );
channelOpen = true;
/* Store old COM port settings */
if( !GetCommTimeouts( serialHandle, &oldComTimeouts ) )
throw new ErrorMsg( "Error reading COM port settings!" );
/* Get another copy of the COM settings, and change them */
if( !GetCommTimeouts( serialHandle, &comTimeouts ) )
throw new ErrorMsg( "Error reading COM port settings!" );
comTimeouts.ReadIntervalTimeout = MAXDWORD;
comTimeouts.ReadTotalTimeoutConstant = 0;
comTimeouts.ReadTotalTimeoutMultiplier = 0;
/* Apply new settings */
if( !SetCommTimeouts( serialHandle, &comTimeouts ) )
throw new ErrorMsg( "Error changing COM port settings!" );
}
/* Close the communication channel */
void SerialPort::closeChannel()
{
if( !channelOpen )
return;
/* Restore old COM parameters */
if( !SetCommTimeouts( serialHandle, &oldComTimeouts ) )
throw new ErrorMsg( "Error changing COM port settings!" );
/* Release port */
if( serialHandle != INVALID_HANDLE_VALUE )
if( !CloseHandle( serialHandle ) )
throw new ErrorMsg( "Error closing COM port!" );
channelOpen = false;
}
/* Transmit a single byte */
void SerialPort::sendByte( long data )
{
DWORD written;
/* Check if channel is open */
if( !channelOpen )
throw new ErrorMsg( "Channel not open! Cannot send to unopened channel." );
/* Attempt writing */
if( !WriteFile( serialHandle, &data, 1, &written, NULL ) )
throw new ErrorMsg( "Error writing byte to COM port!" );
}
/* Receive a single byte */
long SerialPort::getByte()
{
time_t startTime;
startTime = time( NULL ); // Read current time in seconds
DWORD readnum;
unsigned char data;
/* Check if channel is open */
if( !channelOpen )
throw new ErrorMsg( "Channel not open! Cannot read from unopened channel." );
/* Attempt receiving byte until timeout limit exceeded */
do
{
/* Read byte from port */
if( !ReadFile( serialHandle, &data, 1, &readnum, NULL ) )
{
throw new ErrorMsg( "Error reading byte from COM port!" );
}
if( readnum == 1 )
return ((long) data) & 0xff;
} while( time(NULL) - startTime < timeout );
/* Timeout */
throw new ErrorMsg( "Timeout during COM-port read operation!" );
}
/* Flush the transmit buffer */
void SerialPort::flushTX()
{
/* Check if channel is open */
if( !channelOpen )
throw new ErrorMsg( "Channel not open! Cannot flush an unopened channel." );
/* Purge data from write buffer */
if( !PurgeComm( serialHandle, PURGE_TXCLEAR ) )
throw new ErrorMsg( "Error flushing COM port TX buffer!" );
}
/* Flush the receive buffer */
void SerialPort::flushRX()
{
/* Check if channel is open */
if( !channelOpen )
throw new ErrorMsg( "Channel not open! Cannot flush an unopened channel." );
/* Purge data from write buffer */
if( !PurgeComm( serialHandle, PURGE_RXCLEAR ) )
throw new ErrorMsg( "Error flushing COM port RX buffer!" );
}
/* Transmit multiple bytes */
void SerialPort::sendMultiple( unsigned char * data, long bufsize )
{
DWORD written;
/* Check if channel is open */
if( !channelOpen )
throw new ErrorMsg( "Channel not open! Cannot write to unopened channel." );
/* Attempt writing */
if( !WriteFile( serialHandle, data, bufsize, &written, NULL ) )
throw new ErrorMsg( "Error writing multiple bytes to COM port!" );
}
/* end of file */
/*****************************************************************************
*
* Atmel Corporation
*
* File : SerialPort.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing serial communication through the PC COM port.
* This class is derived from the CommChannel abstract class.
*
*
****************************************************************************/
#include "SerialPort.hpp"
/* Constructor */
SerialPort::SerialPort( long _portNumber, long _timeout )
{
if( _timeout < 0 )
throw new ErrorMsg( "Negative COM-port timeout not allowed!" );
if( _portNumber < 1 || _portNumber > 99 )
throw new ErrorMsg( "Only COM1 to COM99 is supported!" );
/* Initialize internal parameters */
portNumber = _portNumber;
timeout = _timeout;
channelOpen = false;
}
/* Destructor */
SerialPort::~SerialPort()
{
closeChannel();
}
/* Open the communication channel */
void SerialPort::openChannel()
{
/* CreateFile expects a constant char, or char from the heap */
static char comName[64] = "COM1";
COMMTIMEOUTS comTimeouts;
/* Check if channel already open */
if( channelOpen )
throw new ErrorMsg( "Channel already open! Cannot open port twice." );
/* Generate COM filename and attempt open */
if (portNumber < 10) {
comName[3] = '0' + portNumber;
} else if (portNumber < 100) {
/* For COM ports greater than 9 you have to use a special syntax
for CreateFile. The syntax also works for COM ports 1-9. */
/* http://support.microsoft.com/kb/115831 */
sprintf(comName, "\\\\.\\COM%ld", portNumber);
}
serialHandle = CreateFile( comName, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
/* Print error and return if failed opening port */
if( serialHandle == INVALID_HANDLE_VALUE )
throw new ErrorMsg( "Error opening COM port!" );
channelOpen = true;
/* Store old COM port settings */
if( !GetCommTimeouts( serialHandle, &oldComTimeouts ) )
throw new ErrorMsg( "Error reading COM port settings!" );
/* Get another copy of the COM settings, and change them */
if( !GetCommTimeouts( serialHandle, &comTimeouts ) )
throw new ErrorMsg( "Error reading COM port settings!" );
comTimeouts.ReadIntervalTimeout = MAXDWORD;
comTimeouts.ReadTotalTimeoutConstant = 0;
comTimeouts.ReadTotalTimeoutMultiplier = 0;
/* Apply new settings */
if( !SetCommTimeouts( serialHandle, &comTimeouts ) )
throw new ErrorMsg( "Error changing COM port settings!" );
}
/* Close the communication channel */
void SerialPort::closeChannel()
{
if( !channelOpen )
return;
/* Restore old COM parameters */
if( !SetCommTimeouts( serialHandle, &oldComTimeouts ) )
throw new ErrorMsg( "Error changing COM port settings!" );
/* Release port */
if( serialHandle != INVALID_HANDLE_VALUE )
if( !CloseHandle( serialHandle ) )
throw new ErrorMsg( "Error closing COM port!" );
channelOpen = false;
}
/* Transmit a single byte */
void SerialPort::sendByte( long data )
{
DWORD written;
/* Check if channel is open */
if( !channelOpen )
throw new ErrorMsg( "Channel not open! Cannot send to unopened channel." );
/* Attempt writing */
if( !WriteFile( serialHandle, &data, 1, &written, NULL ) )
throw new ErrorMsg( "Error writing byte to COM port!" );
}
/* Receive a single byte */
long SerialPort::getByte()
{
time_t startTime;
startTime = time( NULL ); // Read current time in seconds
DWORD readnum;
unsigned char data;
/* Check if channel is open */
if( !channelOpen )
throw new ErrorMsg( "Channel not open! Cannot read from unopened channel." );
/* Attempt receiving byte until timeout limit exceeded */
do
{
/* Read byte from port */
if( !ReadFile( serialHandle, &data, 1, &readnum, NULL ) )
{
throw new ErrorMsg( "Error reading byte from COM port!" );
}
if( readnum == 1 )
return ((long) data) & 0xff;
} while( time(NULL) - startTime < timeout );
/* Timeout */
throw new ErrorMsg( "Timeout during COM-port read operation!" );
}
/* Flush the transmit buffer */
void SerialPort::flushTX()
{
/* Check if channel is open */
if( !channelOpen )
throw new ErrorMsg( "Channel not open! Cannot flush an unopened channel." );
/* Purge data from write buffer */
if( !PurgeComm( serialHandle, PURGE_TXCLEAR ) )
throw new ErrorMsg( "Error flushing COM port TX buffer!" );
}
/* Flush the receive buffer */
void SerialPort::flushRX()
{
/* Check if channel is open */
if( !channelOpen )
throw new ErrorMsg( "Channel not open! Cannot flush an unopened channel." );
/* Purge data from write buffer */
if( !PurgeComm( serialHandle, PURGE_RXCLEAR ) )
throw new ErrorMsg( "Error flushing COM port RX buffer!" );
}
/* Transmit multiple bytes */
void SerialPort::sendMultiple( unsigned char * data, long bufsize )
{
DWORD written;
/* Check if channel is open */
if( !channelOpen )
throw new ErrorMsg( "Channel not open! Cannot write to unopened channel." );
/* Attempt writing */
if( !WriteFile( serialHandle, data, bufsize, &written, NULL ) )
throw new ErrorMsg( "Error writing multiple bytes to COM port!" );
}
/* end of file */
+75 -75
View File
@@ -1,75 +1,75 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : SerialPort.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing serial communication through the PC COM port.
* This class is derived from the CommChannel abstract class.
*
*
****************************************************************************/
#ifndef SERIALPORT_HPP
#define SERIALPORT_HPP
using namespace std;
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <time.h>
#include <iostream>
#include "CommChannel.hpp"
#include "ErrorMsg.hpp"
class SerialPort : public CommChannel
{
protected:
long portNumber; // COMx port number.
long timeout; // Desired timeout limit when receiving data.
HANDLE serialHandle; // Win32 device handle for the com port.
COMMTIMEOUTS oldComTimeouts; // Store old serial port timeout parameters.
bool channelOpen; // Is channel open?
public:
// Constructor taking port number, baudrate and
// timeout limit as parameters.
SerialPort( long portnumber, long timeout );
// Destructor.
~SerialPort();
// Open the communication channel.
virtual void openChannel();
// Close the communication channel.
virtual void closeChannel();
// Transmit a single byte.
virtual void sendByte( long data );
// Receive a single byte.
virtual long getByte();
// Flush the transmit buffer.
virtual void flushTX();
// Flush the receive buffer.
virtual void flushRX();
// Transmit multiple bytes.
virtual void sendMultiple( unsigned char * data, long bufsize );
};
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : SerialPort.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class providing serial communication through the PC COM port.
* This class is derived from the CommChannel abstract class.
*
*
****************************************************************************/
#ifndef SERIALPORT_HPP
#define SERIALPORT_HPP
using namespace std;
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <time.h>
#include <iostream>
#include "CommChannel.hpp"
#include "ErrorMsg.hpp"
class SerialPort : public CommChannel
{
protected:
long portNumber; // COMx port number.
long timeout; // Desired timeout limit when receiving data.
HANDLE serialHandle; // Win32 device handle for the com port.
COMMTIMEOUTS oldComTimeouts; // Store old serial port timeout parameters.
bool channelOpen; // Is channel open?
public:
// Constructor taking port number, baudrate and
// timeout limit as parameters.
SerialPort( long portnumber, long timeout );
// Destructor.
~SerialPort();
// Open the communication channel.
virtual void openChannel();
// Close the communication channel.
virtual void closeChannel();
// Transmit a single byte.
virtual void sendByte( long data );
// Receive a single byte.
virtual long getByte();
// Flush the transmit buffer.
virtual void flushTX();
// Flush the receive buffer.
virtual void flushRX();
// Transmit multiple bytes.
virtual void sendMultiple( unsigned char * data, long bufsize );
};
#endif
+181 -181
View File
@@ -1,181 +1,181 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : Utility.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class holding misc. utility methods used in AVROSP.
*
*
****************************************************************************/
#include "Utility.hpp"
#include <iostream>
#include <fstream>
#include <stdlib.h>
/* Global object */
Utility Util;
/* Constructor */
Utility::Utility() :
noLog( false ),
noProgress( false )
{
/* No code here */
}
/* Destructor */
Utility::~Utility()
{
/* No code here */
}
void Utility::log( const string & txt )
{
if( !noLog )
cout << txt;
}
void Utility::progress( const string & txt )
{
if( !noProgress )
cout << txt;
}
long Utility::convertHex( const string & txt )
{
long result = 0;
long digit;
long i;
if( txt.size() == 0 )
throw new ErrorMsg( "Cannot convert zero-length hex-string to number!" );
if( txt.size() > 8 )
throw new ErrorMsg( "Hex conversion overflow! Too many hex digits in string." );
for( i = 0; i < txt.size(); i++ )
{
/* Convert hex digit */
if( txt[i] >= '0' && txt[i] <= '9' )
digit = txt[i] - '0';
else if( txt[i] >= 'a' && txt[i] <= 'f' )
digit = txt[i] - 'a' + 10;
else if( txt[i] >= 'A' && txt[i] <= 'F' )
digit = txt[i] - 'A' + 10;
else
throw new ErrorMsg( "Invalid hex digit found!" );
/* Add digit as least significant 4 bits of result */
result = (result << 4) | digit;
}
return result;
}
string Utility::convertLong( long num, long radix )
{
char buf[18];
string res;
itoa( num, buf, radix );
res = buf;
return res;
}
void Utility::parsePath( vector<string> & list )
{
/* Get environment variable and parse if it exists */
char * pathptr = getenv( "PATH" );
if( pathptr != NULL && pathptr[0] != 0 ) {
string path = pathptr;
int pos;
while( (pos = path.find_first_of( ";" )) < path.length() ) {
list.push_back( path.substr( 0, pos ) );
path.erase( 0, pos+1 );
}
list.push_back( path ); // Last directory.
}
}
bool Utility::fileExists( string filename )
{
/* Attempt to open file */
ifstream f;
f.open( filename.c_str(), ios::in );
if( !f ) {
return false;
} else {
f.close();
return true;
}
}
void Utility::saveString( string txt, string filename )
{
ofstream f;
f.open( filename.c_str(), ios::out );
if( !f )
throw new ErrorMsg( "Error opening HEX file for output!" );
f << txt;
f.close();
}
#ifndef NOREGISTRY
string Utility::getRegistryValue( const string & path, const string & value )
{
/* Code modified from MSDN */
const long BUFSIZE=1000;
string result;
HKEY hKey;
char szAVRPath[BUFSIZE];
DWORD dwBufLen=BUFSIZE;
LONG lRet;
/* Open key */
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE, path.c_str(), 0, KEY_QUERY_VALUE, &hKey );
if( lRet != ERROR_SUCCESS )
throw new ErrorMsg( "Error when opening registry key: (" + path + ")!" );
/* Get value */
lRet = RegQueryValueEx( hKey, value.c_str(), NULL, NULL, (LPBYTE) szAVRPath, &dwBufLen);
if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) )
throw new ErrorMsg( "Error when reading key value: (" + value + ")!" );
/* Clean up and return result */
RegCloseKey( hKey );
result = szAVRPath;
return result;
}
#endif
/* end of file */
/*****************************************************************************
*
* Atmel Corporation
*
* File : Utility.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class holding misc. utility methods used in AVROSP.
*
*
****************************************************************************/
#include "Utility.hpp"
#include <iostream>
#include <fstream>
#include <stdlib.h>
/* Global object */
Utility Util;
/* Constructor */
Utility::Utility() :
noLog( false ),
noProgress( false )
{
/* No code here */
}
/* Destructor */
Utility::~Utility()
{
/* No code here */
}
void Utility::log( const string & txt )
{
if( !noLog )
cout << txt;
}
void Utility::progress( const string & txt )
{
if( !noProgress )
cout << txt;
}
long Utility::convertHex( const string & txt )
{
long result = 0;
long digit;
long i;
if( txt.size() == 0 )
throw new ErrorMsg( "Cannot convert zero-length hex-string to number!" );
if( txt.size() > 8 )
throw new ErrorMsg( "Hex conversion overflow! Too many hex digits in string." );
for( i = 0; i < txt.size(); i++ )
{
/* Convert hex digit */
if( txt[i] >= '0' && txt[i] <= '9' )
digit = txt[i] - '0';
else if( txt[i] >= 'a' && txt[i] <= 'f' )
digit = txt[i] - 'a' + 10;
else if( txt[i] >= 'A' && txt[i] <= 'F' )
digit = txt[i] - 'A' + 10;
else
throw new ErrorMsg( "Invalid hex digit found!" );
/* Add digit as least significant 4 bits of result */
result = (result << 4) | digit;
}
return result;
}
string Utility::convertLong( long num, long radix )
{
char buf[18];
string res;
itoa( num, buf, radix );
res = buf;
return res;
}
void Utility::parsePath( vector<string> & list )
{
/* Get environment variable and parse if it exists */
char * pathptr = getenv( "PATH" );
if( pathptr != NULL && pathptr[0] != 0 ) {
string path = pathptr;
int pos;
while( (pos = path.find_first_of( ";" )) < path.length() ) {
list.push_back( path.substr( 0, pos ) );
path.erase( 0, pos+1 );
}
list.push_back( path ); // Last directory.
}
}
bool Utility::fileExists( string filename )
{
/* Attempt to open file */
ifstream f;
f.open( filename.c_str(), ios::in );
if( !f ) {
return false;
} else {
f.close();
return true;
}
}
void Utility::saveString( string txt, string filename )
{
ofstream f;
f.open( filename.c_str(), ios::out );
if( !f )
throw new ErrorMsg( "Error opening HEX file for output!" );
f << txt;
f.close();
}
#ifndef NOREGISTRY
string Utility::getRegistryValue( const string & path, const string & value )
{
/* Code modified from MSDN */
const long BUFSIZE=1000;
string result;
HKEY hKey;
char szAVRPath[BUFSIZE];
DWORD dwBufLen=BUFSIZE;
LONG lRet;
/* Open key */
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE, path.c_str(), 0, KEY_QUERY_VALUE, &hKey );
if( lRet != ERROR_SUCCESS )
throw new ErrorMsg( "Error when opening registry key: (" + path + ")!" );
/* Get value */
lRet = RegQueryValueEx( hKey, value.c_str(), NULL, NULL, (LPBYTE) szAVRPath, &dwBufLen);
if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) )
throw new ErrorMsg( "Error when reading key value: (" + value + ")!" );
/* Clean up and return result */
RegCloseKey( hKey );
result = szAVRPath;
return result;
}
#endif
/* end of file */
+70 -70
View File
@@ -1,70 +1,70 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : Utility.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class holding misc. utility methods used in AVROSP.
*
*
****************************************************************************/
#ifndef UTILITY_HPP
#define UTILITY_HPP
using namespace std;
#ifndef NOREGISTRY
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <vector>
#include <string>
#include "ErrorMsg.hpp"
class Utility
{
protected:
bool noLog;
bool noProgress;
public:
/* Constructor */
Utility();
/* Destructor */
~Utility();
/* Methods */
void muteLog() { noLog = true; }
void muteProgress() { noProgress = true; }
void log( const string & txt );
void progress( const string & txt );
long convertHex( const string & txt );
string convertLong( long num, long radix = 10 );
void parsePath( vector<string> & list );
bool fileExists( string filename );
void saveString( string txt, string filename );
#ifndef NOREGISTRY
string getRegistryValue( const string & path, const string & value );
#endif
};
extern Utility Util;
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : Utility.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A class holding misc. utility methods used in AVROSP.
*
*
****************************************************************************/
#ifndef UTILITY_HPP
#define UTILITY_HPP
using namespace std;
#ifndef NOREGISTRY
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <vector>
#include <string>
#include "ErrorMsg.hpp"
class Utility
{
protected:
bool noLog;
bool noProgress;
public:
/* Constructor */
Utility();
/* Destructor */
~Utility();
/* Methods */
void muteLog() { noLog = true; }
void muteProgress() { noProgress = true; }
void log( const string & txt );
void progress( const string & txt );
long convertHex( const string & txt );
string convertLong( long num, long radix = 10 );
void parsePath( vector<string> & list );
bool fileExists( string filename );
void saveString( string txt, string filename );
#ifndef NOREGISTRY
string getRegistryValue( const string & path, const string & value );
#endif
};
extern Utility Util;
#endif
File diff suppressed because it is too large Load Diff
+65 -65
View File
@@ -1,65 +1,65 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : XMLParser.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 3419 $
* Date : $Date: 2008-02-22 09:56:34 +0100 (fr, 22 feb 2008) $
* Updated by : $Author: khole $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A simple XML DOM-like parser. It builds a complete tree from
* the XML file. IT supports <section/> tags, but not tag attributes.
*
*
****************************************************************************/
#ifndef XMLPARSER_HPP
#define XMLPARSER_HPP
using namespace std;
#include "ErrorMsg.hpp"
#include "Utility.hpp"
#include <iostream>
#include <fstream>
#include <list>
class XMLAbstractNode; // Preliminary definitions.
class XMLTree;
class XMLNode;
/* Main XML file class. Contains search methods and entire XML tree */
class XMLFile
{
protected:
XMLTree * root; // The root node, either a subtree or an ordinary node.
void XMLFile::removeStartXML( string & txt ); // Remove the start xml tag.
void removeComments( string & txt ); // Remove comment tags.
void removeAttributes( string & txt ); // Remove attributes from tags.
void readFile( const string & _filename ); // Read XML file.
void parseFragment( string & fragment, XMLTree * parent );
public:
/* Constructors */
XMLFile( const string & _filename );
/* Destructor */
~XMLFile();
/* Methods */
bool exists( const string & path ); // Checks if node exists.
const string & getValue( const string & path ); // Get node value.
void print();
};
#endif
/*****************************************************************************
*
* Atmel Corporation
*
* File : XMLParser.hpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 3419 $
* Date : $Date: 2008-02-22 09:56:34 +0100 (fr, 22 feb 2008) $
* Updated by : $Author: khole $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : A simple XML DOM-like parser. It builds a complete tree from
* the XML file. IT supports <section/> tags, but not tag attributes.
*
*
****************************************************************************/
#ifndef XMLPARSER_HPP
#define XMLPARSER_HPP
using namespace std;
#include "ErrorMsg.hpp"
#include "Utility.hpp"
#include <iostream>
#include <fstream>
#include <list>
class XMLAbstractNode; // Preliminary definitions.
class XMLTree;
class XMLNode;
/* Main XML file class. Contains search methods and entire XML tree */
class XMLFile
{
protected:
XMLTree * root; // The root node, either a subtree or an ordinary node.
void XMLFile::removeStartXML( string & txt ); // Remove the start xml tag.
void removeComments( string & txt ); // Remove comment tags.
void removeAttributes( string & txt ); // Remove attributes from tags.
void readFile( const string & _filename ); // Read XML file.
void parseFragment( string & fragment, XMLTree * parent );
public:
/* Constructors */
XMLFile( const string & _filename );
/* Destructor */
~XMLFile();
/* Methods */
bool exists( const string & path ); // Checks if node exists.
const string & getValue( const string & path ); // Get node value.
void print();
};
#endif
+47 -47
View File
@@ -1,47 +1,47 @@
/*****************************************************************************
*
* Atmel Corporation
*
* File : main.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : AVROSP main entry function.
*
*
****************************************************************************/
#include "JobInfo.hpp"
#include <vector>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
JobInfo j;
try
{
j.parseCommandline( argc, argv );
j.doJob();
}
catch( ErrorMsg * e )
{
cout << endl << "An error occurred:" << endl;
cout << " [" << e->What() << "]" << endl;
delete e;
}
return 0;
}
/*****************************************************************************
*
* Atmel Corporation
*
* File : main.cpp
* Compiler : Dev-C++ 4.9.8.0 - http://bloodshed.net/dev/
* Revision : $Revision: 1163 $
* Date : $Date: 2006-08-02 15:38:16 +0200 (on, 02 aug 2006) $
* Updated by : $Author: ohlia $
*
* Support mail : avr@atmel.com
*
* Target platform : Win32
*
* AppNote : AVR911 - AVR Open-source Programmer
*
* Description : AVROSP main entry function.
*
*
****************************************************************************/
#include "JobInfo.hpp"
#include <vector>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
JobInfo j;
try
{
j.parseCommandline( argc, argv );
j.doJob();
}
catch( ErrorMsg * e )
{
cout << endl << "An error occurred:" << endl;
cout << " [" << e->What() << "]" << endl;
delete e;
}
return 0;
}
File diff suppressed because one or more lines are too long
+20 -20
View File
@@ -1,20 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Atmel Studio Solution File, Format Version 11.00
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "BACnet Development Kit", "bacnet.cproj", "{1CEFD571-4B50-48FD-B75E-0E968EBBD698}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
Release|AVR = Release|AVR
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1CEFD571-4B50-48FD-B75E-0E968EBBD698}.Debug|AVR.ActiveCfg = Debug|AVR
{1CEFD571-4B50-48FD-B75E-0E968EBBD698}.Debug|AVR.Build.0 = Debug|AVR
{1CEFD571-4B50-48FD-B75E-0E968EBBD698}.Release|AVR.ActiveCfg = Release|AVR
{1CEFD571-4B50-48FD-B75E-0E968EBBD698}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 11.00
# Atmel Studio Solution File, Format Version 11.00
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "BACnet Development Kit", "bacnet.cproj", "{1CEFD571-4B50-48FD-B75E-0E968EBBD698}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AVR = Debug|AVR
Release|AVR = Release|AVR
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1CEFD571-4B50-48FD-B75E-0E968EBBD698}.Debug|AVR.ActiveCfg = Debug|AVR
{1CEFD571-4B50-48FD-B75E-0E968EBBD698}.Debug|AVR.Build.0 = Debug|AVR
{1CEFD571-4B50-48FD-B75E-0E968EBBD698}.Release|AVR.ActiveCfg = Release|AVR
{1CEFD571-4B50-48FD-B75E-0E968EBBD698}.Release|AVR.Build.0 = Release|AVR
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+17 -17
View File
@@ -26,7 +26,7 @@
#include <stdbool.h>
/* hardware layer includes */
#include "hardware.h"
#include "timer.h"
#include "bacnet/basic/sys/mstimer.h"
#include "seeprom.h"
#include "nvdata.h"
#include "rs485.h"
@@ -34,25 +34,25 @@
#include "adc.h"
#include "led.h"
/* BACnet Stack includes */
#include "datalink.h"
#include "npdu.h"
#include "handlers.h"
#include "client.h"
#include "txbuf.h"
#include "dcc.h"
#include "iam.h"
#include "device.h"
#include "ai.h"
#include "av.h"
#include "bi.h"
#include "bo.h"
#include "bacnet/datalink/datalink.h"
#include "bacnet/npdu.h"
#include "bacnet/basic/services.h"
#include "bacnet/basic/services.h"
#include "bacnet/basic/tsm/tsm.h"
#include "bacnet/dcc.h"
#include "bacnet/iam.h"
#include "bacnet/basic/object/device.h"
#include "bacnet/basic/object/ai.h"
#include "bacnet/basic/object/av.h"
#include "bacnet/basic/object/bi.h"
#include "bacnet/basic/object/bo.h"
/* me */
#include "bacnet.h"
/* MAC Address of MS/TP */
static uint8_t MSTP_MAC_Address;
/* timer for device communications control */
static struct itimer DCC_Timer;
static struct mstimer DCC_Timer;
#define DCC_CYCLE_SECONDS 1
static bool seeprom_version_test(
@@ -140,7 +140,7 @@ void bacnet_init(
apdu_set_confirmed_handler(SERVICE_CONFIRMED_DEVICE_COMMUNICATION_CONTROL,
handler_device_communication_control);
/* start the cyclic 1 second timer for DCC */
timer_interval_start_seconds(&DCC_Timer, DCC_CYCLE_SECONDS);
mstimer_set(&DCC_Timer, DCC_CYCLE_SECONDS*1000);
/* Hello World! */
Send_I_Am(&Handler_Transmit_Buffer[0]);
}
@@ -208,8 +208,8 @@ void bacnet_task(
}
}
/* handle the communication timer */
if (timer_interval_expired(&DCC_Timer)) {
timer_interval_reset(&DCC_Timer);
if (mstimer_expired(&DCC_Timer)) {
mstimer_reset(&DCC_Timer);
dcc_timer_seconds(DCC_CYCLE_SECONDS);
}
/* handle the messaging */
+397 -354
View File
@@ -1,355 +1,398 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>6.1</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
<ProjectGuid>{1cefd571-4b50-48fd-b75e-0e968ebbd698}</ProjectGuid>
<avrdevice>ATmega644P</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>BACnet Development Kit</AssemblyName>
<Name>BACnet Development Kit</Name>
<RootNamespace>BACnet Development Kit</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<OverrideVtorValue />
<eraseonlaunchrule>0</eraseonlaunchrule>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress>0x20000000</RamSnippetAddress>
<CacheFlash>true</CacheFlash>
<UncachedRange />
<BootSegment>2</BootSegment>
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.8.1" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols><ListValues>
<Value>BACDL_MSTP</Value>
<Value>MAX_APDU=128</Value>
<Value>BIG_ENDIAN=0</Value>
<Value>MAX_TSM_TRANSACTIONS=0</Value>
<Value>MSTP_PDU_PACKET_COUNT=2</Value>
<Value>MAX_CHARACTER_STRING_BYTES=64</Value>
<Value>MAX_OCTET_STRING_BYTES=64</Value>
<Value>NDEBUG</Value>
</ListValues></avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths><ListValues>
<Value>..</Value>
<Value>../../../demo/object</Value>
<Value>../../../include</Value>
<Value>../../../ports/bdk-atxx4-mstp</Value>
</ListValues></avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries><ListValues><Value>libm</Value></ListValues></avrgcc.linker.libraries.Libraries>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
</AvrGcc>
</ToolchainSettings>
<UsesExternalMakeFile>False</UsesExternalMakeFile>
<BuildTarget>all</BuildTarget>
<CleanTarget>clean</CleanTarget>
<ExternalMakeFilePath>D:\code\bacnet-stack\ports\bdk-atxx4-mstp\Makefile</ExternalMakeFilePath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols><ListValues>
<Value>BACDL_MSTP</Value>
<Value>MAX_APDU=128</Value>
<Value>BIG_ENDIAN=0</Value>
<Value>MAX_TSM_TRANSACTIONS=0</Value>
<Value>MSTP_PDU_PACKET_COUNT=2</Value>
<Value>MAX_CHARACTER_STRING_BYTES=64</Value>
<Value>MAX_OCTET_STRING_BYTES=64</Value>
<Value>DEBUG</Value>
</ListValues></avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths><ListValues><Value>..</Value><Value>../../../demo/object</Value><Value>../../../include</Value></ListValues></avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries><ListValues><Value>libm</Value></ListValues></avrgcc.linker.libraries.Libraries>
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</ToolchainSettings>
<UsesExternalMakeFile>False</UsesExternalMakeFile>
<BuildTarget>all</BuildTarget>
<CleanTarget>clean</CleanTarget>
<ExternalMakeFilePath>D:\code\bacnet-stack\ports\bdk-atxx4-mstp\Makefile</ExternalMakeFilePath>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\demo\handler\h_dcc.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_dcc.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\h_npdu.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_npdu.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\h_rd.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_rd.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\h_rp.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_rp.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\h_rpm.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_rpm.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\h_whohas.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_whohas.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\h_whois.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_whois.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\h_wp.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_wp.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\noserv.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\noserv.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\s_iam.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\s_iam.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\s_ihave.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\s_ihave.c</Link>
</Compile>
<Compile Include="..\..\demo\handler\txbuf.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\txbuf.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\adc.c">
<SubType>compile</SubType>
<Link>adc.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\ai.c">
<SubType>compile</SubType>
<Link>ai.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\av.c">
<SubType>compile</SubType>
<Link>av.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\bacnet.c">
<SubType>compile</SubType>
<Link>bacnet.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\bi.c">
<SubType>compile</SubType>
<Link>bi.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\bname.c">
<SubType>compile</SubType>
<Link>bname.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\bo.c">
<SubType>compile</SubType>
<Link>bo.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\device.c">
<SubType>compile</SubType>
<Link>device.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\dlmstp.c">
<SubType>compile</SubType>
<Link>dlmstp.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\eeprom.c">
<SubType>compile</SubType>
<Link>eeprom.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\fuses.c">
<SubType>compile</SubType>
<Link>fuses.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\init.c">
<SubType>compile</SubType>
<Link>init.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\input.c">
<SubType>compile</SubType>
<Link>input.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\led.c">
<SubType>compile</SubType>
<Link>led.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\main.c">
<SubType>compile</SubType>
<Link>main.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\rs485.c">
<SubType>compile</SubType>
<Link>rs485.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\seeprom.c">
<SubType>compile</SubType>
<Link>seeprom.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\serial.c">
<SubType>compile</SubType>
<Link>serial.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\stack.c">
<SubType>compile</SubType>
<Link>stack.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\test.c">
<SubType>compile</SubType>
<Link>test.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\timer.c">
<SubType>compile</SubType>
<Link>timer.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\timer2.c">
<SubType>compile</SubType>
<Link>timer2.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\watchdog.c">
<SubType>compile</SubType>
<Link>watchdog.c</Link>
</Compile>
<Compile Include="..\..\src\abort.c">
<SubType>compile</SubType>
<Link>BACnet Core\abort.c</Link>
</Compile>
<Compile Include="..\..\src\apdu.c">
<SubType>compile</SubType>
<Link>BACnet Core\apdu.c</Link>
</Compile>
<Compile Include="..\..\src\bacaddr.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacaddr.c</Link>
</Compile>
<Compile Include="..\..\src\bacapp.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacapp.c</Link>
</Compile>
<Compile Include="..\..\src\bacdcode.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacdcode.c</Link>
</Compile>
<Compile Include="..\..\src\bacerror.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacerror.c</Link>
</Compile>
<Compile Include="..\..\src\bacint.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacint.c</Link>
</Compile>
<Compile Include="..\..\src\bacreal.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacreal.c</Link>
</Compile>
<Compile Include="..\..\src\bacstr.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacstr.c</Link>
</Compile>
<Compile Include="..\..\src\crc.c">
<SubType>compile</SubType>
<Link>BACnet Core\crc.c</Link>
</Compile>
<Compile Include="..\..\src\dcc.c">
<SubType>compile</SubType>
<Link>BACnet Core\dcc.c</Link>
</Compile>
<Compile Include="..\..\src\fifo.c">
<SubType>compile</SubType>
<Link>BACnet Core\fifo.c</Link>
</Compile>
<Compile Include="..\..\src\iam.c">
<SubType>compile</SubType>
<Link>BACnet Core\iam.c</Link>
</Compile>
<Compile Include="..\..\src\ihave.c">
<SubType>compile</SubType>
<Link>BACnet Core\ihave.c</Link>
</Compile>
<Compile Include="..\..\src\memcopy.c">
<SubType>compile</SubType>
<Link>BACnet Core\memcopy.c</Link>
</Compile>
<Compile Include="..\..\src\npdu.c">
<SubType>compile</SubType>
<Link>BACnet Core\npdu.c</Link>
</Compile>
<Compile Include="..\..\src\rd.c">
<SubType>compile</SubType>
<Link>BACnet Core\rd.c</Link>
</Compile>
<Compile Include="..\..\src\reject.c">
<SubType>compile</SubType>
<Link>BACnet Core\reject.c</Link>
</Compile>
<Compile Include="..\..\src\ringbuf.c">
<SubType>compile</SubType>
<Link>BACnet Core\ringbuf.c</Link>
</Compile>
<Compile Include="..\..\src\rp.c">
<SubType>compile</SubType>
<Link>BACnet Core\rp.c</Link>
</Compile>
<Compile Include="..\..\src\rpm.c">
<SubType>compile</SubType>
<Link>BACnet Core\rpm.c</Link>
</Compile>
<Compile Include="..\..\src\whohas.c">
<SubType>compile</SubType>
<Link>BACnet Core\whohas.c</Link>
</Compile>
<Compile Include="..\..\src\whois.c">
<SubType>compile</SubType>
<Link>BACnet Core\whois.c</Link>
</Compile>
<Compile Include="..\..\src\wp.c">
<SubType>compile</SubType>
<Link>BACnet Core\wp.c</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="BACnet Handlers" />
<Folder Include="BACnet Core" />
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>7.0</ProjectVersion>
<ToolchainName>com.Atmel.AVRGCC8.C</ToolchainName>
<ProjectGuid>{1cefd571-4b50-48fd-b75e-0e968ebbd698}</ProjectGuid>
<avrdevice>ATmega644P</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>BACnet Development Kit</AssemblyName>
<Name>BACnet Development Kit</Name>
<RootNamespace>BACnet Development Kit</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<OverrideVtorValue />
<eraseonlaunchrule>0</eraseonlaunchrule>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress>0x20000000</RamSnippetAddress>
<CacheFlash>true</CacheFlash>
<UncachedRange />
<BootSegment>2</BootSegment>
<AsfFrameworkConfig>
<framework-data>
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.39.0" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
<preserveEEPROM>true</preserveEEPROM>
<ResetRule>0</ResetRule>
<EraseKey />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega644p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\gcc\dev\atmega644p"</avrgcc.common.Device>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>BACDL_MSTP</Value>
<Value>MAX_APDU=128</Value>
<Value>BIG_ENDIAN=0</Value>
<Value>MAX_TSM_TRANSACTIONS=0</Value>
<Value>MSTP_PDU_PACKET_COUNT=2</Value>
<Value>MAX_CHARACTER_STRING_BYTES=64</Value>
<Value>MAX_OCTET_STRING_BYTES=64</Value>
<Value>NDEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>..</Value>
<Value>../../../src</Value>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
<Value>../../../ports/bdk-atxx4-mstp</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize for size (-Os)</avrgcc.compiler.optimization.level>
</AvrGcc>
</ToolchainSettings>
<UsesExternalMakeFile>False</UsesExternalMakeFile>
<BuildTarget>all</BuildTarget>
<CleanTarget>clean</CleanTarget>
<ExternalMakeFilePath>D:\code\bacnet-stack\ports\bdk-atxx4-mstp\Makefile</ExternalMakeFilePath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<AvrGcc>
<avrgcc.common.Device>-mmcu=atmega644p -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\gcc\dev\atmega644p"</avrgcc.common.Device>
<avrgcc.common.outputfiles.hex>True</avrgcc.common.outputfiles.hex>
<avrgcc.common.outputfiles.lss>True</avrgcc.common.outputfiles.lss>
<avrgcc.common.outputfiles.eep>True</avrgcc.common.outputfiles.eep>
<avrgcc.common.outputfiles.srec>True</avrgcc.common.outputfiles.srec>
<avrgcc.common.outputfiles.usersignatures>False</avrgcc.common.outputfiles.usersignatures>
<avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</avrgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>True</avrgcc.compiler.general.ChangeDefaultBitFieldUnsigned>
<avrgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>BACDL_MSTP</Value>
<Value>MAX_APDU=128</Value>
<Value>BIG_ENDIAN=0</Value>
<Value>MAX_TSM_TRANSACTIONS=0</Value>
<Value>MSTP_PDU_PACKET_COUNT=2</Value>
<Value>MAX_CHARACTER_STRING_BYTES=64</Value>
<Value>MAX_OCTET_STRING_BYTES=64</Value>
<Value>DEBUG</Value>
</ListValues>
</avrgcc.compiler.symbols.DefSymbols>
<avrgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>..</Value>
<Value>../../../src</Value>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
<Value>../../../demo/object</Value>
<Value>../../../include</Value>
</ListValues>
</avrgcc.compiler.directories.IncludePaths>
<avrgcc.compiler.optimization.PackStructureMembers>True</avrgcc.compiler.optimization.PackStructureMembers>
<avrgcc.compiler.optimization.AllocateBytesNeededForEnum>True</avrgcc.compiler.optimization.AllocateBytesNeededForEnum>
<avrgcc.compiler.warnings.AllWarnings>True</avrgcc.compiler.warnings.AllWarnings>
<avrgcc.linker.libraries.Libraries>
<ListValues>
<Value>libm</Value>
</ListValues>
</avrgcc.linker.libraries.Libraries>
<avrgcc.assembler.general.IncludePaths>
<ListValues>
<Value>%24(PackRepoDir)\atmel\ATmega_DFP\1.3.300\include</Value>
</ListValues>
</avrgcc.assembler.general.IncludePaths>
<avrgcc.compiler.optimization.level>Optimize (-O1)</avrgcc.compiler.optimization.level>
<avrgcc.compiler.optimization.DebugLevel>Default (-g2)</avrgcc.compiler.optimization.DebugLevel>
<avrgcc.assembler.debugging.DebugLevel>Default (-Wa,-g)</avrgcc.assembler.debugging.DebugLevel>
</AvrGcc>
</ToolchainSettings>
<UsesExternalMakeFile>False</UsesExternalMakeFile>
<BuildTarget>all</BuildTarget>
<CleanTarget>clean</CleanTarget>
<ExternalMakeFilePath>D:\code\bacnet-stack\ports\bdk-atxx4-mstp\Makefile</ExternalMakeFilePath>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\bacnet\basic\service\h_dcc.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_dcc.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\npdu\h_npdu.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_npdu.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\service\h_apdu.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_apdu.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\service\h_rd.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_rd.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\service\h_rp.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_rp.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\service\h_rpm.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_rpm.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\service\h_whohas.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_whohas.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\service\h_whois.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_whois.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\service\h_wp.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_wp.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\service\h_noserv.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\h_noserv.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\service\s_iam.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\s_iam.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\service\s_ihave.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\s_ihave.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\tsm\tsm.c">
<SubType>compile</SubType>
<Link>BACnet Handlers\tsm.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\adc.c">
<SubType>compile</SubType>
<Link>adc.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\ai.c">
<SubType>compile</SubType>
<Link>ai.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\av.c">
<SubType>compile</SubType>
<Link>av.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\bacnet.c">
<SubType>compile</SubType>
<Link>bacnet.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\bi.c">
<SubType>compile</SubType>
<Link>bi.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\bname.c">
<SubType>compile</SubType>
<Link>bname.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\bo.c">
<SubType>compile</SubType>
<Link>bo.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\device.c">
<SubType>compile</SubType>
<Link>device.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\dlmstp.c">
<SubType>compile</SubType>
<Link>dlmstp.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\eeprom.c">
<SubType>compile</SubType>
<Link>eeprom.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\fuses.c">
<SubType>compile</SubType>
<Link>fuses.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\init.c">
<SubType>compile</SubType>
<Link>init.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\input.c">
<SubType>compile</SubType>
<Link>input.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\led.c">
<SubType>compile</SubType>
<Link>led.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\main.c">
<SubType>compile</SubType>
<Link>main.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\rs485.c">
<SubType>compile</SubType>
<Link>rs485.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\seeprom.c">
<SubType>compile</SubType>
<Link>seeprom.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\serial.c">
<SubType>compile</SubType>
<Link>serial.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\stack.c">
<SubType>compile</SubType>
<Link>stack.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\test.c">
<SubType>compile</SubType>
<Link>test.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\mstimer-init.c">
<SubType>compile</SubType>
<Link>mstimer-init.c</Link>
</Compile>
<Compile Include="..\..\ports\bdk-atxx4-mstp\watchdog.c">
<SubType>compile</SubType>
<Link>watchdog.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\abort.c">
<SubType>compile</SubType>
<Link>BACnet Core\abort.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacaddr.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacaddr.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacapp.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacapp.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacdcode.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacdcode.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacerror.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacerror.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacint.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacint.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacreal.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacreal.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacstr.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacstr.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\datalink\crc.c">
<SubType>compile</SubType>
<Link>BACnet Core\crc.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\dcc.c">
<SubType>compile</SubType>
<Link>BACnet Core\dcc.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\sys\fifo.c">
<SubType>compile</SubType>
<Link>BACnet Core\fifo.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\iam.c">
<SubType>compile</SubType>
<Link>BACnet Core\iam.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\ihave.c">
<SubType>compile</SubType>
<Link>BACnet Core\ihave.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\lighting.c">
<SubType>compile</SubType>
<Link>BACnet Core\lighting.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\memcopy.c">
<SubType>compile</SubType>
<Link>BACnet Core\memcopy.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\npdu.c">
<SubType>compile</SubType>
<Link>BACnet Core\npdu.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\rd.c">
<SubType>compile</SubType>
<Link>BACnet Core\rd.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\reject.c">
<SubType>compile</SubType>
<Link>BACnet Core\reject.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\sys\mstimer.c">
<SubType>compile</SubType>
<Link>BACnet Core\mstimer.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\basic\sys\ringbuf.c">
<SubType>compile</SubType>
<Link>BACnet Core\ringbuf.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\rp.c">
<SubType>compile</SubType>
<Link>BACnet Core\rp.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\rpm.c">
<SubType>compile</SubType>
<Link>BACnet Core\rpm.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\whohas.c">
<SubType>compile</SubType>
<Link>BACnet Core\whohas.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\whois.c">
<SubType>compile</SubType>
<Link>BACnet Core\whois.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\wp.c">
<SubType>compile</SubType>
<Link>BACnet Core\wp.c</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="BACnet Handlers" />
<Folder Include="BACnet Core" />
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>
+194 -82
View File
@@ -10,9 +10,9 @@
<debug>1</debug>
<settings>
<name>General</name>
<archiveVersion>11</archiveVersion>
<archiveVersion>12</archiveVersion>
<data>
<version>9</version>
<version>10</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@@ -219,6 +219,14 @@
<name>GenDeviceSelectMenu</name>
<state>m1284p ATmega1284P</state>
</option>
<option>
<name>OGProductVersion</name>
<state>6.80.1.1057</state>
</option>
<option>
<name>OGLastSavedByProductVersion</name>
<state>6.80.1.1057</state>
</option>
</data>
</settings>
<settings>
@@ -416,8 +424,7 @@
<option>
<name>newCCIncludePaths</name>
<state>$PROJ_DIR$</state>
<state>$PROJ_DIR$\..\..\include</state>
<state>$PROJ_DIR$\..\..\demo\object</state>
<state>$PROJ_DIR$\..\..\src</state>
</option>
<option>
<name>CCStdIncCheck</name>
@@ -708,6 +715,7 @@
<data>
<extensions></extensions>
<cmdline></cmdline>
<hasPrio>0</hasPrio>
</data>
</settings>
<settings>
@@ -725,9 +733,9 @@
</settings>
<settings>
<name>XLINK</name>
<archiveVersion>2</archiveVersion>
<archiveVersion>3</archiveVersion>
<data>
<version>13</version>
<version>16</version>
<wantNonLocal>1</wantNonLocal>
<debug>1</debug>
<option>
@@ -745,7 +753,7 @@
</option>
<option>
<name>FormatVariant</name>
<version>8</version>
<version>9</version>
<state>2</state>
</option>
<option>
@@ -927,7 +935,7 @@
</option>
<option>
<name>ExtraFormatVariant</name>
<version>8</version>
<version>9</version>
<state>2</state>
</option>
<option>
@@ -986,6 +994,51 @@
<name>CrcInitialValue</name>
<state>0x00</state>
</option>
<option>
<name>CrcUnitSize</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>XlinkLogEnable</name>
<state>0</state>
</option>
<option>
<name>XlinkLogInputFiles</name>
<state>0</state>
</option>
<option>
<name>XlinkLogModuleSelection</name>
<state>0</state>
</option>
<option>
<name>XlinkLogPrintfScanf</name>
<state>0</state>
</option>
<option>
<name>XlinkLogSegmentSelection</name>
<state>0</state>
</option>
<option>
<name>XlinkLogStackDepth</name>
<state>0</state>
</option>
<option>
<name>XlinkStackUsageEnable</name>
<state>0</state>
</option>
<option>
<name>XlinkControlFiles</name>
<state></state>
</option>
<option>
<name>XlinkCallGraphFileEnable</name>
<state>0</state>
</option>
<option>
<name>XlinkCallGraphFileName</name>
<state>$LIST_DIR$\$PROJ_FNAME$.call_graph.cgx</state>
</option>
</data>
</settings>
<settings>
@@ -1023,9 +1076,9 @@
<debug>0</debug>
<settings>
<name>General</name>
<archiveVersion>11</archiveVersion>
<archiveVersion>12</archiveVersion>
<data>
<version>9</version>
<version>10</version>
<wantNonLocal>1</wantNonLocal>
<debug>0</debug>
<option>
@@ -1232,6 +1285,14 @@
<name>GenDeviceSelectMenu</name>
<state>m1284p ATmega1284P</state>
</option>
<option>
<name>OGProductVersion</name>
<state>6.80.1.1057</state>
</option>
<option>
<name>OGLastSavedByProductVersion</name>
<state></state>
</option>
</data>
</settings>
<settings>
@@ -1429,8 +1490,7 @@
<option>
<name>newCCIncludePaths</name>
<state>$PROJ_DIR$</state>
<state>$PROJ_DIR$\..\..\include</state>
<state>$PROJ_DIR$\..\..\demo\object</state>
<state>$PROJ_DIR$\..\..\src</state>
</option>
<option>
<name>CCStdIncCheck</name>
@@ -1721,6 +1781,7 @@
<data>
<extensions></extensions>
<cmdline></cmdline>
<hasPrio>0</hasPrio>
</data>
</settings>
<settings>
@@ -1738,9 +1799,9 @@
</settings>
<settings>
<name>XLINK</name>
<archiveVersion>2</archiveVersion>
<archiveVersion>3</archiveVersion>
<data>
<version>13</version>
<version>16</version>
<wantNonLocal>1</wantNonLocal>
<debug>0</debug>
<option>
@@ -1758,7 +1819,7 @@
</option>
<option>
<name>FormatVariant</name>
<version>8</version>
<version>9</version>
<state>2</state>
</option>
<option>
@@ -1940,7 +2001,7 @@
</option>
<option>
<name>ExtraFormatVariant</name>
<version>8</version>
<version>9</version>
<state>2</state>
</option>
<option>
@@ -1999,6 +2060,51 @@
<name>CrcInitialValue</name>
<state>0x00</state>
</option>
<option>
<name>CrcUnitSize</name>
<version>0</version>
<state>0</state>
</option>
<option>
<name>XlinkLogEnable</name>
<state>0</state>
</option>
<option>
<name>XlinkLogInputFiles</name>
<state>0</state>
</option>
<option>
<name>XlinkLogModuleSelection</name>
<state>0</state>
</option>
<option>
<name>XlinkLogPrintfScanf</name>
<state>0</state>
</option>
<option>
<name>XlinkLogSegmentSelection</name>
<state>0</state>
</option>
<option>
<name>XlinkLogStackDepth</name>
<state>0</state>
</option>
<option>
<name>XlinkStackUsageEnable</name>
<state>0</state>
</option>
<option>
<name>XlinkControlFiles</name>
<state></state>
</option>
<option>
<name>XlinkCallGraphFileEnable</name>
<state>0</state>
</option>
<option>
<name>XlinkCallGraphFileName</name>
<state>$LIST_DIR$\$PROJ_FNAME$.call_graph.cgx</state>
</option>
</data>
</settings>
<settings>
@@ -2029,117 +2135,126 @@
</settings>
</configuration>
<group>
<name>BACnet-Core</name>
<name>BACnet Basic</name>
<file>
<name>$PROJ_DIR$\..\..\src\abort.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\h_apdu.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\apdu.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\h_dcc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacaddr.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\h_noserv.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacapp.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\npdu\h_npdu.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacdcode.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\h_rd.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacerror.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\h_rp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacint.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\h_rpm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacreal.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\h_whohas.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacstr.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\h_whois.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\crc.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\h_wp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\dcc.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\s_iam.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\fifo.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\service\s_ihave.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\iam.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\ihave.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\memcopy.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\npdu.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\rd.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\reject.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\ringbuf.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\rp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\rpm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\whohas.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\whois.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\wp.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\tsm\tsm.c</name>
</file>
</group>
<group>
<name>BACnet-Demo</name>
<name>BACnet Basic Sys</name>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\h_dcc.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\sys\fifo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\h_npdu.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\sys\mstimer.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\h_rd.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\basic\sys\ringbuf.c</name>
</file>
</group>
<group>
<name>BACnet Datalink</name>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\datalink\crc.c</name>
</file>
</group>
<group>
<name>BACnet-Core</name>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\abort.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\h_rp.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\bacaddr.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\h_rpm.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\bacapp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\h_whohas.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\bacdcode.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\h_whois.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\bacerror.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\h_wp.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\bacint.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\noserv.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\bacreal.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\s_iam.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\bacstr.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\s_ihave.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\dcc.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\demo\handler\txbuf.c</name>
<name>$PROJ_DIR$\..\..\src\bacnet\iam.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\ihave.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\memcopy.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\npdu.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\rd.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\reject.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\rp.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\rpm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\whohas.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\whois.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\wp.c</name>
</file>
</group>
<file>
@@ -2187,6 +2302,9 @@
<file>
<name>$PROJ_DIR$\main.c</name>
</file>
<file>
<name>$PROJ_DIR$\mstimer-init.c</name>
</file>
<file>
<name>$PROJ_DIR$\rs485.c</name>
</file>
@@ -2202,12 +2320,6 @@
<file>
<name>$PROJ_DIR$\test.c</name>
</file>
<file>
<name>$PROJ_DIR$\timer.c</name>
</file>
<file>
<name>$PROJ_DIR$\timer2.c</name>
</file>
<file>
<name>$PROJ_DIR$\watchdog.c</name>
</file>
+41 -39
View File
@@ -1,7 +1,7 @@
<!DOCTYPE CrossStudio_Project_File>
<solution Name="bacnet" version="2">
<project Name="bacnet">
<configuration Name="Common" Platform="AVR" Target="ATmega644P" avr_architecture="V2E" avr_debug_interface="JTAG" avr_flash_size="128K" build_use_hardware_multiplier="Yes" c_preprocessor_definitions="BACDL_MSTP;MAX_APDU=128;BIG_ENDIAN=0;MAX_TSM_TRANSACTIONS=0;MAX_CHARACTER_STRING_BYTES=64;MAX_OCTET_STRING_BYTES=64;BACAPP_BOOLEAN;BACAPP_REAL;BACAPP_OBJECT_ID;BACAPP_UNSIGNED;BACAPP_ENUMERATED;BACAPP_CHARACTER_STRING;WRITE_PROPERTY" c_user_include_directories="$(ProjectDir);$(ProjectDir)/crossworks;$(ProjectDir)/../../include;$(ProjectDir)/../../demo/handler;$(ProjectDir)/../../demo/object" linker_call_stack_size="1024" linker_memory_map_file="$(PackagesDir)/targets/avr/ATmega644P.xml" project_directory="" project_type="Executable"/>
<configuration Name="Common" Platform="AVR" Target="ATmega644P" avr_architecture="V2E" avr_debug_interface="JTAG" avr_flash_size="128K" build_use_hardware_multiplier="Yes" c_preprocessor_definitions="BACDL_MSTP;MAX_APDU=128;BIG_ENDIAN=0;MAX_TSM_TRANSACTIONS=0;MAX_CHARACTER_STRING_BYTES=64;MAX_OCTET_STRING_BYTES=64;BACAPP_BOOLEAN;BACAPP_REAL;BACAPP_OBJECT_ID;BACAPP_UNSIGNED;BACAPP_ENUMERATED;BACAPP_CHARACTER_STRING;WRITE_PROPERTY" c_user_include_directories="$(ProjectDir);$(ProjectDir)/crossworks;$(ProjectDir)/../../include;$(ProjectDir)/../../src" linker_call_stack_size="1024" linker_memory_map_file="$(PackagesDir)/targets/avr/ATmega644P.xml" project_directory="" project_type="Executable"/>
<folder Name="Source Files">
<configuration Name="Common" filter="c;h;s;asm;inc;s90"/>
<file file_name="adc.c">
@@ -25,8 +25,7 @@
<file file_name="serial.c"/>
<file file_name="stack.c"/>
<file file_name="test.c"/>
<file file_name="timer2.c"/>
<file file_name="timer.c"/>
<file file_name="mstimer-init.c"/>
<file file_name="watchdog.c"/>
</folder>
<folder Name="System Files" file_name="">
@@ -34,44 +33,47 @@
<file file_name="$(StudioDir)/src/crt0.asm"/>
</folder>
<folder Name="BACnet - default handlers">
<file file_name="../../demo/handler/h_dcc.c"/>
<file file_name="../../demo/handler/h_npdu.c"/>
<file file_name="../../demo/handler/h_rd.c"/>
<file file_name="../../demo/handler/h_rp.c"/>
<file file_name="../../demo/handler/h_rpm.c"/>
<file file_name="../../demo/handler/h_whohas.c"/>
<file file_name="../../demo/handler/h_whois.c"/>
<file file_name="../../demo/handler/h_wp.c"/>
<file file_name="../../demo/handler/noserv.c"/>
<file file_name="../../demo/handler/s_iam.c"/>
<file file_name="../../demo/handler/s_ihave.c"/>
<file file_name="../../demo/handler/txbuf.c"/>
<file file_name="../../src/basic/service/h_dcc.c"/>
<file file_name="../../src/basic/service/h_apdu.c"/>
<file file_name="../../src/basic/service/h_rd.c"/>
<file file_name="../../src/basic/service/h_rp.c"/>
<file file_name="../../src/basic/service/h_rpm.c"/>
<file file_name="../../src/basic/service/h_whohas.c"/>
<file file_name="../../src/basic/service/h_whois.c"/>
<file file_name="../../src/basic/service/h_wp.c"/>
<file file_name="../../src/basic/service/h_noserv.c"/>
<file file_name="../../src/basic/service/s_iam.c"/>
<file file_name="../../src/basic/service/s_ihave.c"/>
<file file_name="../../src/basic/npdu/h_npdu.c"/>
<file file_name="../../src/basic/tsm/tsm.c"/>
</folder>
<folder Name="BACnet - system abstraction">
<file file_name="../../src/basic/sys/mstimer.c"/>
<file file_name="../../src/basic/sys/ringbuf.c"/>
<file file_name="../../src/basic/sys/fifo.c"/>
<file file_name="../../src/bacnet/datalink/crc.c"/>
</folder>
<folder Name="BACnet - core">
<file file_name="../../src/abort.c"/>
<file file_name="../../src/apdu.c"/>
<file file_name="../../src/bacaddr.c"/>
<file file_name="../../src/bacapp.c"/>
<file file_name="../../src/bacdcode.c"/>
<file file_name="../../src/bacerror.c"/>
<file file_name="../../src/bacint.c"/>
<file file_name="../../src/bacreal.c"/>
<file file_name="../../src/bacstr.c"/>
<file file_name="../../src/crc.c"/>
<file file_name="../../src/dcc.c"/>
<file file_name="../../src/fifo.c"/>
<file file_name="../../src/iam.c"/>
<file file_name="../../src/ihave.c"/>
<file file_name="../../src/memcopy.c"/>
<file file_name="../../src/npdu.c"/>
<file file_name="../../src/rd.c"/>
<file file_name="../../src/reject.c"/>
<file file_name="../../src/ringbuf.c"/>
<file file_name="../../src/rp.c"/>
<file file_name="../../src/rpm.c"/>
<file file_name="../../src/whohas.c"/>
<file file_name="../../src/whois.c"/>
<file file_name="../../src/wp.c"/>
<file file_name="../../src/bacnet/abort.c"/>
<file file_name="../../src/bacnet/bacaddr.c"/>
<file file_name="../../src/bacnet/bacapp.c"/>
<file file_name="../../src/bacnet/bacdcode.c"/>
<file file_name="../../src/bacnet/bacerror.c"/>
<file file_name="../../src/bacnet/bacint.c"/>
<file file_name="../../src/bacnet/bacreal.c"/>
<file file_name="../../src/bacnet/bacstr.c"/>
<file file_name="../../src/bacnet/dcc.c"/>
<file file_name="../../src/bacnet/iam.c"/>
<file file_name="../../src/bacnet/ihave.c"/>
<file file_name="../../src/bacnet/memcopy.c"/>
<file file_name="../../src/bacnet/npdu.c"/>
<file file_name="../../src/bacnet/rd.c"/>
<file file_name="../../src/bacnet/reject.c"/>
<file file_name="../../src/bacnet/rp.c"/>
<file file_name="../../src/bacnet/rpm.c"/>
<file file_name="../../src/bacnet/whohas.c"/>
<file file_name="../../src/bacnet/whois.c"/>
<file file_name="../../src/bacnet/wp.c"/>
</folder>
</project>
<configuration Name="AVR Debug" inherited_configurations="AVR;Debug"/>
+6 -6
View File
@@ -28,12 +28,12 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "bacdef.h"
#include "bacdcode.h"
#include "bacenum.h"
#include "config.h"
#include "bi.h"
#include "handlers.h"
#include "bacnet/bacdef.h"
#include "bacnet/bacdcode.h"
#include "bacnet/bacenum.h"
#include "bacnet/config.h"
#include "bacnet/basic/object/bi.h"
#include "bacnet/basic/services.h"
#ifndef MAX_BINARY_INPUTS
#define MAX_BINARY_INPUTS 5
+4 -4
View File
@@ -27,12 +27,12 @@
#include <stdlib.h>
#include <string.h>
#include "hardware.h"
#include "bacdef.h"
#include "bacdcode.h"
#include "bacstr.h"
#include "bacnet/bacdef.h"
#include "bacnet/bacdcode.h"
#include "bacnet/bacstr.h"
#include "nvdata.h"
#include "seeprom.h"
#include "device.h"
#include "bacnet/basic/object/device.h"
#include "bname.h"
static bool bacnet_name_isvalid(
+1 -1
View File
@@ -25,7 +25,7 @@
#define BACNET_NAME_H
#include <stdint.h>
#include "bacstr.h"
#include "bacnet/bacstr.h"
#ifdef __cplusplus
extern "C" {
+7 -7
View File
@@ -28,16 +28,16 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "bacdef.h"
#include "bacdcode.h"
#include "bacenum.h"
#include "config.h" /* the custom stuff */
#include "wp.h"
#include "bacnet/bacdef.h"
#include "bacnet/bacdcode.h"
#include "bacnet/bacenum.h"
#include "bacnet/config.h" /* the custom stuff */
#include "bacnet/wp.h"
#include "hardware.h"
#include "led.h"
#include "nvdata.h"
#include "bo.h"
#include "handlers.h"
#include "bacnet/basic/object/bo.h"
#include "bacnet/basic/services.h"
#ifndef MAX_BINARY_OUTPUTS
#define MAX_BINARY_OUTPUTS 2
@@ -1 +1 @@
<AVRStudio><MANAGEMENT><ProjectName>bootloader</ProjectName><Created>27-May-2009 06:28:56</Created><LastEdit>27-May-2009 06:28:56</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>27-May-2009 06:28:56</Created><Version>4</Version><Build>4, 15, 0, 623</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile></ObjectFile><EntryFile></EntryFile><SaveFolder>D:\code\bacnet-stack\ports\bdk-atxx4-mstp\bootloader\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATmega644P.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES/><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega128</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>bootloader.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="1" orderaddress="1" ordergroup="1"/></IOView><Files></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
<AVRStudio><MANAGEMENT><ProjectName>bootloader</ProjectName><Created>27-May-2009 06:28:56</Created><LastEdit>27-May-2009 06:28:56</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>27-May-2009 06:28:56</Created><Version>4</Version><Build>4, 15, 0, 623</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile></ObjectFile><EntryFile></EntryFile><SaveFolder>D:\code\bacnet-stack\ports\bdk-atxx4-mstp\bootloader\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>JTAGICE mkII</CURRENT_TARGET><CURRENT_PART>ATmega644P.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES/><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega128</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>bootloader.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>0</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="1" orderaddress="1" ordergroup="1"/></IOView><Files></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
+17 -14
View File
@@ -26,25 +26,28 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "bacdef.h"
#include "bacdcode.h"
#include "bacstr.h"
#include "bacenum.h"
#include "apdu.h"
#include "dcc.h"
#include "datalink.h"
#include "bacnet/bacdef.h"
#include "bacnet/bacdcode.h"
#include "bacnet/bacstr.h"
#include "bacnet/bacenum.h"
#include "bacnet/apdu.h"
#include "bacnet/dcc.h"
#include "bacnet/datalink/datalink.h"
#include "rs485.h"
#include "version.h"
#include "bacnet/version.h"
#include "nvdata.h"
#include "stack.h"
#include "handlers.h"
#include "bacnet/basic/services.h"
#include "bname.h"
/* objects */
#include "device.h"
#include "ai.h"
#include "av.h"
#include "bi.h"
#include "bo.h"
#include "bacnet/basic/object/device.h"
#include "bacnet/basic/object/ai.h"
#include "bacnet/basic/object/av.h"
#include "bacnet/basic/object/bi.h"
#include "bacnet/basic/object/bo.h"
/* current version of the BACnet stack */
static const char *BACnet_Version = BACNET_VERSION_TEXT;
/* forward prototype */
int Device_Read_Property_Local(
+10 -10
View File
@@ -36,17 +36,17 @@
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include "bacdef.h"
#include "dlmstp.h"
#include "mstpdef.h"
#include "bacnet/bacdef.h"
#include "bacnet/datalink/dlmstp.h"
#include "bacnet/datalink/mstpdef.h"
#include "bacnet/datalink/crc.h"
#include "rs485.h"
#include "crc.h"
#include "npdu.h"
#include "bits.h"
#include "bytes.h"
#include "bacaddr.h"
#include "ringbuf.h"
#include "timer.h"
#include "bacnet/npdu.h"
#include "bacnet/bits.h"
#include "bacnet/bytes.h"
#include "bacnet/bacaddr.h"
#include "bacnet/basic/sys/ringbuf.h"
#include "bacnet/basic/sys/mstimer.h"
/* This file has been customized for use with small microprocessors */
/* Assumptions:
+354 -354
View File
@@ -1,354 +1,354 @@
PICS 0
BACnet Protocol Implementation Conformance Statement
--
--
-- BACnet Development Kit
-- bacnetdevelopmentkit.com
-- Author: Steve Karg
--
--
Vendor Name: "BACnet Stack at SourceForge"
Product Name: "bdk-atxx4-mstp"
Product Model Number: "bdk-atxx4-mstp"
Product Description: "BACnet Development Kit"
BIBBs Supported:
{
-- The BIBBs may be any of:
-- DS-RP-A
DS-RP-B
DS-RPM-B
-- DS-RPM-A
-- DS-RPC-A DS-RPC-B
-- DS-WP-A
DS-WP-B
-- DS-WPM-A DS-WPM-B
-- DS-COV-A DS-COV-B
-- DS-COVP-A DS-COVP-B
-- DS-COVU-A DS-COVU-B
-- AE-N-A AE-N-I-B AE-N-E-B
-- AE-ACK-A AE-ACK-B
-- AE-ASUM-A AE-ASUM-B
-- AE-ESUM-A AE-ESUM-B
-- AE-INFO-A AE-INFO-B
-- AE-LS-A AE-LS-B
-- SCHED-A SCHED-I-B SCHED-E-B
-- T-VMT-A T-VMT-I-B T-VMT-E-B
-- T-ATR-A T-ATR-B
-- DM-DDB-A
DM-DDB-B
-- DM-DOB-A
DM-DOB-B
-- DM-DCC-A
DM-DCC-B
-- DM-PT-A DM-PT-B
-- DM-TM-A DM-TM-B
-- DM-TS-A
-- DM-TS-B
-- DM-UTC-A
-- DM-UTC-B
-- DM-RD-A
DM-RD-B
-- DM-BR-A DM-BR-B
-- DM-R-A DM-R-B
-- DM-LM-A DM-LM-B
-- DM-OCD-A DM-OCD-B
-- DM-VT-A DM-VT-B
-- NM-CE-A NM-CE-B
-- NM-RC-A NM-RC-B
}
BACnet Standard Application Services Supported:
{
-- AcknowledgeAlarm Initiate Execute
-- ConfirmedCOVNotification Initiate Execute
-- UnconfirmedCOVNotification Initiate Execute
-- ConfirmedEventNotification Initiate Execute
-- UnconfirmedEventNotification Initiate Execute
-- GetAlarmSummary Initiate Execute
-- GetEnrollmentSummary Initiate Execute
-- AtomicReadFile Initiate Execute
-- AtomicWriteFile Initiate Execute
-- AddListElement Initiate Execute
-- RemoveListElement Initiate Execute
-- CreateObject Initiate Execute
-- DeleteObject Initiate Execute
ReadProperty Execute
-- ReadpropertyConditional Initiate Execute
ReadPropertyMultiple Execute
-- SubscribeCOV Initiate Execute
WriteProperty Execute
-- WritePropertyMultiple Initiate Execute
DeviceCommunicationControl Execute
-- ConfirmedPrivateTransfer Initiate Execute
-- UnconfirmedPrivateTransfer Initiate Execute
-- TimeSynchronization Initiate Execute
Who-Has Execute
I-Have Initiate
Who-Is Execute
I-Am Initiate
-- VT-Open Initiate Execute
-- VT-Close Initiate Execute
-- VT-Data Initiate Execute
-- ConfirmedTextMessage Initiate Execute
-- UnconfirmedTextMessage Initiate Execute
ReinitializeDevice Execute
-- RequestKey Initiate Execute
-- Authenticate Initiate Execute
-- UTCTimeSynchronization Initiate Execute
-- ReadRange Initiate Execute
-- GetEventInformation Initiate Execute
-- LifeSafetyOperation Initiate Execute
-- SubscribeCOVProperty Initiate Execute
-- RequestKey Initiate Execute
-- Authenticate Initiate Execute
}
Standard Object-Types Supported:
{
Analog Input
-- Analog Output Createable Deleteable
Analog Value
-- Averaging Createable Deleteable
Binary Input
Binary Output
-- Binary Value Createable Deleteable
-- Calendar Createable Deleteable
-- Command Createable Deleteable
Device
-- Event Enrollment Createable Deleteable
-- File Createable Deleteable
-- Group Createable Deleteable
-- Loop Createable Deleteable
-- Multi-state Input Createable Deleteable
-- Multi-state Output Createable Deleteable
-- Multi-state Value Createable Deleteable
-- Notification Class Createable Deleteable
-- Program Createable Deleteable
-- Schedule Createable Deleteable
-- Life Safety Point Createable Deleteable
-- Life Safety Zone Createable Deleteable
-- Trend Log Createable Deleteable
-- Load Control Createable Deleteable
}
Data Link Layer Option:
{
-- ISO 8802-3, 10BASE5
-- ISO 8802-3, 10BASE2
-- ISO 8802-3, 10BASET
-- ISO 8802-3, Fiber
-- ARCNET, coax star
-- ARCNET, coax bus
-- ARCNET, twisted pair star
-- ARCNET, twisted pair bus
-- ARCNET, fiber star
MS/TP master. Baud rate(s): 9600, 19200, 38400, 57600, 76800, 115200
-- MS/TP slave. Baud rate(s): 9600
-- Point-To-Point. Modem, Baud rate(s): 14.4k
-- Point-To-Point. Modem, Autobaud range: 9600 to 28.8k
-- BACnet/IP, 'DIX' Ethernet
-- BACnet/IP, PPP
-- Other
}
Character Sets Supported:
{
ANSI X3.4
-- Other Character Sets not supported
-- IBM/Microsoft DBCS
-- JIS C 6226
-- ISO 10646 (ICS-4)
-- ISO 10646 (UCS2)
}
Special Functionality:
{
Maximum APDU size in octets: 128 -- MS/TP Maximum 501 less NL Header
-- Maximum APDU size in octets: 480
-- Segmented Requests Supported, window size: 1
-- Segmented Responses Supported, window size: 1
-- Router
}
List of Objects in Test Device:
{
{
object-identifier: (Device, 90) Writable
object-name: "DEVICE-90" Writable
object-type: Device
system-status: operational
vendor-name: "BACnet Stack at SourceForge"
vendor-identifier: 260
model-name: "bdk-atxx4-mstp"
firmware-revision: "1.0"
application-software-version: "1.0"
protocol-version: 1
protocol-revision: 10
protocol-services-supported: (
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
T,F,T,T, -- Read-Property,, Read-Property-Multiple, Write-Property,
F,T,F,F, -- , Device-Communication-Control,,,
T,F,F,F, -- Reinitialize-Device,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,T,T,F, -- , Who-Has, Who-Is,,
F,F,F,F -- ,,,,
)
protocol-object-types-supported: (
T,F,T,T, -- Analog Input,, Analog Value, Binary Input,
T,F,F,F, -- Binary Output,,,,
T,F,F,F, -- Device,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F -- ,,,
)
object-list: {
(Device, 90), (Analog Input, 0), (Analog Input, 1), (Analog Value, 0),
(Analog Value, 1), (Binary Input, 0), (Binary Input, 1),
(Binary Input, 2),
(Binary Input, 3), (Binary Input, 4), (Binary Output, 0),
(Binary Output, 1) }
max-apdu-length-accepted: 128
segmentation-supported: no-segmentation
apdu-timeout: 3000
number-of-APDU-retries: 3
device-address-binding: ?
database-revision: ?
max-master: 127 Writable
max-info-frames: 1 Writable
description: "BACnet Development Kit" Writable
location: "default location" Writable
-- Found 12 Objects
},
{
object-identifier: (Analog Input, 0)
object-name: "AI-0"
object-type: Analog Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
units: percent
},
{
object-identifier: (Analog Input, 1)
object-name: "AI-1"
object-type: Analog Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
units: percent
},
{
object-identifier: (Analog Value, 0)
object-name: "AV-0"
object-type: Analog Value
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
units: percent
},
{
object-identifier: (Analog Value, 1)
object-name: "AV-1"
object-type: Analog Value
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
units: percent
},
{
object-identifier: (Binary Input, 0)
object-name: "BI-0"
object-type: Binary Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
},
{
object-identifier: (Binary Input, 1)
object-name: "BI-1"
object-type: Binary Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
},
{
object-identifier: (Binary Input, 2)
object-name: "BI-2"
object-type: Binary Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
},
{
object-identifier: (Binary Input, 3)
object-name: "BI-3"
object-type: Binary Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
},
{
object-identifier: (Binary Input, 4)
object-name: "BI-4"
object-type: Binary Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
},
{
object-identifier: (Binary Output, 0)
object-name: "BO-0"
object-type: Binary Output
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
priority-array: ?
relinquish-default: inactive
active-text: "on"
inactive-text: "off"
},
{
object-identifier: (Binary Output, 1)
object-name: "BO-1"
object-type: Binary Output
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
priority-array: ?
relinquish-default: inactive
active-text: "on"
inactive-text: "off"
}
}
End of BACnet Protocol Implementation Conformance Statement
PICS 0
BACnet Protocol Implementation Conformance Statement
--
--
-- BACnet Development Kit
-- bacnetdevelopmentkit.com
-- Author: Steve Karg
--
--
Vendor Name: "BACnet Stack at SourceForge"
Product Name: "bdk-atxx4-mstp"
Product Model Number: "bdk-atxx4-mstp"
Product Description: "BACnet Development Kit"
BIBBs Supported:
{
-- The BIBBs may be any of:
-- DS-RP-A
DS-RP-B
DS-RPM-B
-- DS-RPM-A
-- DS-RPC-A DS-RPC-B
-- DS-WP-A
DS-WP-B
-- DS-WPM-A DS-WPM-B
-- DS-COV-A DS-COV-B
-- DS-COVP-A DS-COVP-B
-- DS-COVU-A DS-COVU-B
-- AE-N-A AE-N-I-B AE-N-E-B
-- AE-ACK-A AE-ACK-B
-- AE-ASUM-A AE-ASUM-B
-- AE-ESUM-A AE-ESUM-B
-- AE-INFO-A AE-INFO-B
-- AE-LS-A AE-LS-B
-- SCHED-A SCHED-I-B SCHED-E-B
-- T-VMT-A T-VMT-I-B T-VMT-E-B
-- T-ATR-A T-ATR-B
-- DM-DDB-A
DM-DDB-B
-- DM-DOB-A
DM-DOB-B
-- DM-DCC-A
DM-DCC-B
-- DM-PT-A DM-PT-B
-- DM-TM-A DM-TM-B
-- DM-TS-A
-- DM-TS-B
-- DM-UTC-A
-- DM-UTC-B
-- DM-RD-A
DM-RD-B
-- DM-BR-A DM-BR-B
-- DM-R-A DM-R-B
-- DM-LM-A DM-LM-B
-- DM-OCD-A DM-OCD-B
-- DM-VT-A DM-VT-B
-- NM-CE-A NM-CE-B
-- NM-RC-A NM-RC-B
}
BACnet Standard Application Services Supported:
{
-- AcknowledgeAlarm Initiate Execute
-- ConfirmedCOVNotification Initiate Execute
-- UnconfirmedCOVNotification Initiate Execute
-- ConfirmedEventNotification Initiate Execute
-- UnconfirmedEventNotification Initiate Execute
-- GetAlarmSummary Initiate Execute
-- GetEnrollmentSummary Initiate Execute
-- AtomicReadFile Initiate Execute
-- AtomicWriteFile Initiate Execute
-- AddListElement Initiate Execute
-- RemoveListElement Initiate Execute
-- CreateObject Initiate Execute
-- DeleteObject Initiate Execute
ReadProperty Execute
-- ReadpropertyConditional Initiate Execute
ReadPropertyMultiple Execute
-- SubscribeCOV Initiate Execute
WriteProperty Execute
-- WritePropertyMultiple Initiate Execute
DeviceCommunicationControl Execute
-- ConfirmedPrivateTransfer Initiate Execute
-- UnconfirmedPrivateTransfer Initiate Execute
-- TimeSynchronization Initiate Execute
Who-Has Execute
I-Have Initiate
Who-Is Execute
I-Am Initiate
-- VT-Open Initiate Execute
-- VT-Close Initiate Execute
-- VT-Data Initiate Execute
-- ConfirmedTextMessage Initiate Execute
-- UnconfirmedTextMessage Initiate Execute
ReinitializeDevice Execute
-- RequestKey Initiate Execute
-- Authenticate Initiate Execute
-- UTCTimeSynchronization Initiate Execute
-- ReadRange Initiate Execute
-- GetEventInformation Initiate Execute
-- LifeSafetyOperation Initiate Execute
-- SubscribeCOVProperty Initiate Execute
-- RequestKey Initiate Execute
-- Authenticate Initiate Execute
}
Standard Object-Types Supported:
{
Analog Input
-- Analog Output Createable Deleteable
Analog Value
-- Averaging Createable Deleteable
Binary Input
Binary Output
-- Binary Value Createable Deleteable
-- Calendar Createable Deleteable
-- Command Createable Deleteable
Device
-- Event Enrollment Createable Deleteable
-- File Createable Deleteable
-- Group Createable Deleteable
-- Loop Createable Deleteable
-- Multi-state Input Createable Deleteable
-- Multi-state Output Createable Deleteable
-- Multi-state Value Createable Deleteable
-- Notification Class Createable Deleteable
-- Program Createable Deleteable
-- Schedule Createable Deleteable
-- Life Safety Point Createable Deleteable
-- Life Safety Zone Createable Deleteable
-- Trend Log Createable Deleteable
-- Load Control Createable Deleteable
}
Data Link Layer Option:
{
-- ISO 8802-3, 10BASE5
-- ISO 8802-3, 10BASE2
-- ISO 8802-3, 10BASET
-- ISO 8802-3, Fiber
-- ARCNET, coax star
-- ARCNET, coax bus
-- ARCNET, twisted pair star
-- ARCNET, twisted pair bus
-- ARCNET, fiber star
MS/TP master. Baud rate(s): 9600, 19200, 38400, 57600, 76800, 115200
-- MS/TP slave. Baud rate(s): 9600
-- Point-To-Point. Modem, Baud rate(s): 14.4k
-- Point-To-Point. Modem, Autobaud range: 9600 to 28.8k
-- BACnet/IP, 'DIX' Ethernet
-- BACnet/IP, PPP
-- Other
}
Character Sets Supported:
{
ANSI X3.4
-- Other Character Sets not supported
-- IBM/Microsoft DBCS
-- JIS C 6226
-- ISO 10646 (ICS-4)
-- ISO 10646 (UCS2)
}
Special Functionality:
{
Maximum APDU size in octets: 128 -- MS/TP Maximum 501 less NL Header
-- Maximum APDU size in octets: 480
-- Segmented Requests Supported, window size: 1
-- Segmented Responses Supported, window size: 1
-- Router
}
List of Objects in Test Device:
{
{
object-identifier: (Device, 90) Writable
object-name: "DEVICE-90" Writable
object-type: Device
system-status: operational
vendor-name: "BACnet Stack at SourceForge"
vendor-identifier: 260
model-name: "bdk-atxx4-mstp"
firmware-revision: "1.0"
application-software-version: "1.0"
protocol-version: 1
protocol-revision: 10
protocol-services-supported: (
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
T,F,T,T, -- Read-Property,, Read-Property-Multiple, Write-Property,
F,T,F,F, -- , Device-Communication-Control,,,
T,F,F,F, -- Reinitialize-Device,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,T,T,F, -- , Who-Has, Who-Is,,
F,F,F,F -- ,,,,
)
protocol-object-types-supported: (
T,F,T,T, -- Analog Input,, Analog Value, Binary Input,
T,F,F,F, -- Binary Output,,,,
T,F,F,F, -- Device,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F,F, -- ,,,,
F,F,F -- ,,,
)
object-list: {
(Device, 90), (Analog Input, 0), (Analog Input, 1), (Analog Value, 0),
(Analog Value, 1), (Binary Input, 0), (Binary Input, 1),
(Binary Input, 2),
(Binary Input, 3), (Binary Input, 4), (Binary Output, 0),
(Binary Output, 1) }
max-apdu-length-accepted: 128
segmentation-supported: no-segmentation
apdu-timeout: 3000
number-of-APDU-retries: 3
device-address-binding: ?
database-revision: ?
max-master: 127 Writable
max-info-frames: 1 Writable
description: "BACnet Development Kit" Writable
location: "default location" Writable
-- Found 12 Objects
},
{
object-identifier: (Analog Input, 0)
object-name: "AI-0"
object-type: Analog Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
units: percent
},
{
object-identifier: (Analog Input, 1)
object-name: "AI-1"
object-type: Analog Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
units: percent
},
{
object-identifier: (Analog Value, 0)
object-name: "AV-0"
object-type: Analog Value
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
units: percent
},
{
object-identifier: (Analog Value, 1)
object-name: "AV-1"
object-type: Analog Value
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
units: percent
},
{
object-identifier: (Binary Input, 0)
object-name: "BI-0"
object-type: Binary Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
},
{
object-identifier: (Binary Input, 1)
object-name: "BI-1"
object-type: Binary Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
},
{
object-identifier: (Binary Input, 2)
object-name: "BI-2"
object-type: Binary Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
},
{
object-identifier: (Binary Input, 3)
object-name: "BI-3"
object-type: Binary Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
},
{
object-identifier: (Binary Input, 4)
object-name: "BI-4"
object-type: Binary Input
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
},
{
object-identifier: (Binary Output, 0)
object-name: "BO-0"
object-type: Binary Output
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
priority-array: ?
relinquish-default: inactive
active-text: "on"
inactive-text: "off"
},
{
object-identifier: (Binary Output, 1)
object-name: "BO-1"
object-type: Binary Output
present-value: ?
status-flags: {false,false,false,false}
event-state: normal
out-of-service: FALSE
polarity: normal
priority-array: ?
relinquish-default: inactive
active-text: "on"
inactive-text: "off"
}
}
End of BACnet Protocol Implementation Conformance Statement
+1 -1
View File
@@ -62,7 +62,7 @@
#endif
#include "iar2gcc.h"
#include "bits.h"
#include "bacnet/bits.h"
/* SEEPROM is 24LC128 */
/*#define SEEPROM_PAGE_SIZE 64 */
+5 -5
View File
@@ -25,7 +25,7 @@
#include <stdint.h>
#include <stdbool.h>
#include "hardware.h"
#include "timer.h"
#include "bacnet/basic/sys/mstimer.h"
/* me */
#include "input.h"
@@ -35,7 +35,7 @@
static uint8_t Address_Switch;
static uint8_t Buttons;
static struct itimer Debounce_Timer;
static struct mstimer Debounce_Timer;
#ifndef BDK_V1_HACK
#define BDK_V1_HACK 0
@@ -84,8 +84,8 @@ void input_task(
static uint8_t old_buttons = 0;
/* only check the inputs every debounce time */
if (timer_interval_expired(&Debounce_Timer)) {
timer_interval_reset(&Debounce_Timer);
if (mstimer_expired(&Debounce_Timer)) {
mstimer_reset(&Debounce_Timer);
/* pins used are PA6, PA5, PA4, PA3, PA2, PA1, PA0 */
#if BDK_V1_HACK
/* version 1 BDK - workaround */
@@ -199,5 +199,5 @@ void input_init(
BIT_SET(PORTB, PORTB3);
BIT_SET(PORTB, PORTB4);
#endif
timer_interval_start(&Debounce_Timer, 30);
mstimer_set(&Debounce_Timer, 30);
}
+8 -8
View File
@@ -23,14 +23,14 @@
*********************************************************************/
#include <stdint.h>
#include "hardware.h"
#include "timer.h"
#include "bacnet/basic/sys/mstimer.h"
#include "led.h"
#ifndef BDK_VERSION
#define BDK_VERSION 4
#endif
static struct itimer Off_Delay_Timer[MAX_LEDS];
static struct mstimer Off_Delay_Timer[MAX_LEDS];
/*************************************************************************
* Description: Turn on an LED
@@ -65,7 +65,7 @@ void led_on(
break;
}
if (index < MAX_LEDS) {
timer_interval_no_expire(&Off_Delay_Timer[index]);
mstimer_set(&Off_Delay_Timer[index], 0);
}
}
@@ -102,7 +102,7 @@ void led_off(
break;
}
if (index < MAX_LEDS) {
timer_interval_no_expire(&Off_Delay_Timer[index]);
mstimer_set(&Off_Delay_Timer[index], 0);
}
}
@@ -163,7 +163,7 @@ void led_off_delay(
uint32_t delay_ms)
{
if (index < MAX_LEDS) {
timer_interval_start(&Off_Delay_Timer[index], delay_ms);
mstimer_set(&Off_Delay_Timer[index], delay_ms);
}
}
@@ -178,7 +178,7 @@ void led_on_interval(
{
if (index < MAX_LEDS) {
led_on(index);
timer_interval_start(&Off_Delay_Timer[index], interval_ms);
mstimer_set(&Off_Delay_Timer[index], interval_ms);
}
}
@@ -193,8 +193,8 @@ void led_task(
uint8_t i; /* loop counter */
for (i = 0; i < MAX_LEDS; i++) {
if (timer_interval_expired(&Off_Delay_Timer[i])) {
timer_interval_no_expire(&Off_Delay_Timer[i]);
if (mstimer_expired(&Off_Delay_Timer[i])) {
mstimer_set(&Off_Delay_Timer[i], 0);
led_off(i);
}
}
+4 -4
View File
@@ -28,18 +28,18 @@
#include "hardware.h"
#include "init.h"
#include "stack.h"
#include "timer.h"
#include "bacnet/basic/sys/mstimer.h"
#include "input.h"
#include "led.h"
#include "adc.h"
#include "nvdata.h"
#include "timer.h"
#include "bacnet/basic/sys/mstimer.h"
#include "rs485.h"
#include "serial.h"
#include "bacnet.h"
#include "test.h"
#include "watchdog.h"
#include "version.h"
#include "bacnet/version.h"
/* global - currently the version of the stack */
char *BACnet_Version = BACNET_VERSION_TEXT;
@@ -57,7 +57,7 @@ int main(
#else
watchdog_init(0);
#endif
timer_init();
mstimer_init();
adc_init();
input_init();
seeprom_init();
@@ -24,7 +24,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "hardware.h"
#include "timer.h"
#include "bacnet/basic/sys/mstimer.h"
#ifndef F_CPU
#error "F_CPU must be defined for Timer configuration."
@@ -59,7 +59,6 @@
/* counter for the the timer which wraps every 49.7 days */
static volatile uint32_t Millisecond_Counter;
static volatile uint8_t Millisecond_Counter_Byte;
/*************************************************************************
* Description: Timer Interrupt Handler
@@ -72,7 +71,6 @@ static inline void timer_interrupt_handler(
/* Set the counter for the next interrupt */
TCNT2 = TIMER2_COUNT;
Millisecond_Counter++;
Millisecond_Counter_Byte++;
}
/*************************************************************************
@@ -90,10 +88,10 @@ ISR(TIMER2_OVF_vect)
* Returns: none
* Notes: This method only disables the timer overflow interrupt.
*************************************************************************/
uint32_t timer_milliseconds(
unsigned long mstimer_now(
void)
{
uint32_t timer_value; /* return value */
unsigned long timer_value; /* return value */
/* Disable the overflow interrupt.
Prevents value corruption that would happen if interrupted */
@@ -105,23 +103,12 @@ uint32_t timer_milliseconds(
return timer_value;
}
/*************************************************************************
* Description: returns the current millisecond count
* Returns: none
* Notes: This method only disables the timer overflow interrupt.
*************************************************************************/
uint8_t timer_milliseconds_byte(
void)
{
return Millisecond_Counter;
}
/*************************************************************************
* Description: Initialization for Timer
* Returns: none
* Notes: none
*************************************************************************/
void timer_init(
void mstimer_init(
void)
{
/* Normal Operation */
+7 -7
View File
@@ -25,8 +25,8 @@
#include <stdint.h>
#include <stdlib.h>
#include "hardware.h"
#include "fifo.h"
#include "timer.h"
#include "bacnet/basic/sys/fifo.h"
#include "bacnet/basic/sys/mstimer.h"
#include "led.h"
#include "nvdata.h"
/* me */
@@ -51,7 +51,7 @@ static uint32_t Baud_Rate = 9600;
static uint8_t Receive_Buffer_Data[128];
static FIFO_BUFFER Receive_Buffer;
static struct etimer Silence_Timer;
static struct mstimer Silence_Timer;
/****************************************************************************
* DESCRIPTION: Determines the amount of silence time elapsed
@@ -61,7 +61,7 @@ static struct etimer Silence_Timer;
bool rs485_silence_time_elapsed(
uint16_t milliseconds)
{
return timer_elapsed_milliseconds_short(&Silence_Timer, milliseconds);
return (mstimer_remaining(&Silence_Timer) > milliseconds);
}
/****************************************************************************
@@ -72,7 +72,7 @@ bool rs485_silence_time_elapsed(
void rs485_silence_time_reset(
void)
{
timer_elapsed_start(&Silence_Timer);
mstimer_set(&Silence_Timer, 0);
}
/****************************************************************************
@@ -226,7 +226,7 @@ void rs485_bytes_send(
}
/* Clear the Transmit Complete flag by writing a one to it. */
BIT_SET(UCSR0A, TXC0);
timer_elapsed_start(&Silence_Timer);
rs485_silence_time_reset();
led_off_delay(LED_5, 1);
return;
@@ -363,7 +363,7 @@ void rs485_init(
{
FIFO_Init(&Receive_Buffer, &Receive_Buffer_Data[0],
(unsigned) sizeof(Receive_Buffer_Data));
timer_elapsed_start(&Silence_Timer);
rs485_silence_time_reset();
rs485_rts_init();
rs485_usart_init();
rs485_init_nvdata();
+1 -1
View File
@@ -25,7 +25,7 @@
#include <stdint.h>
#include <stdlib.h>
#include "hardware.h"
#include "fifo.h"
#include "bacnet/basic/sys/fifo.h"
#include "serial.h"
/* baud rate */
+9 -9
View File
@@ -26,12 +26,12 @@
#include <stdbool.h>
#include <string.h>
#include "hardware.h"
#include "timer.h"
#include "bacnet/basic/sys/mstimer.h"
#include "serial.h"
#include "input.h"
#include "bo.h"
#include "bacnet/basic/object/bo.h"
#include "rs485.h"
#include "dlmstp.h"
#include "bacnet/datalink/dlmstp.h"
#include "seeprom.h"
#include "nvdata.h"
/* me */
@@ -47,7 +47,7 @@ const char * const binary_string[BINARY_STRING_MAX] = {
};
/* timer for test task */
static struct itimer Test_Timer;
static struct mstimer Test_Timer;
/* MAC Address of MS/TP */
static uint8_t MSTP_MAC_Address;
@@ -59,7 +59,7 @@ void test_init(
#else
serial_baud_rate_set(9600);
#endif
timer_interval_start_seconds(&Test_Timer, 1);
mstimer_set(&Test_Timer, 1*1000);
/* configure a port pin as output */
#if (BDK_VERSION==4)
BIT_SET(DDRD, DDB5);
@@ -147,8 +147,8 @@ static inline void test_pin_toggle(
void test_task(
void)
{
if (timer_interval_expired(&Test_Timer)) {
timer_interval_reset(&Test_Timer);
if (mstimer_expired(&Test_Timer)) {
mstimer_reset(&Test_Timer);
MSTP_MAC_Address = MSTP_MAC_Address;
}
}
@@ -161,8 +161,8 @@ void test_task(
uint8_t data_register = 0;
uint16_t id = 0;
if (timer_interval_expired(&Test_Timer)) {
timer_interval_reset(&Test_Timer);
if (mstimer_expired(&Test_Timer)) {
mstimer_reset(&Test_Timer);
sprintf(Send_Buffer, "BACnet: 0000000\r\n");
MSTP_MAC_Address = input_address();
Send_Buffer[8] = (MSTP_MAC_Address & BIT0) ? '1' : '0';
-431
View File
@@ -1,431 +0,0 @@
/**************************************************************************
*
* Copyright (C) 2009 Steve Karg <skarg@users.sourceforge.net>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*********************************************************************/
#include <stdbool.h>
#include <stdint.h>
#include "timer.h"
/* generic elapsed timer handling */
/* interval not to exceed 49.7 days */
/* interval of 1ms may be 0 to 1ms */
/*************************************************************************
* Description: Sets the start time for an elapsed timer
* Returns: the value of the start timer
* Notes: none
*************************************************************************/
void timer_elapsed_start(
struct etimer *t)
{
uint32_t now = timer_milliseconds();
if (t) {
t->start = now;
}
}
/*************************************************************************
* Description: Gets the amount of elapsed time in milliseconds
* Returns: elapsed time in milliseconds
* Notes: none
*************************************************************************/
uint32_t timer_elapsed_time(
struct etimer *t)
{
uint32_t now = timer_milliseconds();
uint32_t delta = 0;
if (t) {
delta = now - t->start;
}
return delta;
}
/*************************************************************************
* Description: Sets the start time with an offset
* Returns: elapsed time in milliseconds
* Notes: none
*************************************************************************/
void timer_elapsed_start_offset(
struct etimer *t,
uint32_t offset)
{
uint32_t now = timer_milliseconds();
if (t) {
t->start = now + offset;
}
}
/*************************************************************************
* Description: Tests to see if time has elapsed
* Returns: true if time has elapsed
* Notes: none
*************************************************************************/
bool timer_elapsed_milliseconds(
struct etimer *t,
uint32_t milliseconds)
{
return (timer_elapsed_time(t) >= milliseconds);
}
/*************************************************************************
* Description: Tests to see if time has elapsed
* Returns: true if time has elapsed
* Notes: none
*************************************************************************/
bool timer_elapsed_seconds(
struct etimer * t,
uint32_t seconds)
{
uint32_t milliseconds = seconds;
milliseconds *= 1000L;
return timer_elapsed_milliseconds(t, milliseconds);
}
/*************************************************************************
* Description: Tests to see if time has elapsed
* Returns: true if time has elapsed
* Notes: none
*************************************************************************/
bool timer_elapsed_minutes(
struct etimer * t,
uint32_t minutes)
{
uint32_t milliseconds = minutes;
milliseconds *= 1000L;
milliseconds *= 60L;
return timer_elapsed_milliseconds(t, milliseconds);
}
/*************************************************************************
* Description: Tests to see if time has elapsed
* Returns: true if time has elapsed
* Notes: none
*************************************************************************/
bool timer_elapsed_milliseconds_short(
struct etimer * t,
uint16_t value)
{
uint32_t milliseconds;
milliseconds = value;
return (timer_elapsed_time(t) >= milliseconds);
}
/*************************************************************************
* Description: Tests to see if time has elapsed
* Returns: true if time has elapsed
* Notes: none
*************************************************************************/
bool timer_elapsed_seconds_short(
struct etimer * t,
uint16_t value)
{
return timer_elapsed_seconds(t, value);
}
/*************************************************************************
* Description: Tests to see if time has elapsed
* Returns: true if time has elapsed
* Notes: none
*************************************************************************/
bool timer_elapsed_minutes_short(
struct etimer * t,
uint16_t value)
{
return timer_elapsed_minutes(t, value);
}
/*************************************************************************
* Description: Starts an interval timer
* Returns: nothing
* Notes: none
*************************************************************************/
void timer_interval_start(
struct itimer *t,
uint32_t interval)
{
if (t) {
t->start = timer_milliseconds();
t->interval = interval;
}
}
/*************************************************************************
* Description: Starts an interval timer
* Returns: nothing
* Notes: none
*************************************************************************/
void timer_interval_start_seconds(
struct itimer *t,
uint32_t seconds)
{
uint32_t interval = seconds;
interval *= 1000L;
timer_interval_start(t, interval);
}
/*************************************************************************
* Description: Starts an interval timer
* Returns: nothing
* Notes: none
*************************************************************************/
void timer_interval_start_minutes(
struct itimer *t,
uint32_t minutes)
{
uint32_t interval = minutes;
interval *= 1000L;
interval *= 60L;
timer_interval_start(t, interval);
}
/*************************************************************************
* Description: Determines the amount of time that has elapsed
* Returns: elapsed milliseconds
* Notes: none
*************************************************************************/
uint32_t timer_interval_elapsed(
struct itimer *t)
{
uint32_t now = timer_milliseconds();
uint32_t delta = 0;
if (t) {
delta = now - t->start;
}
return delta;
}
/*************************************************************************
* Description: Determines the amount of time that has elapsed
* Returns: elapsed milliseconds
* Notes: none
*************************************************************************/
uint32_t timer_interval(
struct itimer * t)
{
uint32_t interval = 0;
if (t) {
interval = t->interval;
}
return interval;
}
/*************************************************************************
* Description: Tests to see if time has elapsed
* Returns: true if time has elapsed
* Notes: none
*************************************************************************/
bool timer_interval_expired(
struct itimer * t)
{
bool expired = false;
if (t) {
if (t->interval) {
expired = timer_interval_elapsed(t) >= t->interval;
}
}
return expired;
}
/*************************************************************************
* Description: Sets the interval value to zero so it never expires
* Returns: nothing
* Notes: none
*************************************************************************/
void timer_interval_no_expire(
struct itimer *t)
{
if (t) {
t->interval = 0;
}
}
/*************************************************************************
* Description: Adds another interval to the start time. Used for cyclic
* timers that won't lose ticks.
* Returns: nothing
* Notes: none
*************************************************************************/
void timer_interval_reset(
struct itimer *t)
{
if (t) {
t->start += t->interval;
}
}
/*************************************************************************
* Description: Restarts the timer with the same interval
* Returns: nothing
* Notes: none
*************************************************************************/
void timer_interval_restart(
struct itimer *t)
{
if (t) {
t->start = timer_milliseconds();
}
}
/*************************************************************************
* Description: Return the elapsed time
* Returns: number of milliseconds elapsed
* Notes: only up to 255ms elapsed
**************************************************************************/
uint8_t timer_milliseconds_delta(
uint8_t start)
{
return (timer_milliseconds_byte() - start);
}
/*************************************************************************
* Description: Mark the start of a delta timer
* Returns: mark timer starting tick
* Notes: only up to 255ms elapsed
**************************************************************************/
uint8_t timer_milliseconds_mark(
void)
{
return timer_milliseconds_byte();
}
#ifdef TEST
#include <assert.h>
#include <string.h>
#include "ctest.h"
static uint32_t Milliseconds;
uint32_t timer_milliseconds(
void)
{
return Milliseconds;
}
uint32_t timer_milliseconds_set(
uint32_t value)
{
uint32_t old_value = Milliseconds;
Milliseconds = value;
return old_value;
}
void testElapsedTimer(
Test * pTest)
{
struct etimer t;
uint32_t test_time = 0;
timer_milliseconds_set(test_time);
timer_elapsed_start(&t);
ct_test(pTest, timer_elapsed_time(&t) == test_time);
test_time = 0xffff;
timer_milliseconds_set(test_time);
ct_test(pTest, timer_elapsed_time(&t) == test_time);
test_time = 0xffffffff;
timer_milliseconds_set(test_time);
ct_test(pTest, timer_elapsed_time(&t) == test_time);
}
void testIntervalTimer(
Test * pTest)
{
struct itimer t;
uint32_t interval = 0;
uint32_t test_time = 0;
timer_milliseconds_set(test_time);
timer_interval_start(&t, interval);
test_time = 0xffff;
timer_milliseconds_set(test_time);
ct_test(pTest, timer_interval(&t) == interval);
ct_test(pTest, timer_interval_elapsed(&t) == test_time);
test_time = 0xffffffff;
timer_milliseconds_set(test_time);
ct_test(pTest, timer_interval(&t) == interval);
ct_test(pTest, timer_interval_elapsed(&t) == test_time);
test_time = 0;
timer_milliseconds_set(test_time);
interval = 0xffff;
timer_interval_start(&t, interval);
ct_test(pTest, timer_interval(&t) == interval);
interval = 0xffffffff;
timer_interval_start(&t, interval);
ct_test(pTest, timer_interval(&t) == interval);
interval = 0;
timer_interval_start_seconds(&t, interval);
ct_test(pTest, timer_interval(&t) == interval);
interval = 60L;
timer_interval_start_seconds(&t, interval);
interval *= 1000L;
ct_test(pTest, timer_interval(&t) == interval);
}
#ifdef TEST_TIMER
int main(
void)
{
Test *pTest;
bool rc;
pTest = ct_create("Timer", NULL);
/* individual tests */
rc = ct_addTestFunction(pTest, testElapsedTimer);
assert(rc);
rc = ct_addTestFunction(pTest, testIntervalTimer);
assert(rc);
ct_setStream(pTest, stdout);
ct_run(pTest);
(void) ct_report(pTest);
ct_destroy(pTest);
return 0;
}
#endif
#endif
-115
View File
@@ -1,115 +0,0 @@
/**************************************************************************
*
* Copyright (C) 2009 Steve Karg <skarg@users.sourceforge.net>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*********************************************************************/
#ifndef TIMER_H
#define TIMER_H
#include <stdbool.h>
#include <stdint.h>
/* Timer Module */
/* elapsed timer structure */
struct etimer {
uint32_t start;
};
/* interval timer structure */
struct itimer {
uint32_t start;
uint32_t interval;
};
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* these 3 functions are created in the hardware specific module */
void timer_init(
void);
uint32_t timer_milliseconds(
void);
uint8_t timer_milliseconds_byte(
void);
/* these functions are in the generic timer.c module */
/* elapsed timer */
void timer_elapsed_start(
struct etimer *t);
void timer_elapsed_start_offset(
struct etimer *t,
uint32_t offset);
uint32_t timer_elapsed_time(
struct etimer *t);
bool timer_elapsed_milliseconds(
struct etimer *t,
uint32_t value);
bool timer_elapsed_seconds(
struct etimer *t,
uint32_t value);
bool timer_elapsed_minutes(
struct etimer *t,
uint32_t value);
bool timer_elapsed_milliseconds_short(
struct etimer *t,
uint16_t value);
bool timer_elapsed_seconds_short(
struct etimer *t,
uint16_t value);
bool timer_elapsed_minutes_short(
struct etimer *t,
uint16_t value);
/* interval timer */
void timer_interval_start(
struct itimer *t,
uint32_t interval);
void timer_interval_start_seconds(
struct itimer *t,
uint32_t interval);
void timer_interval_start_minutes(
struct itimer *t,
uint32_t interval);
bool timer_interval_expired(
struct itimer *t);
uint32_t timer_interval(
struct itimer *t);
uint32_t timer_interval_elapsed(
struct itimer *t);
void timer_interval_no_expire(
struct itimer *t);
void timer_interval_reset(
struct itimer *t);
void timer_interval_restart(
struct itimer *t);
/* special for 8-bit microcontrollers - limited to 255ms */
uint8_t timer_milliseconds_delta(
uint8_t start);
uint8_t timer_milliseconds_mark(
void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif