diff --git a/build/macosx/Arduino.xcodeproj/project.pbxproj b/build/macosx/Arduino.xcodeproj/project.pbxproj
index 596240bee..0fcaec67c 100644
--- a/build/macosx/Arduino.xcodeproj/project.pbxproj
+++ b/build/macosx/Arduino.xcodeproj/project.pbxproj
@@ -168,7 +168,6 @@
/* End PBXApplicationTarget section */
/* Begin PBXBuildFile section */
- 330B21540968180400345666 /* librxtxSerial.jnilib in CopyFiles */ = {isa = PBXBuildFile; fileRef = 330B21530968180400345666 /* librxtxSerial.jnilib */; };
332D4DB609CF147F00BF81F6 /* Sizer.java in Sources */ = {isa = PBXBuildFile; fileRef = 332D4DB509CF147F00BF81F6 /* Sizer.java */; };
336EA55B09FF87F60052D765 /* examples in CopyFiles */ = {isa = PBXBuildFile; fileRef = 336EA4DB09FF87E30052D765 /* examples */; };
338C478A0AA204BE008F2C0D /* FTDIUSBSerialDriver_v2_1_6.dmg in CopyFiles */ = {isa = PBXBuildFile; fileRef = 338C47870AA204B0008F2C0D /* FTDIUSBSerialDriver_v2_1_6.dmg */; };
@@ -411,16 +410,13 @@
339514FA097AEB8000193C89 /* license.txt in CopyFiles */,
339514FB097AEB8000193C89 /* readme.txt in CopyFiles */,
33FF07050965BEE60016AC38 /* macosx_setup.command in CopyFiles */,
- 330B21540968180400345666 /* librxtxSerial.jnilib in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
- 330B21530968180400345666 /* librxtxSerial.jnilib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.bundle"; path = librxtxSerial.jnilib; sourceTree = ""; };
332D4DB509CF147F00BF81F6 /* Sizer.java */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.java; path = Sizer.java; sourceTree = ""; };
- 333269E1099BB1FC007D3AE2 /* tools.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = tools.zip; sourceTree = ""; };
336EA4DB09FF87E30052D765 /* examples */ = {isa = PBXFileReference; lastKnownFileType = folder; path = examples; sourceTree = ""; };
337CD3F309EFC183002B890C /* fetch.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = fetch.sh; sourceTree = ""; };
338C47870AA204B0008F2C0D /* FTDIUSBSerialDriver_v2_1_6.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = FTDIUSBSerialDriver_v2_1_6.dmg; sourceTree = ""; };
@@ -987,8 +983,6 @@
33FFFEAC0965BD110016AC38 /* dist */ = {
isa = PBXGroup;
children = (
- 333269E1099BB1FC007D3AE2 /* tools.zip */,
- 330B21530968180400345666 /* librxtxSerial.jnilib */,
33FFFEAE0965BD110016AC38 /* bootloader */,
33FFFEB20965BD110016AC38 /* drivers */,
33FFFEB50965BD110016AC38 /* DS_Store */,
@@ -1078,7 +1072,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "unzip -od $BUILT_PRODUCTS_DIR dist/tools-ppc.zip";
+ shellScript = "unzip -od $BUILT_PRODUCTS_DIR dist/tools-ppc.zip\ncp dist/librxtxSerial-ppc.jnilib $BUILT_PRODUCTS_DIR/librxtxSerial.jnilib";
};
3318B11A0AD6CE9F00FE1A05 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -1091,7 +1085,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "unzip -od $BUILT_PRODUCTS_DIR dist/tools-intel.zip";
+ shellScript = "unzip -od $BUILT_PRODUCTS_DIR dist/tools-intel.zip\ncp dist/librxtxSerial-intel.jnilib $BUILT_PRODUCTS_DIR/librxtxSerial.jnilib";
};
3318B1520AD6D1EB00FE1A05 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
diff --git a/build/macosx/dist/librxtxSerial-intel.jnilib b/build/macosx/dist/librxtxSerial-intel.jnilib
new file mode 100755
index 000000000..8a1a7f70f
Binary files /dev/null and b/build/macosx/dist/librxtxSerial-intel.jnilib differ
diff --git a/build/macosx/dist/librxtxSerial-ppc.jnilib b/build/macosx/dist/librxtxSerial-ppc.jnilib
new file mode 100755
index 000000000..d85050567
Binary files /dev/null and b/build/macosx/dist/librxtxSerial-ppc.jnilib differ
diff --git a/build/macosx/dist/librxtxSerial.jnilib b/build/macosx/dist/librxtxSerial.jnilib
deleted file mode 100644
index 2d3f20d6d..000000000
Binary files a/build/macosx/dist/librxtxSerial.jnilib and /dev/null differ
diff --git a/build/macosx/dist/tools-intel.zip b/build/macosx/dist/tools-intel.zip
index 78d65e6e6..edec369e6 100644
Binary files a/build/macosx/dist/tools-intel.zip and b/build/macosx/dist/tools-intel.zip differ
diff --git a/build/shared/lib/avrlib/a2d.c b/build/shared/lib/avrlib/a2d.c
deleted file mode 100755
index a8b6f3df6..000000000
--- a/build/shared/lib/avrlib/a2d.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*! \file a2d.c \brief Analog-to-Digital converter function library. */
-//*****************************************************************************
-//
-// File Name : 'a2d.c'
-// Title : Analog-to-digital converter functions
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 2002-04-08
-// Revised : 2002-09-30
-// Version : 1.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "global.h"
-#include "a2d.h"
-
-// global variables
-
-//! software flag used to indicate when
-//! the a2d conversion is complete
-volatile unsigned char a2dCompleteFlag;
-
-// functions
-
-//! initialize a2d converter
-void a2dInit(void)
-{
- sbi(ADCSR, ADEN); // enable ADC (turn on ADC power)
- cbi(ADCSR, ADFR); // default to single sample convert mode
- a2dSetPrescaler(ADC_PRESCALE); // set default prescaler
- a2dSetReference(ADC_REFERENCE); // set default reference
- cbi(ADMUX, ADLAR); // set to right-adjusted result
-
- sbi(ADCSR, ADIE); // enable ADC interrupts
-
- a2dCompleteFlag = FALSE; // clear conversion complete flag
- sei(); // turn on interrupts (if not already on)
-}
-
-//! turn off a2d converter
-void a2dOff(void)
-{
- cbi(ADCSR, ADIE); // disable ADC interrupts
- cbi(ADCSR, ADEN); // disable ADC (turn off ADC power)
-}
-
-//! configure A2D converter clock division (prescaling)
-void a2dSetPrescaler(unsigned char prescale)
-{
- outb(ADCSR, ((inb(ADCSR) & ~ADC_PRESCALE_MASK) | prescale));
-}
-
-//! configure A2D converter voltage reference
-void a2dSetReference(unsigned char ref)
-{
- outb(ADMUX, ((inb(ADMUX) & ~ADC_REFERENCE_MASK) | (ref<<6)));
-}
-
-//! sets the a2d input channel
-void a2dSetChannel(unsigned char ch)
-{
- outb(ADMUX, (inb(ADMUX) & ~ADC_MUX_MASK) | (ch & ADC_MUX_MASK)); // set channel
-}
-
-//! start a conversion on the current a2d input channel
-void a2dStartConvert(void)
-{
- sbi(ADCSR, ADIF); // clear hardware "conversion complete" flag
- sbi(ADCSR, ADSC); // start conversion
-}
-
-//! return TRUE if conversion is complete
-u08 a2dIsComplete(void)
-{
- return bit_is_set(ADCSR, ADSC);
-}
-
-//! Perform a 10-bit conversion
-// starts conversion, waits until conversion is done, and returns result
-unsigned short a2dConvert10bit(unsigned char ch)
-{
- a2dCompleteFlag = FALSE; // clear conversion complete flag
- outb(ADMUX, (inb(ADMUX) & ~ADC_MUX_MASK) | (ch & ADC_MUX_MASK)); // set channel
- sbi(ADCSR, ADIF); // clear hardware "conversion complete" flag
- sbi(ADCSR, ADSC); // start conversion
- //while(!a2dCompleteFlag); // wait until conversion complete
- //while( bit_is_clear(ADCSR, ADIF) ); // wait until conversion complete
- while( bit_is_set(ADCSR, ADSC) ); // wait until conversion complete
-
- // CAUTION: MUST READ ADCL BEFORE ADCH!!!
- return (inb(ADCL) | (inb(ADCH)<<8)); // read ADC (full 10 bits);
-}
-
-//! Perform a 8-bit conversion.
-// starts conversion, waits until conversion is done, and returns result
-unsigned char a2dConvert8bit(unsigned char ch)
-{
- // do 10-bit conversion and return highest 8 bits
- return a2dConvert10bit(ch)>>2; // return ADC MSB byte
-}
-
-//! interrupt handler for ADC complete interrupt
-SIGNAL(SIG_ADC)
-{
- // set the a2d conversion flag to indicate "complete"
- a2dCompleteFlag = TRUE;
-}
-
diff --git a/build/shared/lib/avrlib/a2d.h b/build/shared/lib/avrlib/a2d.h
deleted file mode 100755
index 2cf249550..000000000
--- a/build/shared/lib/avrlib/a2d.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*! \file a2d.h \brief Analog-to-Digital converter function library. */
-//*****************************************************************************
-//
-// File Name : 'a2d.h'
-// Title : Analog-to-digital converter functions
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 4/08/2002
-// Revised : 4/30/2002
-// Version : 1.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef A2D_H
-#define A2D_H
-
-// defines
-
-// A2D clock prescaler select
-// *selects how much the CPU clock frequency is divided
-// to create the A2D clock frequency
-// *lower division ratios make conversion go faster
-// *higher division ratios make conversions more accurate
-#define ADC_PRESCALE_DIV2 0x00 ///< 0x01,0x00 -> CPU clk/2
-#define ADC_PRESCALE_DIV4 0x02 ///< 0x02 -> CPU clk/4
-#define ADC_PRESCALE_DIV8 0x03 ///< 0x03 -> CPU clk/8
-#define ADC_PRESCALE_DIV16 0x04 ///< 0x04 -> CPU clk/16
-#define ADC_PRESCALE_DIV32 0x05 ///< 0x05 -> CPU clk/32
-#define ADC_PRESCALE_DIV64 0x06 ///< 0x06 -> CPU clk/64
-#define ADC_PRESCALE_DIV128 0x07 ///< 0x07 -> CPU clk/128
-// default value
-#define ADC_PRESCALE ADC_PRESCALE_DIV64
-// do not change the mask value
-#define ADC_PRESCALE_MASK 0x07
-
-// A2D voltage reference select
-// *this determines what is used as the
-// full-scale voltage point for A2D conversions
-#define ADC_REFERENCE_AREF 0x00 ///< 0x00 -> AREF pin, internal VREF turned off
-#define ADC_REFERENCE_AVCC 0x01 ///< 0x01 -> AVCC pin, internal VREF turned off
-#define ADC_REFERENCE_RSVD 0x02 ///< 0x02 -> Reserved
-#define ADC_REFERENCE_256V 0x03 ///< 0x03 -> Internal 2.56V VREF
-// default value
-#define ADC_REFERENCE ADC_REFERENCE_AVCC
-// do not change the mask value
-#define ADC_REFERENCE_MASK 0xC0
-
-// bit mask for A2D channel multiplexer
-#define ADC_MUX_MASK 0x1F
-
-// channel defines (for reference and use in code)
-// these channels supported by all AVRs with A2D
-#define ADC_CH_ADC0 0x00
-#define ADC_CH_ADC1 0x01
-#define ADC_CH_ADC2 0x02
-#define ADC_CH_ADC3 0x03
-#define ADC_CH_ADC4 0x04
-#define ADC_CH_ADC5 0x05
-#define ADC_CH_ADC6 0x06
-#define ADC_CH_ADC7 0x07
-#define ADC_CH_122V 0x1E ///< 1.22V voltage reference
-#define ADC_CH_AGND 0x1F ///< AGND
-// these channels supported only in ATmega128
-// differential with gain
-#define ADC_CH_0_0_DIFF10X 0x08
-#define ADC_CH_1_0_DIFF10X 0x09
-#define ADC_CH_0_0_DIFF200X 0x0A
-#define ADC_CH_1_0_DIFF200X 0x0B
-#define ADC_CH_2_2_DIFF10X 0x0C
-#define ADC_CH_3_2_DIFF10X 0x0D
-#define ADC_CH_2_2_DIFF200X 0x0E
-#define ADC_CH_3_2_DIFF200X 0x0F
-// differential
-#define ADC_CH_0_1_DIFF1X 0x10
-#define ADC_CH_1_1_DIFF1X 0x11
-#define ADC_CH_2_1_DIFF1X 0x12
-#define ADC_CH_3_1_DIFF1X 0x13
-#define ADC_CH_4_1_DIFF1X 0x14
-#define ADC_CH_5_1_DIFF1X 0x15
-#define ADC_CH_6_1_DIFF1X 0x16
-#define ADC_CH_7_1_DIFF1X 0x17
-
-#define ADC_CH_0_2_DIFF1X 0x18
-#define ADC_CH_1_2_DIFF1X 0x19
-#define ADC_CH_2_2_DIFF1X 0x1A
-#define ADC_CH_3_2_DIFF1X 0x1B
-#define ADC_CH_4_2_DIFF1X 0x1C
-#define ADC_CH_5_2_DIFF1X 0x1D
-
-// compatibility for new Mega processors
-// ADCSR hack apparently no longer necessary in new AVR-GCC
-#ifdef ADCSRA
-#ifndef ADCSR
- #define ADCSR ADCSRA
-#endif
-#endif
-#ifdef ADATE
- #define ADFR ADATE
-#endif
-
-// function prototypes
-
-//! Initializes the A/D converter
-// (turns ADC on and prepares it for use)
-void a2dInit(void);
-
-//! Turn off A/D converter
-void a2dOff(void);
-
-//! sets the division ratio of the A/D converter clock
-// this function is automatically called from a2dInit()
-// with a default value
-void a2dSetPrescaler(unsigned char prescale);
-
-//! configures which voltage reference the A/D converter uses
-// this function is automatically called from a2dInit()
-// with a default value
-void a2dSetReference(unsigned char ref);
-
-//! sets the a2d input channel
-void a2dSetChannel(unsigned char ch);
-
-//! start a conversion on the current a2d input channel
-void a2dStartConvert(void);
-
-//! return TRUE if conversion is complete
-u08 a2dIsComplete(void);
-
-//! starts a conversion on A/D channel# ch,
-// returns the 10-bit value of the conversion when it is finished
-unsigned short a2dConvert10bit(unsigned char ch);
-
-//! starts a conversion on A/D channel# ch,
-// returns the 8-bit value of the conversion when it is finished
-unsigned char a2dConvert8bit(unsigned char ch);
-
-#endif
diff --git a/build/shared/lib/avrlib/ads7828.c b/build/shared/lib/avrlib/ads7828.c
deleted file mode 100755
index 3e164b5bb..000000000
--- a/build/shared/lib/avrlib/ads7828.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*! \file ads7828.c \brief TI ADS7828 12-bit 8ch A/D Converter Driver Library. */
-//*****************************************************************************
-//
-// File Name : 'ads7828.c'
-// Title : TI ADS7828 12-bit 8ch A/D Converter Driver Library
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.02.10
-// Revised : 2004.02.19
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "global.h"
-#include "i2c.h"
-#include "ads7828.h"
-
-// global variables
-u08 Ads7282RefMode;
-
-// Functions
-u08 ads7828Init(u08 i2cAddr)
-{
- u08 channel = 0x80;
-
- // setup default A/D voltage reference
- ads7828SetReference(0);
-
- // issue a convserion to test chip presence
- // return TRUE if chip detected
- // return FALSE if chip does not respond
- return (i2cMasterSendNI(i2cAddr, 1, &channel) == I2C_OK);
-}
-
-u16 ads7828Convert(u08 i2cAddr, u08 channel)
-{
- // re-order channel bits for
- // logical single-ended channel selection
- // channel bit0 -> C2
- // channel bit1 -> C0
- // channel bit2 -> C1
- channel = (((channel>>1) | (channel&0x01)<<2)<<4) | ADS7828_CMD_SD;
- // do conversion
- return ads7828ConvertRaw(i2cAddr, channel);
-}
-
-u16 ads7828ConvertDiff(u08 i2cAddr, u08 channel)
-{
- // clear single-ended channel bit
- channel = (channel&0x07)<<4;
- // do conversion
- return ads7828ConvertRaw(i2cAddr, channel);
-}
-
-u16 ads7828ConvertRaw(u08 i2cAddr, u08 channel)
-{
- u08 buffer[2];
- // combine raw channel and reference bits
- channel &= 0xF0;
- channel |= Ads7282RefMode;
- // start conversion on requested channel
- i2cMasterSendNI(i2cAddr, 1, &channel);
- // retrieve conversion result
- i2cMasterReceiveNI(i2cAddr, 2, buffer);
- // pack bytes and return result
- return ((buffer[0]<<8) | buffer[1]);
-}
-
-void ads7828SetReference(u08 ref)
-{
- if(ref)
- {
- // use internal reference
- Ads7282RefMode = ADS7828_CMD_PDMODE2;
- }
- else
- {
- // use external reference
- Ads7282RefMode = ADS7828_CMD_PDMODE0;
- }
-}
diff --git a/build/shared/lib/avrlib/ads7828.h b/build/shared/lib/avrlib/ads7828.h
deleted file mode 100755
index 43bf79b58..000000000
--- a/build/shared/lib/avrlib/ads7828.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*! \file ads7828.h \brief TI ADS7828 12-bit 8ch A/D Converter Driver Library. */
-//*****************************************************************************
-//
-// File Name : 'ads7828.h'
-// Title : TI ADS7828 12-bit 8ch A/D Converter Driver Library
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.02.10
-// Revised : 2004.02.19
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef ADS7828_H
-#define ADS7828_H
-
-#include "global.h"
-
-// constants/macros/typdefs
-#define ADS7828_I2C_ADDR 0x90 //< Base I2C address of ADS7828 devices
-
-// command register bit defines
-#define ADS7828_CMD_PD0 0x04 //< ADS7828 Power-down bit 0
-#define ADS7828_CMD_PD1 0x08 //< ADS7828 Power-down bit 1
-#define ADS7828_CMD_C0 0x10 //< ADS7828 Channel Select bit 0
-#define ADS7828_CMD_C1 0x20 //< ADS7828 Channel Select bit 1
-#define ADS7828_CMD_C2 0x40 //< ADS7828 Channel Select bit 2
-#define ADS7828_CMD_SD 0x80 //< ADS7828 Single-ended/Differential Select bit
-
-// single-ended channel order defines
-#define ADS7828_CMD_CH0 0x00 //< ADS7828 Convert Channel 0
-#define ADS7828_CMD_CH1 0x04 //< ADS7828 Convert Channel 1
-#define ADS7828_CMD_CH2 0x01 //< ADS7828 Convert Channel 2
-#define ADS7828_CMD_CH3 0x05 //< ADS7828 Convert Channel 3
-#define ADS7828_CMD_CH4 0x02 //< ADS7828 Convert Channel 4
-#define ADS7828_CMD_CH5 0x06 //< ADS7828 Convert Channel 5
-#define ADS7828_CMD_CH6 0x03 //< ADS7828 Convert Channel 6
-#define ADS7828_CMD_CH7 0x07 //< ADS7828 Convert Channel 7
-
-// power-down mode defines
-#define ADS7828_CMD_PDMODE0 0x00 //< ADS7828 Power-down Mode 0
-#define ADS7828_CMD_PDMODE1 0x04 //< ADS7828 Power-down Mode 1
-#define ADS7828_CMD_PDMODE2 0x08 //< ADS7828 Power-down Mode 2
-#define ADS7828_CMD_PDMODE3 0x0C //< ADS7828 Power-down Mode 3
-
-// functions
-
-//! Initialize the ADS7828 chip
-// returns:
-// TRUE if successful
-// FALSE if unsuccessful (chip not present)
-u08 ads7828Init(u08 i2cAddr);
-
-//! Set the voltage reference to use for A/D conversion
-// ref = 0 => External reference voltage on Ref pin
-// ref = 1 => Internal 2.5V reference voltage (Ref pin left open)
-void ads7828SetReference(u08 ref);
-
-//! Begin single-ended conversion on given logical channel#, and return result
-u16 ads7828Convert(u08 i2cAddr, u08 channel);
-
-//! Begin differential conversion on given channel pair, and return result
-u16 ads7828ConvertDiff(u08 i2cAddr, u08 channel);
-
-//! Begin conversion on given raw channel#, and return result
-u16 ads7828ConvertRaw(u08 i2cAddr, u08 channel);
-
-#endif
diff --git a/build/shared/lib/avrlib/ata.c b/build/shared/lib/avrlib/ata.c
deleted file mode 100755
index 8f3f63e33..000000000
--- a/build/shared/lib/avrlib/ata.c
+++ /dev/null
@@ -1,606 +0,0 @@
-/*! \file ata.c \brief IDE-ATA hard disk interface driver. */
-//*****************************************************************************
-//
-// File Name : 'ata.c'
-// Title : IDE-ATA interface driver for hard disks
-// Author : Pascal Stang
-// Date : 11/22/2000
-// Revised : 4/19/2003
-// Version : 0.3
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
- #include
- #include
- #include
- #include
-// #include
-#endif
-#include "global.h"
-#include "timer.h"
-#include "rprintf.h"
-
-#include "ata.h"
-
-//#define DEBUG_ATA 1
-
-// global variables
-
-// drive information
-typeDriveInfo ataDriveInfo;
-
-
-void ataInit(void)
-{
-
-}
-
-void ataDriveInit(void)
-{
- u08 i;
- unsigned char* buffer = (unsigned char*) SECTOR_BUFFER_ADDR;
-
- // read drive identity
- rprintfProgStrM("\r\nScanning IDE interface...\r\n");
- // Wait for drive to be ready
- ataStatusWait(ATA_SR_BSY, ATA_SR_BSY);
- // issue identify command
- ataWriteByte(ATA_REG_CMDSTATUS1, 0xEC);
- // wait for drive to request data transfer
- ataStatusWait(ATA_SR_DRQ, ATA_SR_DRQ);
- timerPause(200);
- // read in the data
- ataReadDataBuffer(buffer, 512);
-
- // set local drive info parameters
- ataDriveInfo.cylinders = *( ((unsigned int*) buffer) + ATA_IDENT_CYLINDERS );
- ataDriveInfo.heads = *( ((unsigned int*) buffer) + ATA_IDENT_HEADS );
- ataDriveInfo.sectors = *( ((unsigned int*) buffer) + ATA_IDENT_SECTORS );
- ataDriveInfo.LBAsupport = *( ((unsigned int*) buffer) + ATA_IDENT_FIELDVALID );
- ataDriveInfo.sizeinsectors = *( (unsigned long*) (buffer + ATA_IDENT_LBASECTORS*2) );
- // copy model string
- for(i=0; i<40; i+=2)
- {
- // correct for byte order
- ataDriveInfo.model[i ] = buffer[(ATA_IDENT_MODEL*2) + i + 1];
- ataDriveInfo.model[i+1] = buffer[(ATA_IDENT_MODEL*2) + i ];
- }
- // terminate string
- ataDriveInfo.model[40] = 0;
-
- // process and print info
- if(ataDriveInfo.LBAsupport)
- {
- // LBA support
- rprintf("Drive 0: %dMB ", ataDriveInfo.sizeinsectors/(1000000/512) );
- rprintf("LBA mode -- MODEL: ");
- }
- else
- {
- // CHS, no LBA support
- // calculate drive size
- ataDriveInfo.sizeinsectors = (unsigned long) ataDriveInfo.cylinders*
- ataDriveInfo.heads*ataDriveInfo.sectors;
- rprintf("Drive 0: %dMB ", ataDriveInfo.sizeinsectors/(1000000/512) );
- rprintf("CHS mode C=%d H=%d S=%d -- MODEL: ", ataDriveInfo.cylinders, ataDriveInfo.heads, ataDriveInfo.sectors );
- }
- // print model information
- rprintfStr(ataDriveInfo.model); rprintfCRLF();
-
- // initialize local disk parameters
- //ataDriveInfo.cylinders = ATA_DISKPARM_CLYS;
- //ataDriveInfo.heads = ATA_DISKPARM_HEADS;
- //ataDriveInfo.sectors = ATA_DISKPARM_SECTORS;
-
-}
-
-void ataDiskErr(void)
-{
- unsigned char b;
-
- b = ataReadByte(ATA_REG_ERROR);
- rprintfProgStrM("ATA Error: ");
- rprintfu08(b);
- rprintfCRLF();
-}
-
-void ataSetDrivePowerMode(u08 DriveNo, u08 mode, u08 timeout)
-{
- // select drive
- ataDriveSelect(DriveNo);
- // Wait for drive to be ready
- ataStatusWait(ATA_SR_BSY, ATA_SR_BSY);
-
- // set mode
- switch(mode)
- {
- case ATA_DISKMODE_SPINDOWN: ataWriteByte(ATA_REG_CMDSTATUS1, ATA_CMD_SPINDOWN); break;
- case ATA_DISKMODE_SPINUP: ataWriteByte(ATA_REG_CMDSTATUS1, ATA_CMD_SPINUP); break;
- case ATA_DISKMODE_SETTIMEOUT:
- ataWriteByte(ATA_REG_SECCOUNT, timeout);
- ataWriteByte(ATA_REG_CMDSTATUS1, ATA_CMD_IDLE_5SU);
- break;
- case ATA_DISKMODE_SLEEP: ataWriteByte(ATA_REG_CMDSTATUS1, ATA_CMD_SLEEP); break;
- default:
- break;
- }
-}
-
-void ataPrintSector( u08 *Buffer)
-{
- u08 i;
- u16 j;
- u08 *buf;
- u08 s;
-
- buf = Buffer;
-
- // print the low order address indicies
- rprintfProgStrM(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF\r\n");
- rprintfProgStrM(" ----------------------------------------------- ---- ASCII -----\r\n");
-
- // print the data
- for(j=0; j<0x20; j++)
- {
- // print the high order address index for this line
- rprintfu16(j<<4);
- rprintfProgStrM(" ");
-
- // print the hex data
- for(i=0; i<0x10; i++)
- {
- rprintfu08(buf[(j<<4)+i]);
- rprintfProgStrM(" ");
- }
-
- // leave some space
- rprintfProgStrM(" ");
-
- // print the ascii data
- for(i=0; i<0x10; i++)
- {
- s = buf[(j<<4)+i];
- // make sure character is printable
- if(s >= 0x20)
- {
- rprintfChar(s);
- }
- else
- {
- rprintfChar(0x20);
- }
-
- }
- rprintfCRLF();
- }
-}
-
-void ataReadDataBuffer(u08 *Buffer, u16 numBytes)
-{
- unsigned int i;
-
- //sbi(MCUCR, SRW); // enable RAM waitstate
-
- // read data from drive
- for (i=0; i<(numBytes/16); i++)
- {
- // optimize by reading 16 bytes in-line before looping
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL);
- *Buffer++ = *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH);
- }
- //cbi(MCUCR, SRW); // disable RAM waitstate
-
-}
-
-void ataWriteDataBuffer(u08 *Buffer, u16 numBytes)
-{
- register unsigned char temp;
- unsigned int i;
-
- //sbi(MCUCR, SRW); // enable RAM waitstate
-
- // write data to drive
- for (i=0; i<(numBytes/16); i++)
- {
- // optimize by writing 16 bytes in-line before looping
- // keep byte order correct by using temp register
- temp = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH) = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL) = temp;
- temp = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH) = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL) = temp;
- temp = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH) = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL) = temp;
- temp = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH) = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL) = temp;
- temp = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH) = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL) = temp;
- temp = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH) = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL) = temp;
- temp = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH) = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL) = temp;
- temp = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAH) = *Buffer++;
- *((volatile unsigned char*) ATA_REG_BASE + ATA_REG_DATAL) = temp;
- }
- //cbi(MCUCR, SRW); // disable RAM waitstate
-
-}
-
-u08 ataStatusWait(u08 mask, u08 waitStatus)
-{
- register u08 status;
-
- delay(100);
-
- // wait for desired status
- while( ((status = ataReadByte(ATA_REG_CMDSTATUS1)) & mask) == waitStatus );
-
- return status;
-}
-
-
-unsigned char ataReadSectorsCHS( unsigned char Drive,
- unsigned char Head,
- unsigned int Track,
- unsigned char Sector,
- unsigned int numsectors,
- unsigned char *Buffer)
-{
- unsigned char temp;
-
- // Wait for drive to be ready
- temp = ataStatusWait(ATA_SR_BSY, ATA_SR_BSY);
-
- // Prepare parameters...
- ataWriteByte(ATA_REG_HDDEVSEL, 0xA0+(Drive ? 0x10:00)+Head); // CHS mode/Drive/Head
- ataWriteByte(ATA_REG_CYLHI, Track>>8); // MSB of track
- ataWriteByte(ATA_REG_CYLLO, Track); // LSB of track
- ataWriteByte(ATA_REG_STARTSEC, Sector); // sector
- ataWriteByte(ATA_REG_SECCOUNT, numsectors); // # of sectors
-
- // Issue read sector command...
- ataWriteByte(ATA_REG_CMDSTATUS1, 0x21);
-
- // Wait for drive to be ready
- temp = ataStatusWait(ATA_SR_BSY, ATA_SR_BSY);
-
- if (temp & ATA_SR_ERR)
- {
- rprintfProgStrM("RD ERR\r\n");
- return 1;
- }
-
- // Wait for drive to request data transfer
- ataStatusWait(ATA_SR_DRQ, 0);
-
- // read data from drive
- ataReadDataBuffer(Buffer, 512*numsectors);
-
- // Return the error bit from the status register...
- temp = ataReadByte(ATA_REG_CMDSTATUS1); // read status register
-
- return (temp & ATA_SR_ERR) ? 1:0;
-}
-
-
-unsigned char ataWriteSectorsCHS(unsigned char Drive,
- unsigned char Head,
- unsigned int Track,
- unsigned char Sector,
- unsigned int numsectors,
- unsigned char *Buffer)
-{
- unsigned char temp;
-
- // Wait for drive to be ready
- temp = ataStatusWait(ATA_SR_BSY, ATA_SR_BSY);
-
- // Prepare parameters...
- ataWriteByte(ATA_REG_HDDEVSEL, 0xA0+(Drive ? 0x10:00)+Head); // CHS mode/Drive/Head
- ataWriteByte(ATA_REG_CYLHI, Track>>8); // MSB of track
- ataWriteByte(ATA_REG_CYLLO, Track); // LSB of track
- ataWriteByte(ATA_REG_STARTSEC, Sector); // sector
- ataWriteByte(ATA_REG_SECCOUNT, numsectors); // # of sectors
-
- // Issue write sector command
- ataWriteByte(ATA_REG_CMDSTATUS1, 0x31);
-
- //delay(100);
-
- // Wait for drive to request data transfer
- ataStatusWait(ATA_SR_DRQ, 0);
-
- // write data to drive
- ataWriteDataBuffer(Buffer, 512*numsectors);
-
- // Wait for drive to finish write
- temp = ataStatusWait(ATA_SR_BSY, ATA_SR_BSY);
-
- // check for errors
- if (temp & ATA_SR_ERR)
- {
- rprintfProgStrM("WR ERR\r\n");
- return 1;
- }
-
- // Return the error bit from the status register...
- return (temp & ATA_SR_ERR) ? 1:0;
-}
-
-unsigned char ataReadSectorsLBA( unsigned char Drive,
- unsigned long lba,
- unsigned int numsectors,
- unsigned char *Buffer)
-{
- unsigned int cyl, head, sect;
- unsigned char temp;
-
-#ifdef DEBUG_ATA
- rprintfProgStrM("ATA LBA read ");
- rprintfu32(lba); rprintfProgStrM(" ");
- rprintfu16(numsectors); rprintfProgStrM(" ");
- rprintfu16((unsigned int)Buffer);
- rprintfCRLF();
-#endif
-
- sect = (int) ( lba & 0x000000ffL );
- lba = lba >> 8;
- cyl = (int) ( lba & 0x0000ffff );
- lba = lba >> 16;
- head = ( (int) ( lba & 0x0fL ) ) | ATA_HEAD_USE_LBA;
-
- temp = ataReadSectorsCHS( Drive, head, cyl, sect, numsectors, Buffer );
-
- if(temp)
- ataDiskErr();
- return temp;
-}
-
-unsigned char ataWriteSectorsLBA( unsigned char Drive,
- unsigned long lba,
- unsigned int numsectors,
- unsigned char *Buffer)
-{
- unsigned int cyl, head, sect;
- unsigned char temp;
-
-#ifdef DEBUG_ATA
- rprintfProgStrM("ATA LBA write ");
- rprintfu32(lba); rprintfProgStrM(" ");
- rprintfu16(numsectors); rprintfProgStrM(" ");
- rprintfu16((unsigned int)Buffer);
- rprintfCRLF();
-#endif
-
- sect = (int) ( lba & 0x000000ffL );
- lba = lba >> 8;
- cyl = (int) ( lba & 0x0000ffff );
- lba = lba >> 16;
- head = ( (int) ( lba & 0x0fL ) ) | ATA_HEAD_USE_LBA;
-
- temp = ataWriteSectorsCHS( Drive, head, cyl, sect, numsectors, Buffer );
-
- if(temp)
- ataDiskErr();
- return temp;
-}
-
-
-unsigned char ataReadSectors( unsigned char Drive,
- unsigned long lba,
- unsigned int numsectors,
- unsigned char *Buffer)
-{
- unsigned int cyl, head, sect;
- unsigned char temp;
-
- // check if drive supports native LBA mode
- if(ataDriveInfo.LBAsupport)
- {
- // drive supports using native LBA
- temp = ataReadSectorsLBA(Drive, lba, numsectors, Buffer);
- }
- else
- {
- // drive required CHS access
- #ifdef DEBUG_ATA
- // do this defore destroying lba
- rprintfProgStrM("ATA LBA for CHS read: ");
- rprintfProgStrM("LBA="); rprintfu32(lba); rprintfProgStrM(" ");
- #endif
-
- // convert LBA to pseudo CHS
- // remember to offset the sector count by one
- sect = (u08) (lba % ataDriveInfo.sectors)+1;
- lba = lba / ataDriveInfo.sectors;
- head = (u08) (lba % ataDriveInfo.heads);
- lba = lba / ataDriveInfo.heads;
- cyl = (u16) lba;
-
- #ifdef DEBUG_ATA
- rprintfProgStrM("C:H:S=");
- rprintfu16(cyl); rprintfProgStrM(":");
- rprintfu08(head); rprintfProgStrM(":");
- rprintfu08(sect); rprintfCRLF();
- #endif
-
- temp = ataReadSectorsCHS( Drive, head, cyl, sect, numsectors, Buffer );
- }
-
- if(temp)
- ataDiskErr();
- return temp;
-}
-
-
-unsigned char ataWriteSectors(unsigned char Drive,
- unsigned long lba,
- unsigned int numsectors,
- unsigned char *Buffer)
-{
- unsigned int cyl, head, sect;
- unsigned char temp;
-
- // check if drive supports native LBA mode
- if(ataDriveInfo.LBAsupport)
- {
- // drive supports using native LBA
- temp = ataWriteSectorsLBA(Drive, lba, numsectors, Buffer);
- }
- else
- {
- // drive required CHS access
- #ifdef DEBUG_ATA
- // do this defore destroying lba
- rprintfProgStrM("ATA LBA for CHS write: ");
- rprintfProgStrM("LBA="); rprintfu32(lba); rprintfProgStrM(" ");
- #endif
-
- // convert LBA to pseudo CHS
- // remember to offset the sector count by one
- sect = (u08) (lba % ataDriveInfo.sectors)+1;
- lba = lba / ataDriveInfo.sectors;
- head = (u08) (lba % ataDriveInfo.heads);
- lba = lba / ataDriveInfo.heads;
- cyl = (u16) lba;
-
- #ifdef DEBUG_ATA
- rprintfProgStrM("C:H:S=");
- rprintfu16(cyl); rprintfProgStrM(":");
- rprintfu08(head); rprintfProgStrM(":");
- rprintfu08(sect); rprintfCRLF();
- #endif
-
- temp = ataWriteSectorsCHS( Drive, head, cyl, sect, numsectors, Buffer );
- }
-
- if(temp)
- ataDiskErr();
- return temp;
-}
-
-void ataDriveSelect(u08 DriveNo)
-{
- ataWriteByte(ATA_REG_HDDEVSEL, 0xA0+(DriveNo ? 0x10:00)); // Drive selection
-}
-
-//----------------------------------------------------------------------------
-// Set drive mode (STANDBY, IDLE)
-//----------------------------------------------------------------------------
-/*#define STANDBY 0
-#define IDLE 1
-#define SLEEP 2
-*/
-
-/*
-unsigned char SetMode(unsigned char DriveNo, unsigned char Mode, unsigned char PwrDown)
-{
- WriteBYTE(CMD, 6, 0xA0 + (DriveNo ? 0x10:0x00)); // Select drive
- WriteBYTE(CMD, 2, (PwrDown ? 0x01:0x00)); // Enable automatic power down
- switch (Mode)
- {
- case STANDBY: WriteBYTE(CMD,7, 0xE2); break;
- case IDLE: WriteBYTE(CMD,7, 0xE3); break;
- // NOTE: To recover from sleep, either issue a soft or hardware reset !
- // (But not on all drives, f.ex seagate ST3655A it's not nessecary to reset
- // but only to go in Idle mode, But on a Conner CFA170A it's nessecary with
- // a reset)
- case SLEEP: WriteBYTE(CMD,7, 0xE6); break;
- }
- Timer10mSec=10000;
- while ((ReadBYTE(CMD,7) & 0xC0)!=0x40 && Timer10mSec); // Wait for DRDY & NOT BUSY
- if (Timer10mSec==0) return 0xFF; // or timeout
-
- // Return the error register...
- return ReadBYTE(CMD, 1);
-}
-
-*/
-
-u08 ataReadByte(u08 reg)
-{
- register u08 ret;
- //sbi(MCUCR, SRW); // enable RAM waitstate
- ret = *((volatile unsigned char*) ATA_REG_BASE + reg);
- //cbi(MCUCR, SRW); // disable RAM waitstate
- return ret;
-}
-
-void ataWriteByte(u08 reg, u08 data)
-{
- //sbi(MCUCR, SRW); // enable RAM waitstate
- *((volatile unsigned char*) ATA_REG_BASE + reg) = data;
- //cbi(MCUCR, SRW); // disable RAM waitstate
-}
-
-
-void ataShowRegisters(unsigned char DriveNo)
-{
- ataWriteByte(ATA_REG_HDDEVSEL, 0xA0 + (DriveNo ? 0x10:0x00)); // Select drive
-
- rprintfProgStrM("R0: DATALOW = 0x"); rprintfu08(ataReadByte(ATA_REG_DATAL )); rprintfProgStrM(" \r\n");
- rprintfProgStrM("R1: ERROR = 0x"); rprintfu08(ataReadByte(ATA_REG_ERROR )); rprintfProgStrM(" \r\n");
- rprintfProgStrM("R2: SECT CNT = 0x"); rprintfu08(ataReadByte(ATA_REG_SECCOUNT)); rprintfProgStrM(" \r\n");
- rprintfProgStrM("R3: SECT NUM = 0x"); rprintfu08(ataReadByte(ATA_REG_STARTSEC)); rprintfProgStrM(" \r\n");
- rprintfProgStrM("R4: CYL LOW = 0x"); rprintfu08(ataReadByte(ATA_REG_CYLLO )); rprintfProgStrM(" \r\n");
- rprintfProgStrM("R5: CYL HIGH = 0x"); rprintfu08(ataReadByte(ATA_REG_CYLHI )); rprintfProgStrM(" \r\n");
- rprintfProgStrM("R6: HEAD/DEV = 0x"); rprintfu08(ataReadByte(ATA_REG_HDDEVSEL)); rprintfProgStrM(" \r\n");
- rprintfProgStrM("R7: CMD/STA = 0x"); rprintfu08(ataReadByte(ATA_REG_CMDSTATUS1)); rprintfProgStrM("\r\n");
-}
-
-unsigned char ataSWReset(void)
-{
- ataWriteByte(ATA_REG_HDDEVSEL, 0x06); // SRST and nIEN bits
- delay(10); // 10uS delay
- ataWriteByte(ATA_REG_HDDEVSEL, 0x02); // nIEN bits
- delay(10); // 10 uS delay
-
- while( (ataReadByte(ATA_REG_CMDSTATUS1) & 0xC0) != 0x40 ); // Wait for DRDY and not BSY
-
- return ataReadByte(ATA_REG_CMDSTATUS1) + ataReadByte(ATA_REG_ERROR);
-}
-
-/*
-unsigned char ATA_Idle(unsigned char Drive)
-{
-
- WriteBYTE(CMD, 6, 0xA0 + (Drive ? 0x10:0x00)); // Select drive
- WriteBYTE(CMD,7, 0xE1);
-
- while ((ReadBYTE(CMD,7) & 0xC0)!=0x40); // Wait for DRDY & NOT BUSY
-
- // Return the error register...
- return ReadBYTE(CMD, 1);
-}
-*/
diff --git a/build/shared/lib/avrlib/ata.h b/build/shared/lib/avrlib/ata.h
deleted file mode 100755
index 00d1fe62d..000000000
--- a/build/shared/lib/avrlib/ata.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/*! \file ata.h \brief IDE-ATA hard disk interface driver. */
-//*****************************************************************************
-//
-// File Name : 'ata.h'
-// Title : IDE-ATA interface driver for hard disks
-// Author : Pascal Stang
-// Date : 11/22/2000
-// Revised : 12/29/2000
-// Version : 0.3
-// Target MCU : ATmega103 (should work for Atmel AVR Series)
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-
-#ifndef ATA_H
-#define ATA_H
-
-#include "global.h"
-#include "ataconf.h"
-
-// constants
-#define DRIVE0 0
-
-#define STANDBY 0
-#define SLEEP 1
-#define IDLE 2
-
-// ATA status register bits
-#define ATA_SR_BSY 0x80
-#define ATA_SR_DRDY 0x40
-#define ATA_SR_DF 0x20
-#define ATA_SR_DSC 0x10
-#define ATA_SR_DRQ 0x08
-#define ATA_SR_CORR 0x04
-#define ATA_SR_IDX 0x02
-#define ATA_SR_ERR 0x01
-
-// ATA error register bits
-#define ATA_ER_UNC 0x40
-#define ATA_ER_MC 0x20
-#define ATA_ER_IDNF 0x10
-#define ATA_ER_MCR 0x08
-#define ATA_ER_ABRT 0x04
-#define ATA_ER_TK0NF 0x02
-#define ATA_ER_AMNF 0x01
-
-// ATA head register bits
-#define ATA_HEAD_USE_LBA 0x40
-/*
-// ATA registers
-#define ATA_REG_BASE 0x8000
-#define ATA_REG_DATAL 0x00
-#define ATA_REG_ERROR 0x01
-#define ATA_REG_SECCOUNT 0x02
-#define ATA_REG_STARTSEC 0x03
-#define ATA_REG_CYLLO 0x04
-#define ATA_REG_CYLHI 0x05
-#define ATA_REG_HDDEVSEL 0x06
-#define ATA_REG_CMDSTATUS1 0x07
-#define ATA_REG_CMDSTATUS2 0x08
-#define ATA_REG_ACTSTATUS 0x09
-
-#define ATA_REG_DATAH 0x10
-*/
-// ATA commands
-#define ATA_CMD_READ 0x20
-#define ATA_CMD_READNR 0x21
-#define ATA_CMD_WRITE 0x30
-#define ATA_CMD_WRITENR 0x31
-#define ATA_CMD_IDENTIFY 0xEC
-#define ATA_CMD_RECALIBRATE 0x10
-#define ATA_CMD_SPINDOWN 0xE0 // spin down disk immediately
-#define ATA_CMD_SPINUP 0xE1 // spin up disk immediately
-#define ATA_CMD_STANDBY_5SU 0xE2 // spin down disk and set auto-power-down timer (sectorcount*5sec)
-#define ATA_CMD_IDLE_5SU 0xE3 // keep disk spinning and set auto-power-down timer (sectorcount*5sec)
-#define ATA_CMD_SLEEP 0xE6 // sleep disk (wakeup only on HW or SW reset)
-#define ATA_CMD_STANDBY_01SU 0xF2 // spin down disk and set auto-power-down timer (sectorcount*0.1sec)
-#define ATA_CMD_IDLE_01SU 0xF3 // keep disk spinning and set auto-power-down timer (sectorcount*0.1sec)
-
-
-// ATA CHS disk parameters (examples, now we autodetect)
-#define ATA_DISKPARM_CLYS 0x03A6 // number of cylinders per platter
-#define ATA_DISKPARM_HEADS 0x10 // number of heads (usable plater sides)
-#define ATA_DISKPARM_SECTORS 0x11 // number of sectors per head per cylinder
-
-// ATA Identity fields
-// all offsets refer to word offset (2 byte increments)
-#define ATA_IDENT_DEVICETYPE 0 // specifies ATA/ATAPI, removable/non-removable
-#define ATA_IDENT_CYLINDERS 1 // number of logical cylinders
-#define ATA_IDENT_HEADS 3 // number of logical heads
-#define ATA_IDENT_SECTORS 6 // number of sectors per track
-#define ATA_IDENT_SERIAL 10 // drive model name (20 characters)
-#define ATA_IDENT_MODEL 27 // drive model name (40 characters)
-#define ATA_IDENT_FIELDVALID 53 // indicates field validity of higher words (bit0: words54-58, bit1: words 64-70)
-#define ATA_IDENT_LBASECTORS 60 // number of sectors in LBA translation mode
-
-// drive mode defines (for ataSetDrivePowerMode() )
-#define ATA_DISKMODE_SPINDOWN 0
-#define ATA_DISKMODE_SPINUP 1
-#define ATA_DISKMODE_SETTIMEOUT 2
-#define ATA_DISKMODE_SLEEP 3
-
-// typedefs
-// drive info structure
-typedef struct
-{
- unsigned int cylinders;
- unsigned char heads;
- unsigned char sectors;
- unsigned long sizeinsectors;
- unsigned char LBAsupport;
- char model[41];
-} typeDriveInfo;
-
-
-// Prototypes
-void ataInit(void);
-void ataDriveInit(void);
-void ataDriveSelect(u08 DriveNo);
-void ataSetDrivePowerMode(u08 DriveNo, u08 mode, u08 timeout);
-u08 ataReadByte(u08 reg);
-void ataWriteByte(u08 reg, u08 data);
-void ataShowRegisters(unsigned char DriveNo);
-u08 ataSWReset(void);
-void ataDiskErr(void);
-void ataPrintSector( u08 *Buffer);
-void ataReadDataBuffer(u08 *Buffer, u16 numBytes);
-void ataWriteDataBuffer(u08 *Buffer, u16 numBytes);
-u08 ataStatusWait(u08 mask, u08 waitStatus);
-
-// read and write routines for CHS based drives
-unsigned char ataReadSectorsCHS( unsigned char Drive,
- unsigned char Head,
- unsigned int Track,
- unsigned char Sector,
- unsigned int numsectors,
- unsigned char *Buffer);
-
-unsigned char ataWriteSectorsCHS( unsigned char Drive,
- unsigned char Head,
- unsigned int Track,
- unsigned char Sector,
- unsigned int numsectors,
- unsigned char *Buffer);
-
-// read and write routines for LBA based drives
-unsigned char ataReadSectorsLBA( unsigned char Drive,
- unsigned long lba,
- unsigned int numsectors,
- unsigned char *Buffer);
-
-unsigned char ataWriteSectorsLBA( unsigned char Drive,
- unsigned long lba,
- unsigned int numsectors,
- unsigned char *Buffer);
-
-// generic read and write routines using LBA
-// uses native or translated LBA addressing
-// given autodetected drive type
-unsigned char ataReadSectors( unsigned char Drive,
- unsigned long lba,
- unsigned int numsectors,
- unsigned char *Buffer);
-
-unsigned char ataWriteSectors( unsigned char Drive,
- unsigned long lba,
- unsigned int numsectors,
- unsigned char *Buffer);
-
-//unsigned char IdentifyDrive(unsigned char DriveNo, unsigned char *Buffer, tdefDriveInfo *DriveInfo);
-//unsigned char SetMode(unsigned char DriveNo, unsigned char Mode, unsigned char PwrDown);
-//unsigned char ATA_Idle(unsigned char Drive);
-
-#endif
diff --git a/build/shared/lib/avrlib/avrlibdefs.h b/build/shared/lib/avrlib/avrlibdefs.h
deleted file mode 100755
index 7116dde42..000000000
--- a/build/shared/lib/avrlib/avrlibdefs.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*! \file avrlibdefs.h \brief AVRlib global defines and macros. */
-//*****************************************************************************
-//
-// File Name : 'avrlibdefs.h'
-// Title : AVRlib global defines and macros include file
-// Author : Pascal Stang
-// Created : 7/12/2001
-// Revised : 9/30/2002
-// Version : 1.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// Description : This include file is designed to contain items useful to all
-// code files and projects, regardless of specific implementation.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-
-#ifndef AVRLIBDEFS_H
-#define AVRLIBDEFS_H
-
-// Code compatibility to new AVR-libc
-// outb(), inb(), BV(), sbi(), cbi(), sei(), cli()
-#ifndef outb
- #define outb(addr, data) addr = (data)
-#endif
-#ifndef inb
- #define inb(addr) (addr)
-#endif
-#ifndef BV
- #define BV(bit) (1<<(bit))
-#endif
-#ifndef cbi
- #define cbi(reg,bit) reg &= ~(BV(bit))
-#endif
-#ifndef sbi
- #define sbi(reg,bit) reg |= (BV(bit))
-#endif
-#ifndef cli
- #define cli() __asm__ __volatile__ ("cli" ::)
-#endif
-#ifndef sei
- #define sei() __asm__ __volatile__ ("sei" ::)
-#endif
-
-// support for individual port pin naming in the mega128
-// see port128.h for details
-#ifdef __AVR_ATmega128__
-// not currently necessary due to inclusion
-// of these defines in newest AVR-GCC
-// do a quick test to see if include is needed
-#ifndef PD0
- #include "port128.h"
-#endif
-#endif
-
-// use this for packed structures
-// (this is seldom necessary on an 8-bit architecture like AVR,
-// but can assist in code portability to AVR)
-#define GNUC_PACKED __attribute__((packed))
-
-// port address helpers
-#define DDR(x) ((x)-1) // address of data direction register of port x
-#define PIN(x) ((x)-2) // address of input register of port x
-
-// MIN/MAX/ABS macros
-#define MIN(a,b) ((ab)?(a):(b))
-#define ABS(x) ((x>0)?(x):(-x))
-
-// constants
-#define PI 3.14159265359
-
-#endif
diff --git a/build/shared/lib/avrlib/avrlibtypes.h b/build/shared/lib/avrlib/avrlibtypes.h
deleted file mode 100755
index 4d44ac562..000000000
--- a/build/shared/lib/avrlib/avrlibtypes.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*! \file avrlibtypes.h \brief AVRlib global types and typedefines. */
-//*****************************************************************************
-//
-// File Name : 'avrlibtypes.h'
-// Title : AVRlib global types and typedefines include file
-// Author : Pascal Stang
-// Created : 7/12/2001
-// Revised : 9/30/2002
-// Version : 1.0
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// Description : Type-defines required and used by AVRlib. Most types are also
-// generally useful.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-
-#ifndef AVRLIBTYPES_H
-#define AVRLIBTYPES_H
-
-#ifndef WIN32
- // true/false defines
- #define FALSE 0
- #define TRUE -1
-#endif
-
-// datatype definitions macros
-typedef unsigned char u08;
-typedef signed char s08;
-typedef unsigned short u16;
-typedef signed short s16;
-typedef unsigned long u32;
-typedef signed long s32;
-typedef unsigned long long u64;
-typedef signed long long s64;
-
-/* use inttypes.h instead
-// C99 standard integer type definitions
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-typedef unsigned long uint32_t;
-typedef signed long int32_t;
-typedef unsigned long uint64_t;
-typedef signed long int64_t;
-*/
-// maximum value that can be held
-// by unsigned data types (8,16,32bits)
-#define MAX_U08 255
-#define MAX_U16 65535
-#define MAX_U32 4294967295
-
-// maximum values that can be held
-// by signed data types (8,16,32bits)
-#define MIN_S08 -128
-#define MAX_S08 127
-#define MIN_S16 -32768
-#define MAX_S16 32767
-#define MIN_S32 -2147483648
-#define MAX_S32 2147483647
-
-#ifndef WIN32
- // more type redefinitions
- typedef unsigned char BOOL;
- typedef unsigned char BYTE;
- typedef unsigned int WORD;
- typedef unsigned long DWORD;
-
- typedef unsigned char UCHAR;
- typedef unsigned int UINT;
- typedef unsigned short USHORT;
- typedef unsigned long ULONG;
-
- typedef char CHAR;
- typedef int INT;
- typedef long LONG;
-#endif
-
-#endif
diff --git a/build/shared/lib/avrlib/bitbuf.c b/build/shared/lib/avrlib/bitbuf.c
deleted file mode 100755
index aeb84eb54..000000000
--- a/build/shared/lib/avrlib/bitbuf.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*! \file bitbuf.c \brief Multipurpose bit buffer structure and methods. */
-//*****************************************************************************
-//
-// File Name : 'bitbuf.c'
-// Title : Multipurpose bit buffer structure and methods
-// Author : Pascal Stang - Copyright (C) 2001-2002
-// Created : 7/10/2002
-// Revised : 7/10/2002
-// Version : 0.5
-// Target MCU : any
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include "bitbuf.h"
-
-// global variables
-
-//! Initialize the bit buffer
-// sets the start location and size of the buffer in memory
-void bitbufInit(BitBuf* bitBuffer, unsigned char *start, unsigned short bytesize)
-{
- // set start pointer of the buffer
- bitBuffer->dataptr = start;
- bitBuffer->size = bytesize;
- // initialize indexing and length
- bitBuffer->dataindex = 0;
- bitbufFlush(bitBuffer);
-}
-
-// access routines
-
-//! Get a bit from the current position in the buffer
-// returns the bit at the current position in the buffer
-// and increments the bit position
-unsigned char bitbufGet(BitBuf* bitBuffer)
-{
- unsigned char byte;
- unsigned char bit;
-
- // get current working byte
- byte = bitBuffer->dataptr[bitBuffer->bytePos];
- // read data bit
- bit = (byte & (1<bitPos))?(1):(0);
-
- // increment bit counter
- if(bitBuffer->bitPos < 7)
- {
- bitBuffer->bitPos++;
- }
- else
- {
- // increment byte counter
- bitBuffer->bitPos = 0;
- bitBuffer->bytePos++;
- }
-
- // return bit value
- return bit;
-}
-
-//! Get a bit from a given index into the buffer
-// returns the bit at position [bitIndex] in the buffer
-unsigned char bitbufGetAtIndex(BitBuf* bitBuffer, unsigned short bitIndex)
-{
- // return bit at index in buffer
- return (bitBuffer->dataptr[bitIndex>>3] & (1<<(bitIndex & 0x07)))?(1):(0);
-}
-
-//! Store a bit at the current position in the buffer
-// stores the bit at the current position in the buffer
-// and increments the bit position
-void bitbufStore(BitBuf* bitBuffer, unsigned char bit)
-{
- unsigned char byte;
- // get current working byte
- byte = bitBuffer->dataptr[bitBuffer->bytePos];
- // apply data bit
- if(bit)
- byte |= (1<bitPos);
- else
- byte &= ~(1<bitPos);
- // store data
- bitBuffer->dataptr[bitBuffer->bytePos] = byte;
- bitBuffer->datalength++;
-
- // increment bit counter
- if(bitBuffer->bitPos < 7)
- {
- bitBuffer->bitPos++;
- }
- else
- {
- // increment byte counter
- bitBuffer->bitPos = 0;
- bitBuffer->bytePos++;
- }
-}
-
-void bitbufReset(BitBuf* bitBuffer)
-{
- // reset counters
- bitBuffer->bytePos = 0;
- bitBuffer->bitPos = 0;
-}
-
-void bitbufFlush(BitBuf* bitBuffer)
-{
- // flush contents of the buffer
- bitBuffer->datalength = 0;
- // reset indexing
- bitbufReset(bitBuffer);
-}
-
-unsigned short bitbufGetDataLength(BitBuf* bitBuffer)
-{
- return bitBuffer->datalength;
-}
-
-/*
-unsigned char bitbufIsNotFull(cBuffer* buffer)
-{
- // check to see if the buffer has room
- // return true if there is room
- return (buffer->datalength < buffer->size);
-}
-*/
-
diff --git a/build/shared/lib/avrlib/bitbuf.h b/build/shared/lib/avrlib/bitbuf.h
deleted file mode 100755
index 83857966a..000000000
--- a/build/shared/lib/avrlib/bitbuf.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*! \file bitbuf.h \brief Multipurpose bit buffer structure and methods. */
-//*****************************************************************************
-//
-// File Name : 'bitbuf.c'
-// Title : Multipurpose bit buffer structure and methods
-// Author : Pascal Stang - Copyright (C) 2001-2002
-// Created : 7/10/2002
-// Revised : 7/10/2002
-// Version : 0.5
-// Target MCU : any
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef BITBUF_H
-#define BITBUF_H
-
-// structure/typdefs
-
-// the BitBuffer structure
-typedef struct struct_BitBuf
-{
- unsigned char *dataptr; // the physical memory address where the buffer is stored
- unsigned short size; // the allocated byte size of the buffer
- unsigned short bytePos; // current byte position
- unsigned short bitPos; // current bit position
- unsigned short datalength; // the length of the data (in bits) currently in the buffer
- unsigned short dataindex; // the index (in bits) into the buffer where the data starts
-} BitBuf;
-
-// function prototypes
-
-//! initialize a buffer to start at a given address and have given size
-void bitbufInit(BitBuf* bitBuffer, unsigned char *start, unsigned short bytesize);
-
-//! get the bit at the current position in the buffer
-unsigned char bitbufGet(BitBuf* bitBuffer);
-
-//! get a bit at the specified index in the buffer (kind of like array access)
-// ** note: this does not remove/delete the bit that was read
-unsigned char bitbufGetAtIndex(BitBuf* bitBuffer, unsigned short bitIndex);
-
-//! store a bit at the current position in the buffer
-void bitbufStore(BitBuf* bitBuffer, unsigned char bit);
-
-//! return the number of bits in the buffer
-unsigned short bitbufGetDataLength(BitBuf* bitBuffer);
-
-// check if the buffer is full/not full (returns non-zero value if not full)
-//unsigned char bitbufIsNotFull(cBuffer* buffer);
-
-//! resets the read/write position of the buffer to beginning
-void bitbufReset(BitBuf* bitBuffer);
-
-//! flush (clear) the contents of the buffer
-void bitbufFlush(BitBuf* bitBuffer);
-
-#endif
-
diff --git a/build/shared/lib/avrlib/buffer.c b/build/shared/lib/avrlib/buffer.c
deleted file mode 100755
index 67c05f922..000000000
--- a/build/shared/lib/avrlib/buffer.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*! \file buffer.c \brief Multipurpose byte buffer structure and methods. */
-//*****************************************************************************
-//
-// File Name : 'buffer.c'
-// Title : Multipurpose byte buffer structure and methods
-// Author : Pascal Stang - Copyright (C) 2001-2002
-// Created : 9/23/2001
-// Revised : 9/23/2001
-// Version : 1.0
-// Target MCU : any
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include "buffer.h"
-
-// global variables
-
-// initialization
-
-void bufferInit(cBuffer* buffer, unsigned char *start, unsigned short size)
-{
- // set start pointer of the buffer
- buffer->dataptr = start;
- buffer->size = size;
- // initialize index and length
- buffer->dataindex = 0;
- buffer->datalength = 0;
-}
-
-// access routines
-unsigned char bufferGetFromFront(cBuffer* buffer)
-{
- unsigned char data = 0;
-
- // check to see if there's data in the buffer
- if(buffer->datalength)
- {
- // get the first character from buffer
- data = buffer->dataptr[buffer->dataindex];
- // move index down and decrement length
- buffer->dataindex++;
- if(buffer->dataindex >= buffer->size)
- {
- buffer->dataindex %= buffer->size;
- }
- buffer->datalength--;
- }
- // return
- return data;
-}
-
-void bufferDumpFromFront(cBuffer* buffer, unsigned short numbytes)
-{
- // dump numbytes from the front of the buffer
- // are we dumping less than the entire buffer?
- if(numbytes < buffer->datalength)
- {
- // move index down by numbytes and decrement length by numbytes
- buffer->dataindex += numbytes;
- if(buffer->dataindex >= buffer->size)
- {
- buffer->dataindex %= buffer->size;
- }
- buffer->datalength -= numbytes;
- }
- else
- {
- // flush the whole buffer
- buffer->datalength = 0;
- }
-}
-
-unsigned char bufferGetAtIndex(cBuffer* buffer, unsigned short index)
-{
- // return character at index in buffer
- return buffer->dataptr[(buffer->dataindex+index)%(buffer->size)];
-}
-
-unsigned char bufferAddToEnd(cBuffer* buffer, unsigned char data)
-{
- // make sure the buffer has room
- if(buffer->datalength < buffer->size)
- {
- // save data byte at end of buffer
- buffer->dataptr[(buffer->dataindex + buffer->datalength) % buffer->size] = data;
- // increment the length
- buffer->datalength++;
- // return success
- return -1;
- }
- else return 0;
-}
-
-unsigned char bufferIsNotFull(cBuffer* buffer)
-{
- // check to see if the buffer has room
- // return true if there is room
- return (buffer->datalength < buffer->size);
-}
-
-void bufferFlush(cBuffer* buffer)
-{
- // flush contents of the buffer
- buffer->datalength = 0;
-}
-
diff --git a/build/shared/lib/avrlib/buffer.h b/build/shared/lib/avrlib/buffer.h
deleted file mode 100755
index 727cd7881..000000000
--- a/build/shared/lib/avrlib/buffer.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*! \file buffer.h \brief Multipurpose byte buffer structure and methods. */
-//*****************************************************************************
-//
-// File Name : 'buffer.h'
-// Title : Multipurpose byte buffer structure and methods
-// Author : Pascal Stang - Copyright (C) 2001-2002
-// Created : 9/23/2001
-// Revised : 11/16/2002
-// Version : 1.1
-// Target MCU : any
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef BUFFER_H
-#define BUFFER_H
-
-// structure/typdefs
-
-// the cBuffer structure
-typedef struct struct_cBuffer
-{
- unsigned char *dataptr; // the physical memory address where the buffer is stored
- unsigned short size; // the allocated size of the buffer
- unsigned short datalength; // the length of the data currently in the buffer
- unsigned short dataindex; // the index into the buffer where the data starts
-} cBuffer;
-
-// function prototypes
-
-//! initialize a buffer to start at a given address and have given size
-void bufferInit(cBuffer* buffer, unsigned char *start, unsigned short size);
-
-//! get the first byte from the front of the buffer
-unsigned char bufferGetFromFront(cBuffer* buffer);
-
-//! dump (discard) the first numbytes from the front of the buffer
-void bufferDumpFromFront(cBuffer* buffer, unsigned short numbytes);
-
-//! get a byte at the specified index in the buffer (kind of like array access)
-// ** note: this does not remove the byte that was read from the buffer
-unsigned char bufferGetAtIndex(cBuffer* buffer, unsigned short index);
-
-//! add a byte to the end of the buffer
-unsigned char bufferAddToEnd(cBuffer* buffer, unsigned char data);
-
-//! check if the buffer is full/not full (returns non-zero value if not full)
-unsigned char bufferIsNotFull(cBuffer* buffer);
-
-//! flush (clear) the contents of the buffer
-void bufferFlush(cBuffer* buffer);
-
-#endif
diff --git a/build/shared/lib/avrlib/buffer.lst b/build/shared/lib/avrlib/buffer.lst
deleted file mode 100755
index 1760a61b0..000000000
--- a/build/shared/lib/avrlib/buffer.lst
+++ /dev/null
@@ -1,390 +0,0 @@
- 1 .file "buffer.c"
- 2 .arch atmega8
- 3 __SREG__ = 0x3f
- 4 __SP_H__ = 0x3e
- 5 __SP_L__ = 0x3d
- 6 __tmp_reg__ = 0
- 7 __zero_reg__ = 1
- 8 .global __do_copy_data
- 9 .global __do_clear_bss
- 12 .text
- 13 .Ltext0:
- 44 .global bufferInit
- 46 bufferInit:
- 1:../avrlib/buffer.c **** /*! \file buffer.c \brief Multipurpose byte buffer structure and methods. */
- 2:../avrlib/buffer.c **** //*****************************************************************************
- 3:../avrlib/buffer.c **** //
- 4:../avrlib/buffer.c **** // File Name : 'buffer.c'
- 5:../avrlib/buffer.c **** // Title : Multipurpose byte buffer structure and methods
- 6:../avrlib/buffer.c **** // Author : Pascal Stang - Copyright (C) 2001-2002
- 7:../avrlib/buffer.c **** // Created : 9/23/2001
- 8:../avrlib/buffer.c **** // Revised : 9/23/2001
- 9:../avrlib/buffer.c **** // Version : 1.0
- 10:../avrlib/buffer.c **** // Target MCU : any
- 11:../avrlib/buffer.c **** // Editor Tabs : 4
- 12:../avrlib/buffer.c **** //
- 13:../avrlib/buffer.c **** // This code is distributed under the GNU Public License
- 14:../avrlib/buffer.c **** // which can be found at http://www.gnu.org/licenses/gpl.txt
- 15:../avrlib/buffer.c **** //
- 16:../avrlib/buffer.c **** //*****************************************************************************
- 17:../avrlib/buffer.c ****
- 18:../avrlib/buffer.c **** #include "buffer.h"
- 19:../avrlib/buffer.c ****
- 20:../avrlib/buffer.c **** // global variables
- 21:../avrlib/buffer.c ****
- 22:../avrlib/buffer.c **** // initialization
- 23:../avrlib/buffer.c ****
- 24:../avrlib/buffer.c **** void bufferInit(cBuffer* buffer, unsigned char *start, unsigned short size)
- 25:../avrlib/buffer.c **** {
- 48 .LM1:
- 49 /* prologue: frame size=0 */
- 50 /* prologue end (size=0) */
- 51 0000 FC01 movw r30,r24
- 26:../avrlib/buffer.c **** // set start pointer of the buffer
- 27:../avrlib/buffer.c **** buffer->dataptr = start;
- 53 .LM2:
- 54 0002 6083 st Z,r22
- 55 0004 7183 std Z+1,r23
- 28:../avrlib/buffer.c **** buffer->size = size;
- 57 .LM3:
- 58 0006 4283 std Z+2,r20
- 59 0008 5383 std Z+3,r21
- 29:../avrlib/buffer.c **** // initialize index and length
- 30:../avrlib/buffer.c **** buffer->dataindex = 0;
- 61 .LM4:
- 62 000a 1682 std Z+6,__zero_reg__
- 63 000c 1782 std Z+7,__zero_reg__
- 31:../avrlib/buffer.c **** buffer->datalength = 0;
- 65 .LM5:
- 66 000e 1482 std Z+4,__zero_reg__
- 67 0010 1582 std Z+5,__zero_reg__
- 68 /* epilogue: frame size=0 */
- 69 0012 0895 ret
- 70 /* epilogue end (size=1) */
- 71 /* function bufferInit size 10 (9) */
- 73 .Lscope0:
- 77 .global bufferGetFromFront
- 79 bufferGetFromFront:
- 32:../avrlib/buffer.c **** }
- 33:../avrlib/buffer.c ****
- 34:../avrlib/buffer.c **** // access routines
- 35:../avrlib/buffer.c **** unsigned char bufferGetFromFront(cBuffer* buffer)
- 36:../avrlib/buffer.c **** {
- 81 .LM6:
- 82 /* prologue: frame size=0 */
- 83 0014 CF93 push r28
- 84 0016 DF93 push r29
- 85 /* prologue end (size=2) */
- 86 0018 EC01 movw r28,r24
- 37:../avrlib/buffer.c **** unsigned char data = 0;
- 88 .LM7:
- 89 001a E0E0 ldi r30,lo8(0)
- 38:../avrlib/buffer.c ****
- 39:../avrlib/buffer.c **** // check to see if there's data in the buffer
- 40:../avrlib/buffer.c **** if(buffer->datalength)
- 91 .LM8:
- 92 001c 2C81 ldd r18,Y+4
- 93 001e 3D81 ldd r19,Y+5
- 94 0020 2115 cp r18,__zero_reg__
- 95 0022 3105 cpc r19,__zero_reg__
- 96 0024 B1F0 breq .L3
- 41:../avrlib/buffer.c **** {
- 42:../avrlib/buffer.c **** // get the first character from buffer
- 43:../avrlib/buffer.c **** data = buffer->dataptr[buffer->dataindex];
- 98 .LM9:
- 99 0026 E881 ld r30,Y
- 100 0028 F981 ldd r31,Y+1
- 101 002a 8E81 ldd r24,Y+6
- 102 002c 9F81 ldd r25,Y+7
- 103 002e E80F add r30,r24
- 104 0030 F91F adc r31,r25
- 105 0032 E081 ld r30,Z
- 44:../avrlib/buffer.c **** // move index down and decrement length
- 45:../avrlib/buffer.c **** buffer->dataindex++;
- 107 .LM10:
- 108 0034 0196 adiw r24,1
- 109 0036 8E83 std Y+6,r24
- 110 0038 9F83 std Y+7,r25
- 46:../avrlib/buffer.c **** if(buffer->dataindex >= buffer->size)
- 112 .LM11:
- 113 003a 6A81 ldd r22,Y+2
- 114 003c 7B81 ldd r23,Y+3
- 115 003e 8617 cp r24,r22
- 116 0040 9707 cpc r25,r23
- 117 0042 18F0 brlo .L4
- 47:../avrlib/buffer.c **** {
- 48:../avrlib/buffer.c **** buffer->dataindex %= buffer->size;
- 119 .LM12:
- 120 0044 00D0 rcall __udivmodhi4
- 121 0046 8E83 std Y+6,r24
- 122 0048 9F83 std Y+7,r25
- 123 .L4:
- 49:../avrlib/buffer.c **** }
- 50:../avrlib/buffer.c **** buffer->datalength--;
- 125 .LM13:
- 126 004a 2150 subi r18,lo8(-(-1))
- 127 004c 3040 sbci r19,hi8(-(-1))
- 128 004e 2C83 std Y+4,r18
- 129 0050 3D83 std Y+5,r19
- 130 .L3:
- 51:../avrlib/buffer.c **** }
- 52:../avrlib/buffer.c **** // return
- 53:../avrlib/buffer.c **** return data;
- 54:../avrlib/buffer.c **** }
- 132 .LM14:
- 133 0052 8E2F mov r24,r30
- 134 0054 9927 clr r25
- 135 /* epilogue: frame size=0 */
- 136 0056 DF91 pop r29
- 137 0058 CF91 pop r28
- 138 005a 0895 ret
- 139 /* epilogue end (size=3) */
- 140 /* function bufferGetFromFront size 36 (31) */
- 145 .Lscope1:
- 150 .global bufferDumpFromFront
- 152 bufferDumpFromFront:
- 55:../avrlib/buffer.c ****
- 56:../avrlib/buffer.c **** void bufferDumpFromFront(cBuffer* buffer, unsigned short numbytes)
- 57:../avrlib/buffer.c **** {
- 154 .LM15:
- 155 /* prologue: frame size=0 */
- 156 005c CF93 push r28
- 157 005e DF93 push r29
- 158 /* prologue end (size=2) */
- 159 0060 FC01 movw r30,r24
- 160 0062 EB01 movw r28,r22
- 58:../avrlib/buffer.c **** // dump numbytes from the front of the buffer
- 59:../avrlib/buffer.c **** // are we dumping less than the entire buffer?
- 60:../avrlib/buffer.c **** if(numbytes < buffer->datalength)
- 162 .LM16:
- 163 0064 2481 ldd r18,Z+4
- 164 0066 3581 ldd r19,Z+5
- 165 0068 6217 cp r22,r18
- 166 006a 7307 cpc r23,r19
- 167 006c 98F4 brsh .L6
- 61:../avrlib/buffer.c **** {
- 62:../avrlib/buffer.c **** // move index down by numbytes and decrement length by numbytes
- 63:../avrlib/buffer.c **** buffer->dataindex += numbytes;
- 169 .LM17:
- 170 006e 8681 ldd r24,Z+6
- 171 0070 9781 ldd r25,Z+7
- 172 0072 860F add r24,r22
- 173 0074 971F adc r25,r23
- 174 0076 8683 std Z+6,r24
- 175 0078 9783 std Z+7,r25
- 64:../avrlib/buffer.c **** if(buffer->dataindex >= buffer->size)
- 177 .LM18:
- 178 007a 6281 ldd r22,Z+2
- 179 007c 7381 ldd r23,Z+3
- 180 007e 8617 cp r24,r22
- 181 0080 9707 cpc r25,r23
- 182 0082 18F0 brlo .L7
- 65:../avrlib/buffer.c **** {
- 66:../avrlib/buffer.c **** buffer->dataindex %= buffer->size;
- 184 .LM19:
- 185 0084 00D0 rcall __udivmodhi4
- 186 0086 8683 std Z+6,r24
- 187 0088 9783 std Z+7,r25
- 188 .L7:
- 67:../avrlib/buffer.c **** }
- 68:../avrlib/buffer.c **** buffer->datalength -= numbytes;
- 190 .LM20:
- 191 008a 2C1B sub r18,r28
- 192 008c 3D0B sbc r19,r29
- 193 008e 2483 std Z+4,r18
- 194 0090 3583 std Z+5,r19
- 195 0092 02C0 rjmp .L5
- 196 .L6:
- 69:../avrlib/buffer.c **** }
- 70:../avrlib/buffer.c **** else
- 71:../avrlib/buffer.c **** {
- 72:../avrlib/buffer.c **** // flush the whole buffer
- 73:../avrlib/buffer.c **** buffer->datalength = 0;
- 198 .LM21:
- 199 0094 1482 std Z+4,__zero_reg__
- 200 0096 1582 std Z+5,__zero_reg__
- 201 .L5:
- 202 /* epilogue: frame size=0 */
- 203 0098 DF91 pop r29
- 204 009a CF91 pop r28
- 205 009c 0895 ret
- 206 /* epilogue end (size=3) */
- 207 /* function bufferDumpFromFront size 33 (28) */
- 209 .Lscope2:
- 214 .global bufferGetAtIndex
- 216 bufferGetAtIndex:
- 74:../avrlib/buffer.c **** }
- 75:../avrlib/buffer.c **** }
- 76:../avrlib/buffer.c ****
- 77:../avrlib/buffer.c **** unsigned char bufferGetAtIndex(cBuffer* buffer, unsigned short index)
- 78:../avrlib/buffer.c **** {
- 218 .LM22:
- 219 /* prologue: frame size=0 */
- 220 /* prologue end (size=0) */
- 221 009e FC01 movw r30,r24
- 79:../avrlib/buffer.c **** // return character at index in buffer
- 80:../avrlib/buffer.c **** return buffer->dataptr[(buffer->dataindex+index)%(buffer->size)];
- 223 .LM23:
- 224 00a0 8681 ldd r24,Z+6
- 225 00a2 9781 ldd r25,Z+7
- 226 00a4 2281 ldd r18,Z+2
- 227 00a6 3381 ldd r19,Z+3
- 228 00a8 860F add r24,r22
- 229 00aa 971F adc r25,r23
- 230 00ac B901 movw r22,r18
- 231 00ae 00D0 rcall __udivmodhi4
- 232 00b0 0190 ld __tmp_reg__,Z+
- 233 00b2 F081 ld r31,Z
- 234 00b4 E02D mov r30,__tmp_reg__
- 235 00b6 E80F add r30,r24
- 236 00b8 F91F adc r31,r25
- 237 00ba 8081 ld r24,Z
- 81:../avrlib/buffer.c **** }
- 239 .LM24:
- 240 00bc 9927 clr r25
- 241 /* epilogue: frame size=0 */
- 242 00be 0895 ret
- 243 /* epilogue end (size=1) */
- 244 /* function bufferGetAtIndex size 17 (16) */
- 246 .Lscope3:
- 251 .global bufferAddToEnd
- 253 bufferAddToEnd:
- 82:../avrlib/buffer.c ****
- 83:../avrlib/buffer.c **** unsigned char bufferAddToEnd(cBuffer* buffer, unsigned char data)
- 84:../avrlib/buffer.c **** {
- 255 .LM25:
- 256 /* prologue: frame size=0 */
- 257 00c0 CF93 push r28
- 258 00c2 DF93 push r29
- 259 /* prologue end (size=2) */
- 260 00c4 EC01 movw r28,r24
- 261 00c6 462F mov r20,r22
- 85:../avrlib/buffer.c **** // make sure the buffer has room
- 86:../avrlib/buffer.c **** if(buffer->datalength < buffer->size)
- 263 .LM26:
- 264 00c8 2C81 ldd r18,Y+4
- 265 00ca 3D81 ldd r19,Y+5
- 266 00cc 6A81 ldd r22,Y+2
- 267 00ce 7B81 ldd r23,Y+3
- 268 00d0 2617 cp r18,r22
- 269 00d2 3707 cpc r19,r23
- 270 00d4 90F4 brsh .L11
- 87:../avrlib/buffer.c **** {
- 88:../avrlib/buffer.c **** // save data byte at end of buffer
- 89:../avrlib/buffer.c **** buffer->dataptr[(buffer->dataindex + buffer->datalength) % buffer->size] = data;
- 272 .LM27:
- 273 00d6 8E81 ldd r24,Y+6
- 274 00d8 9F81 ldd r25,Y+7
- 275 00da 820F add r24,r18
- 276 00dc 931F adc r25,r19
- 277 00de 00D0 rcall __udivmodhi4
- 278 00e0 E881 ld r30,Y
- 279 00e2 F981 ldd r31,Y+1
- 280 00e4 E80F add r30,r24
- 281 00e6 F91F adc r31,r25
- 282 00e8 4083 st Z,r20
- 90:../avrlib/buffer.c **** // increment the length
- 91:../avrlib/buffer.c **** buffer->datalength++;
- 284 .LM28:
- 285 00ea 8C81 ldd r24,Y+4
- 286 00ec 9D81 ldd r25,Y+5
- 287 00ee 0196 adiw r24,1
- 288 00f0 8C83 std Y+4,r24
- 289 00f2 9D83 std Y+5,r25
- 92:../avrlib/buffer.c **** // return success
- 93:../avrlib/buffer.c **** return -1;
- 291 .LM29:
- 292 00f4 8FEF ldi r24,lo8(255)
- 293 00f6 90E0 ldi r25,hi8(255)
- 294 00f8 02C0 rjmp .L10
- 295 .L11:
- 94:../avrlib/buffer.c **** }
- 95:../avrlib/buffer.c **** else return 0;
- 297 .LM30:
- 298 00fa 80E0 ldi r24,lo8(0)
- 299 00fc 90E0 ldi r25,hi8(0)
- 300 .L10:
- 301 /* epilogue: frame size=0 */
- 302 00fe DF91 pop r29
- 303 0100 CF91 pop r28
- 304 0102 0895 ret
- 305 /* epilogue end (size=3) */
- 306 /* function bufferAddToEnd size 34 (29) */
- 308 .Lscope4:
- 312 .global bufferIsNotFull
- 314 bufferIsNotFull:
- 96:../avrlib/buffer.c **** }
- 97:../avrlib/buffer.c ****
- 98:../avrlib/buffer.c **** unsigned char bufferIsNotFull(cBuffer* buffer)
- 99:../avrlib/buffer.c **** {
- 316 .LM31:
- 317 /* prologue: frame size=0 */
- 318 /* prologue end (size=0) */
- 319 0104 FC01 movw r30,r24
- 100:../avrlib/buffer.c **** // check to see if the buffer has room
- 101:../avrlib/buffer.c **** // return true if there is room
- 102:../avrlib/buffer.c **** return (buffer->datalength < buffer->size);
- 321 .LM32:
- 322 0106 40E0 ldi r20,lo8(0)
- 323 0108 50E0 ldi r21,hi8(0)
- 324 010a 2481 ldd r18,Z+4
- 325 010c 3581 ldd r19,Z+5
- 326 010e 8281 ldd r24,Z+2
- 327 0110 9381 ldd r25,Z+3
- 328 0112 2817 cp r18,r24
- 329 0114 3907 cpc r19,r25
- 330 0116 10F4 brsh .L14
- 332 .LM33:
- 333 0118 41E0 ldi r20,lo8(1)
- 334 011a 50E0 ldi r21,hi8(1)
- 335 .L14:
- 103:../avrlib/buffer.c **** }
- 337 .LM34:
- 338 011c CA01 movw r24,r20
- 339 /* epilogue: frame size=0 */
- 340 011e 0895 ret
- 341 /* epilogue end (size=1) */
- 342 /* function bufferIsNotFull size 14 (13) */
- 344 .Lscope5:
- 348 .global bufferFlush
- 350 bufferFlush:
- 104:../avrlib/buffer.c ****
- 105:../avrlib/buffer.c **** void bufferFlush(cBuffer* buffer)
- 106:../avrlib/buffer.c **** {
- 352 .LM35:
- 353 /* prologue: frame size=0 */
- 354 /* prologue end (size=0) */
- 107:../avrlib/buffer.c **** // flush contents of the buffer
- 108:../avrlib/buffer.c **** buffer->datalength = 0;
- 356 .LM36:
- 357 0120 FC01 movw r30,r24
- 358 0122 1482 std Z+4,__zero_reg__
- 359 0124 1582 std Z+5,__zero_reg__
- 360 /* epilogue: frame size=0 */
- 361 0126 0895 ret
- 362 /* epilogue end (size=1) */
- 363 /* function bufferFlush size 4 (3) */
- 365 .Lscope6:
- 367 .text
- 369 Letext:
- 370 /* File "../avrlib/buffer.c": code 148 = 0x0094 ( 129), prologues 6, epilogues 13 */
-DEFINED SYMBOLS
- *ABS*:00000000 buffer.c
- *ABS*:0000003f __SREG__
- *ABS*:0000003e __SP_H__
- *ABS*:0000003d __SP_L__
- *ABS*:00000000 __tmp_reg__
- *ABS*:00000001 __zero_reg__
-/var/tmp//ccWNR2QI.s:46 .text:00000000 bufferInit
-/var/tmp//ccWNR2QI.s:79 .text:00000014 bufferGetFromFront
-/var/tmp//ccWNR2QI.s:152 .text:0000005c bufferDumpFromFront
-/var/tmp//ccWNR2QI.s:216 .text:0000009e bufferGetAtIndex
-/var/tmp//ccWNR2QI.s:253 .text:000000c0 bufferAddToEnd
-/var/tmp//ccWNR2QI.s:314 .text:00000104 bufferIsNotFull
-/var/tmp//ccWNR2QI.s:350 .text:00000120 bufferFlush
-/var/tmp//ccWNR2QI.s:369 .text:00000128 Letext
-
-UNDEFINED SYMBOLS
-__do_copy_data
-__do_clear_bss
-__udivmodhi4
diff --git a/build/shared/lib/avrlib/ccrma/OSC-client.c b/build/shared/lib/avrlib/ccrma/OSC-client.c
deleted file mode 100755
index 814c87ab7..000000000
--- a/build/shared/lib/avrlib/ccrma/OSC-client.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
-Copyright (c) 1996. The Regents of the University of California (Regents).
-All Rights Reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
-Written by Matt Wright, The Center for New Music and Audio Technologies,
-University of California, Berkeley.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
-*/
-
-
-/*
- Author: Matt Wright
- Version 2.2: Calls htonl in the right places 20000620
- Version 2.3: Gets typed messages right.
- */
-
-
-/* Here are the possible values of the state field: */
-
-#define EMPTY 0 /* Nothing written to packet yet */
-#define ONE_MSG_ARGS 1 /* Packet has a single message; gathering arguments */
-#define NEED_COUNT 2 /* Just opened a bundle; must write message name or
- open another bundle */
-#define GET_ARGS 3 /* Getting arguments to a message. If we see a message
- name or a bundle open/close then the current message
- will end. */
-#define DONE 4 /* All open bundles have been closed, so can't write
- anything else */
-
-
-#include "OSC-client.h"
-
-// defines to make this work with the atmel
-//
-#include "progmem.h"
-#include "debug.h"
-//#define printf debug
-//
-
-char *OSC_errorMessage;
-
-static int OSC_padString(char *dest, char PROGMEM *str);
-static int OSC_WritePadding(char *dest, int i);
-static int CheckTypeTag(OSCbuf *buf, char expectedType);
-
-void OSC_initBuffer(OSCbuf *buf, int size, char *byteArray) {
- buf->buffer = byteArray;
- buf->size = size;
- OSC_resetBuffer(buf);
-}
-
-void OSC_resetBuffer(OSCbuf *buf) {
- buf->bufptr = buf->buffer;
- buf->state = EMPTY;
- buf->bundleDepth = 0;
- buf->prevCounts[0] = 0;
- buf->gettingFirstUntypedArg = 0;
- buf->typeStringPtr = 0;
-}
-
-int OSC_isBufferEmpty(OSCbuf *buf) {
- return buf->bufptr == buf->buffer;
-}
-
-int OSC_freeSpaceInBuffer(OSCbuf *buf) {
- return buf->size - (buf->bufptr - buf->buffer);
-}
-
-int OSC_isBufferDone(OSCbuf *buf) {
- return (buf->state == DONE || buf->state == ONE_MSG_ARGS);
-}
-
-char *OSC_getPacket(OSCbuf *buf) {
-#ifdef ERROR_CHECK_GETPACKET
- if (buf->state == DONE || buf->state == ONE_MSG_ARGS) {
- return buf->buffer;
- } else {
- OSC_errorMessage = "Packet has unterminated bundles";
- return 0;
- }
-#else
- return buf->buffer;
-#endif
-}
-
-int OSC_packetSize(OSCbuf *buf) {
-#ifdef ERROR_CHECK_PACKETSIZE
- if (buf->state == DONE || buf->state == ONE_MSG_ARGS) {
- return (buf->bufptr - buf->buffer);
- } else {
- OSC_errorMessage = "Packet has unterminated bundles";
- return 0;
- }
-#else
- return (buf->bufptr - buf->buffer);
-#endif
-}
-
-#define CheckOverflow(buf, bytesNeeded) { \
- if ((bytesNeeded) > OSC_freeSpaceInBuffer(buf)) { \
- OSC_errorMessage = "buffer overflow"; \
- return 1; \
- } \
-}
-
-static void PatchMessageSize(OSCbuf *buf) {
- int4byte size;
- size = buf->bufptr - ((char *) buf->thisMsgSize) - 4;
- *(buf->thisMsgSize) = htonl(size);
-}
-
-int OSC_openBundle(OSCbuf *buf, OSCTimeTag tt) {
- if (buf->state == ONE_MSG_ARGS) {
- OSC_errorMessage = "Can't open a bundle in a one-message packet";
- return 3;
- }
-
- if (buf->state == DONE) {
- OSC_errorMessage = "This packet is finished; can't open a new bundle";
- return 4;
- }
-
- if (++(buf->bundleDepth) >= MAX_BUNDLE_NESTING) {
- OSC_errorMessage = "Bundles nested too deeply; change MAX_BUNDLE_NESTING in OpenSoundControl.h";
- return 2;
- }
-
- if (CheckTypeTag(buf, '\0')) return 9;
-
- if (buf->state == GET_ARGS) {
- PatchMessageSize(buf);
- }
-
- if (buf->state == EMPTY) {
- /* Need 16 bytes for "#bundle" and time tag */
- CheckOverflow(buf, 16);
- } else {
- /* This bundle is inside another bundle, so we need to leave
- a blank size count for the size of this current bundle. */
- CheckOverflow(buf, 20);
- *((int4byte *)buf->bufptr) = 0xaaaaaaaa;
- buf->prevCounts[buf->bundleDepth] = (int4byte *)buf->bufptr;
-
- buf->bufptr += 4;
- }
-
- buf->bufptr += OSC_padString(buf->bufptr, "#bundle");
-
-
- *((OSCTimeTag *) buf->bufptr) = tt;
-
- if (htonl(1L) != 1L) {
- /* Byte swap the 8-byte integer time tag */
- int4byte *intp = (int4byte *)buf->bufptr;
- intp[0] = htonl(intp[0]);
- intp[1] = htonl(intp[1]);
-
-#ifdef HAS8BYTEINT
- { /* tt is a 64-bit int so we have to swap the two 32-bit words.
- (Otherwise tt is a struct of two 32-bit words, and even though
- each word was wrong-endian, they were in the right order
- in the struct.) */
- int4byte temp = intp[0];
- intp[0] = intp[1];
- intp[1] = temp;
- }
-#endif
- }
-
- buf->bufptr += sizeof(OSCTimeTag);
-
- buf->state = NEED_COUNT;
-
- buf->gettingFirstUntypedArg = 0;
- buf->typeStringPtr = 0;
- return 0;
-}
-
-
-int OSC_closeBundle(OSCbuf *buf) {
- if (buf->bundleDepth == 0) {
- /* This handles EMPTY, ONE_MSG, ARGS, and DONE */
- OSC_errorMessage = "Can't close bundle; no bundle is open!";
- return 5;
- }
-
- if (CheckTypeTag(buf, '\0')) return 9;
-
- if (buf->state == GET_ARGS) {
- PatchMessageSize(buf);
- }
-
- if (buf->bundleDepth == 1) {
- /* Closing the last bundle: No bundle size to patch */
- buf->state = DONE;
- } else {
- /* Closing a sub-bundle: patch bundle size */
- int4byte size = buf->bufptr - ((char *) buf->prevCounts[buf->bundleDepth]) - 4;
- *(buf->prevCounts[buf->bundleDepth]) = htonl(size);
- buf->state = NEED_COUNT;
- }
-
- --buf->bundleDepth;
- buf->gettingFirstUntypedArg = 0;
- buf->typeStringPtr = 0;
- return 0;
-}
-
-
-int OSC_closeAllBundles(OSCbuf *buf) {
- if (buf->bundleDepth == 0) {
- /* This handles EMPTY, ONE_MSG, ARGS, and DONE */
- OSC_errorMessage = "Can't close all bundles; no bundle is open!";
- return 6;
- }
-
- if (CheckTypeTag(buf, '\0')) return 9;
-
- while (buf->bundleDepth > 0) {
- OSC_closeBundle(buf);
- }
- buf->typeStringPtr = 0;
- return 0;
-}
-
-int OSC_writeAddress(OSCbuf *buf, char PROGMEM *name) {
- int4byte paddedLength;
-
- if (buf->state == ONE_MSG_ARGS) {
- //debug(PSTR("This packet is not a bundle, so you can't write another address"));
- return 7;
- }
-
- if (buf->state == DONE) {
- //debug(PSTR("This packet is finished; can't write another address"));
- return 8;
- }
-
- if (CheckTypeTag(buf, '\0')) return 9;
-
- paddedLength = OSC_effectiveStringLength(name);
-
- if (buf->state == EMPTY) {
- /* This will be a one-message packet, so no sizes to worry about */
- CheckOverflow(buf, paddedLength);
- buf->state = ONE_MSG_ARGS;
- } else {
- /* GET_ARGS or NEED_COUNT */
- CheckOverflow(buf, 4+paddedLength);
- if (buf->state == GET_ARGS) {
- /* Close the old message */
- PatchMessageSize(buf);
- }
- buf->thisMsgSize = (int4byte *)buf->bufptr;
- *(buf->thisMsgSize) = 0xbbbbbbbb;
- buf->bufptr += 4;
- buf->state = GET_ARGS;
- }
-
- /* Now write the name */
- buf->bufptr += OSC_padString(buf->bufptr, name);
- buf->typeStringPtr = 0;
- buf->gettingFirstUntypedArg = 1;
-
- return 0;
-}
-
-int OSC_writeAddressAndTypes(OSCbuf *buf, char PROGMEM *name, char PROGMEM *types) {
- int result;
- int4byte paddedLength;
-
- if (CheckTypeTag(buf, '\0')) return 9;
-
- result = OSC_writeAddress(buf, name);
-
- if (result) return result;
-
- paddedLength = OSC_effectiveStringLength(types);
-
- CheckOverflow(buf, paddedLength);
-
- buf->typeStringPtr = buf->bufptr + 1; /* skip comma */
- buf->bufptr += OSC_padString(buf->bufptr, types);
-
- buf->gettingFirstUntypedArg = 0;
- return 0;
-}
-
-static int CheckTypeTag(OSCbuf *buf, char expectedType) {
- if (buf->typeStringPtr) {
- if (*(buf->typeStringPtr) != expectedType) {
- if (expectedType == '\0') {
- OSC_errorMessage =
- "According to the type tag I expected more arguments.";
- } else if (*(buf->typeStringPtr) == '\0') {
- OSC_errorMessage =
- "According to the type tag I didn't expect any more arguments.";
- } else {
- OSC_errorMessage =
- "According to the type tag I expected an argument of a different type.";
-// printf("* Expected %c, string now %s\n", expectedType, buf->typeStringPtr);
- }
- return 9;
- }
- ++(buf->typeStringPtr);
- }
- return 0;
-}
-
-
-int OSC_writeFloatArg(OSCbuf *buf, float arg) {
- int4byte *intp;
-
- CheckOverflow(buf, 4);
-
- if (CheckTypeTag(buf, 'f')) return 9;
-
- /* Pretend arg is a long int so we can use htonl() */
- intp = ((int4byte *) &arg);
- *((int4byte *) buf->bufptr) = htonl(*intp);
-
- buf->bufptr += 4;
-
- buf->gettingFirstUntypedArg = 0;
- return 0;
-}
-
-
-
-int OSC_writeFloatArgs(OSCbuf *buf, int numFloats, float *args) {
- int i;
- int4byte *intp;
-
- CheckOverflow(buf, 4 * numFloats);
-
- /* Pretend args are long ints so we can use htonl() */
- intp = ((int4byte *) args);
-
- for (i = 0; i < numFloats; i++) {
- if (CheckTypeTag(buf, 'f')) return 9;
- *((int4byte *) buf->bufptr) = htonl(intp[i]);
- buf->bufptr += 4;
- }
-
- buf->gettingFirstUntypedArg = 0;
- return 0;
-}
-
-int OSC_writeIntArg(OSCbuf *buf, int4byte arg) {
- CheckOverflow(buf, 4);
- if (CheckTypeTag(buf, 'i')) return 9;
-
- *((int4byte *) buf->bufptr) = htonl(arg);
- buf->bufptr += 4;
-
- buf->gettingFirstUntypedArg = 0;
- return 0;
-}
-
-int OSC_writeStringArg(OSCbuf *buf, char PROGMEM *arg) {
- int len;
-
- if (CheckTypeTag(buf, 's')) return 9;
-
- len = OSC_effectiveStringLength(arg);
-
- CheckOverflow(buf, len);
- buf->bufptr += OSC_padString(buf->bufptr, arg);
-
- buf->gettingFirstUntypedArg = 0;
- return 0;
-
-}
-
-#define STRING_ALIGN_PAD 4
-int OSC_effectiveStringLength(char PROGMEM *string) {
- int len = strlen_P(string) + 1; /* We need space for the null char. */
-
- /* Round up len to next multiple of STRING_ALIGN_PAD to account for alignment padding */
- if ((len % STRING_ALIGN_PAD) != 0) {
- len += STRING_ALIGN_PAD - (len % STRING_ALIGN_PAD);
- }
- return len;
-}
-
-static int OSC_padString(char *dest, char PROGMEM *str) {
- int i;
- char c;
-
- for (i = 0; (c = pgm_read_byte(str+i)) != '\0'; i++) {
- dest[i] = c;
- }
-
- return OSC_WritePadding(dest, i);
-}
-
-static int OSC_WritePadding(char *dest, int i) {
- dest[i] = '\0';
- i++;
-
- for (; (i % STRING_ALIGN_PAD) != 0; i++) {
- dest[i] = '\0';
- }
-
- return i;
-}
diff --git a/build/shared/lib/avrlib/ccrma/OSC-client.h b/build/shared/lib/avrlib/ccrma/OSC-client.h
deleted file mode 100755
index 6ec066d43..000000000
--- a/build/shared/lib/avrlib/ccrma/OSC-client.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
-Copyright (c) 1996,1997. The Regents of the University of California (Regents).
-All Rights Reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
-Written by Matt Wright, The Center for New Music and Audio Technologies,
-University of California, Berkeley.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
-*/
-
-/*
-
- OSC-client.h: library for constructing OpenSoundControl messages.
- Derived from SynthControl.h
- Author: Matt Wright
- Version 0.1: 6/13/97
- Version 0.2: 7/21/2000: Support for type-tagged messages
-
-
- General notes:
-
- This library abstracts away the data format for the OpenSoundControl
- protocol. Users of this library can construct OpenSoundControl packets
- with a function call interface instead of knowing how to lay out the bits.
-
- All issues of memory allocation are deferred to the user of this library.
- There are two data structures that the user must allocate. The first
- is the actual buffer that the message will be written into. This buffer
- can be any size, but if it's too small there's a possibility that it
- will become overfull. The other data structure is called an OSCbuf,
- and it holds all the state used by the library as it's constructing
- a buffer.
-
- All procedures that have the possibility of an error condition return int,
- with 0 indicating no error and nonzero indicating an error. The variable
- OSC_errorMessage will be set to point to a string containing an error
- message explaining what the problem is.
-
-*/
-
-
-#include "OSC-timetag.h"
-#include "global.h"
-#include
-
-#define ATMEL
-
-#ifdef ATMEL
-#define htonl(x) \
- ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \
- (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
-
-#endif
-
-/* The int4byte type has to be a 4-byte integer. You may have to
- change this to long or something else on your system. */
-#ifdef __MWERKS__
- /* In Metrowerks you can set ints to be 2 or 4 bytes on 68K, but long is
- always 4 bytes */
- typedef long int4byte;
-#else
- typedef s32 int4byte;
-#endif
-
-/* The maximum depth of bundles within bundles within bundles within...
- This is the size of a static array. If you exceed this limit you'll
- get an error message. */
-#define MAX_BUNDLE_NESTING 32
-
-
-/* Don't ever manipulate the data in the OSCbuf struct directly. (It's
- declared here in the header file only so your program will be able to
- declare variables of type OSCbuf and have the right amount of memory
- be allocated.) */
-
-typedef struct OSCbuf_struct {
- char *buffer; /* The buffer to hold the OSC packet */
- int size; /* Size of the buffer */
- char *bufptr; /* Current position as we fill the buffer */
- int state; /* State of partially-constructed message */
- int4byte *thisMsgSize; /* Pointer to count field before
- currently-being-written message */
- int4byte *prevCounts[MAX_BUNDLE_NESTING];
- /* Pointers to count field before each currently
- open bundle */
- int bundleDepth; /* How many sub-sub-bundles are we in now? */
- char *typeStringPtr; /* This pointer advances through the type
- tag string as you add arguments. */
- int gettingFirstUntypedArg; /* nonzero if this message doesn't have
- a type tag and we're waiting for the 1st arg */
-} OSCbuf;
-
-
-
-/* Initialize the given OSCbuf. The user of this module must pass in the
- block of memory that this OSCbuf will use for a buffer, and the number of
- bytes in that block. (It's the user's job to allocate the memory because
- you do it differently in different systems.) */
-void OSC_initBuffer(OSCbuf *buf, int size, char *byteArray);
-
-
-/* Reset the given OSCbuf. Do this after you send out the contents of
- the buffer and want to start writing new data into it. */
-void OSC_resetBuffer(OSCbuf *buf);
-
-
-/* Is the buffer empty? (I.e., would it be stupid to send the buffer
- contents to the synth?) */
-int OSC_isBufferEmpty(OSCbuf *buf);
-
-
-/* How much space is left in the buffer? */
-int OSC_freeSpaceInBuffer(OSCbuf *buf);
-
-/* Does the buffer contain a valid OSC packet? (Returns nonzero if yes.) */
-int OSC_isBufferDone(OSCbuf *buf);
-
-/* When you're ready to send out the buffer (i.e., when OSC_isBufferDone()
- returns true), call these two procedures to get the OSC packet that's been
- assembled and its size in bytes. (And then call OSC_resetBuffer() if you
- want to re-use this OSCbuf for the next packet.) */
-char *OSC_getPacket(OSCbuf *buf);
-int OSC_packetSize(OSCbuf *buf);
-
-
-
-/* Here's the basic model for building up OSC messages in an OSCbuf:
-
- - Make sure the OSCbuf has been initialized with OSC_initBuffer().
-
- - To open a bundle, call OSC_openBundle(). You can then write
- messages or open new bundles within the bundle you opened.
- Call OSC_closeBundle() to close the bundle. Note that a packet
- does not have to have a bundle; it can instead consist of just a
- single message.
-
-
- - For each message you want to send:
-
- - Call OSC_writeAddress() with the name of your message. (In
- addition to writing your message name into the buffer, this
- procedure will also leave space for the size count of this message.)
-
- - Alternately, call OSC_writeAddressAndTypes() with the name of
- your message and with a type string listing the types of all the
- arguments you will be putting in this message.
-
- - Now write each of the arguments into the buffer, by calling one of:
- OSC_writeFloatArg()
- OSC_writeFloatArgs()
- OSC_writeIntArg()
- OSC_writeStringArg()
-
- - Now your message is complete; you can send out the buffer or you can
- add another message to it.
-*/
-
-int OSC_openBundle(OSCbuf *buf, OSCTimeTag tt);
-int OSC_closeBundle(OSCbuf *buf);
-int OSC_closeAllBundles(OSCbuf *buf);
-
-int OSC_writeAddress(OSCbuf *buf, char PROGMEM *name);
-int OSC_writeAddressAndTypes(OSCbuf *buf, char PROGMEM *name, char PROGMEM *types);
-int OSC_writeFloatArg(OSCbuf *buf, float arg);
-int OSC_writeFloatArgs(OSCbuf *buf, int numFloats, float *args);
-int OSC_writeIntArg(OSCbuf *buf, int4byte arg);
-int OSC_writeStringArg(OSCbuf *buf, char PROGMEM *arg);
-
-extern char *OSC_errorMessage;
-
-/* How many bytes will be needed in the OSC format to hold the given
- string? The length of the string, plus the null char, plus any padding
- needed for 4-byte alignment. */
-int OSC_effectiveStringLength(char PROGMEM *string);
diff --git a/build/shared/lib/avrlib/ccrma/OSC-timetag.c b/build/shared/lib/avrlib/ccrma/OSC-timetag.c
deleted file mode 100755
index 639eae93a..000000000
--- a/build/shared/lib/avrlib/ccrma/OSC-timetag.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
-Copyright (c) 1998. The Regents of the University of California (Regents).
-All Rights Reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
-Written by Matt Wright, The Center for New Music and Audio Technologies,
-University of California, Berkeley.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
-
-The OpenSound Control WWW page is
- http://www.cnmat.berkeley.edu/OpenSoundControl
-*/
-
-/*
-
- OSC_timeTag.c: library for manipulating OSC time tags
- Matt Wright, 5/29/97
-
- Version 0.2 (9/11/98): cleaned up so no explicit type names in the .c file.
-
-*/
-
-#include "OSC-timetag.h"
-
-
-#ifdef HAS8BYTEINT
-#define TWO_TO_THE_32_FLOAT 4294967296.0f
-
-OSCTimeTag OSCTT_Immediately(void) {
- return (OSCTimeTag) 1;
-}
-
-OSCTimeTag OSCTT_BiggestPossibleTimeTag(void) {
- return (OSCTimeTag) 0xffffffffffffffff;
-}
-
-OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) {
- int64 offset = (int64) (secondsOffset * TWO_TO_THE_32_FLOAT);
-
-/* printf("* OSCTT_PlusSeconds %llx plus %f seconds (i.e., %lld offset) is %llx\n", original,
- secondsOffset, offset, original + offset); */
-
- return original + offset;
-}
-
-int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right) {
-#if 0
- printf("***** OSCTT_Compare(%llx, %llx): %d\n", left, right,
- (left
-
-#define SECONDS_FROM_1900_to_1970 2208988800 /* 17 leap years */
-#define TWO_TO_THE_32_OVER_ONE_MILLION 4295
-
-
-OSCTimeTag OSCTT_CurrentTime(void) {
- uint64 result;
- uint32 usecOffset;
- struct timeval tv;
- struct timezone tz;
-
- BSDgettimeofday(&tv, &tz);
-
- /* First get the seconds right */
- result = (unsigned) SECONDS_FROM_1900_to_1970 +
- (unsigned) tv.tv_sec -
- (unsigned) 60 * tz.tz_minuteswest +
- (unsigned) (tz.tz_dsttime ? 3600 : 0);
-
-#if 0
- /* No timezone, no DST version ... */
- result = (unsigned) SECONDS_FROM_1900_to_1970 +
- (unsigned) tv.tv_sec;
-#endif
-
-
- /* make seconds the high-order 32 bits */
- result = result << 32;
-
- /* Now get the fractional part. */
- usecOffset = (unsigned) tv.tv_usec * (unsigned) TWO_TO_THE_32_OVER_ONE_MILLION;
- /* printf("** %ld microsec is offset %x\n", tv.tv_usec, usecOffset); */
-
- result += usecOffset;
-
-/* printf("* OSCTT_CurrentTime is %llx\n", result); */
- return result;
-}
-
-#else /* __sgi */
-
-/* Instead of asking your operating system what time it is, it might be
- clever to find out the current time at the instant your application
- starts audio processing, and then keep track of the number of samples
- output to know how much time has passed. */
-
-/* Loser version for systems that have no ability to tell the current time: */
-OSCTimeTag OSCTT_CurrentTime(void) {
- return (OSCTimeTag) 1;
-}
-
-#endif /* __sgi */
-
-
-#else /* Not HAS8BYTEINT */
-
-OSCTimeTag OSCTT_CurrentTime(void) {
- OSCTimeTag result;
- result.seconds = 0;
- result.fraction = 1;
- return result;
-}
-
-OSCTimeTag OSCTT_BiggestPossibleTimeTag(void) {
- OSCTimeTag result;
- result.seconds = 0xffffffff;
- result.fraction = 0xffffffff;
- return result;
-}
-
-OSCTimeTag OSCTT_Immediately(void) {
- OSCTimeTag result;
- result.seconds = 0;
- result.fraction = 1;
- return result;
-}
-
-OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) {
- OSCTimeTag result;
- result.seconds = 0;
- result.fraction = 1;
- return result;
-}
-
-int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right) {
- /* Untested! */
- int highResult = left.seconds - right.seconds;
-
- if (highResult != 0) return highResult;
-
- return left.fraction - right.fraction;
-}
-
-
-#endif /* HAS8BYTEINT */
-
diff --git a/build/shared/lib/avrlib/ccrma/OSC-timetag.h b/build/shared/lib/avrlib/ccrma/OSC-timetag.h
deleted file mode 100755
index 646299ca1..000000000
--- a/build/shared/lib/avrlib/ccrma/OSC-timetag.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-Copyright (c) 1998. The Regents of the University of California (Regents).
-All Rights Reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
-Written by Matt Wright, The Center for New Music and Audio Technologies,
-University of California, Berkeley.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
-
-The OpenSound Control WWW page is
- http://www.cnmat.berkeley.edu/OpenSoundControl
-*/
-
-/*
- OSC_timeTag.h: library for manipulating OSC time tags
- Matt Wright, 5/29/97
-
- Time tags in OSC have the same format as in NTP: 64 bit fixed point, with the
- top 32 bits giving number of seconds sinve midnight 1/1/1900 and the bottom
- 32 bits giving fractional parts of a second. We represent this by a 64-bit
- unsigned long if possible, or else a struct.
-
- NB: On many architectures with 64-bit ints, it's illegal (like maybe a bus error)
- to dereference a pointer to a 64-bit int that's not 64-bit aligned.
-*/
-
-#ifndef OSC_TIMETAG
-#define OSC_TIMETAG
-
-#include
-
-#ifdef __sgi
- #define HAS8BYTEINT
- /* You may have to change this typedef if there's some other
- way to specify 64 bit ints on your system */
- typedef long long int64;
- typedef unsigned long long uint64;
- typedef unsigned long uint32;
-#else
- /* You may have to redefine this typedef if ints on your system
- aren't 32 bits. */
- typedef uint32_t uint32;
-#endif
-
-
-#ifdef HAS8BYTEINT
- typedef uint64 OSCTimeTag;
-#else
- typedef struct {
- uint32 seconds;
- uint32 fraction;
- } OSCTimeTag;
-#endif
-
-
-
-/* Return a time tag representing the current time (as of when this
- procedure is called). */
-OSCTimeTag OSCTT_CurrentTime(void);
-
-/* Return the time tag 0x0000000000000001, indicating to the receiving device
- that it should process the message immediately. */
-OSCTimeTag OSCTT_Immediately(void);
-
-/* Return the time tag 0xffffffffffffffff, a time so far in the future that
- it's effectively infinity. */
-OSCTimeTag OSCTT_BiggestPossibleTimeTag(void);
-
-/* Given a time tag and a number of seconds to add to the time tag, return
- the new time tag */
-OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset);
-
-/* Compare two time tags. Return negative if first is < second, 0 if
- they're equal, and positive if first > second. */
-int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right);
-
-#endif /* OSC_TIMETAG */
diff --git a/build/shared/lib/avrlib/ccrma/debug.c b/build/shared/lib/avrlib/ccrma/debug.c
deleted file mode 100755
index c01f4451c..000000000
--- a/build/shared/lib/avrlib/ccrma/debug.c
+++ /dev/null
@@ -1,55 +0,0 @@
-
-#include
-#include
-
-#include "debug.h"
-#include "lcd.h"
-#include "rprintf.h"
-#include "timer.h"
-#include "osc.h"
-
-
-u08 debugMode = 0;
-u08 lcdDebugX;
-u08 lcdDebugY;
-
-void debugInitLCD(u08 x, u08 y) {
- lcdInit();
- lcdClear();
-
- lcdDebugX = x;
- lcdDebugY = y;
-
- debugMode |= DEBUG_MODE_LCD;
-
- debug(PSTR("LCD Debug init()"));
-}
-
-void debugInitOSC(void) {
- oscInit();
- debugMode |= DEBUG_MODE_OSC;
-}
-
-void debug(const char PROGMEM *fmt) {
- int code;
-
- if (debugMode & DEBUG_MODE_OSC) {
- oscSendMessageString("/debug",fmt);
- }
- if (debugMode & DEBUG_MODE_LCD) {
- rprintfInit(&lcdDataWrite);
- lcdGotoXY(lcdDebugX,lcdDebugY);
- rprintf1RamRom(STRING_IN_ROM, fmt);
- }
-
-}
-
-// debugFlush assumes that timerInit() have been called already
-void debugFlash(const u08 port, const u08 pin) {
- sbi(DDR(port), pin);
- cbi(port, pin);
- timerPause(500);
- sbi(port, pin);
-}
-
-
diff --git a/build/shared/lib/avrlib/ccrma/debug.h b/build/shared/lib/avrlib/ccrma/debug.h
deleted file mode 100755
index 022f506a8..000000000
--- a/build/shared/lib/avrlib/ccrma/debug.h
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-#ifndef _DEBUG_H
-#define _DEBUG_H
-
-#include
-#include "global.h"
-
-#define DEBUG_MODE_LCD 0x01
-#define DEBUG_MODE_SERIAL 0x02
-#define DEBUG_MODE_OSC 0x04
-
-void debugInitLCD(u08 x, u08 y);
-
-void debugInitOSC(void);
-
-void debug(const char * fmt);
-
-void debugFlash(u08 port, u08 pin);
-
-#endif
-
diff --git a/build/shared/lib/avrlib/ccrma/midi.c b/build/shared/lib/avrlib/ccrma/midi.c
deleted file mode 100755
index d91792de5..000000000
--- a/build/shared/lib/avrlib/ccrma/midi.c
+++ /dev/null
@@ -1,48 +0,0 @@
-// Midi.c
-//
-// Midi output routines for the atmel atmega163 (and others)
-//
-// depends on avrlib for buffer
-//
-
-#include "uart.h"
-#include "midi.h"
-#include "debug.h"
-
-
-void midiInit() {
- uartInit();
- uartSetBaudRate(MIDI_BAUD_RATE);
-}
-
-u08 midiNoteOnOut(u08 note, u08 vel, u08 channel) {
- uartSendByte(MIDI_NOTE_ON | (channel & MIDI_CHANNEL_MASK));
- uartSendByte(MIDI_DATA_MASK & note);
- uartSendByte(MIDI_DATA_MASK & vel);
-
- return 0;
-}
-
-u08 midiNoteOffOut(u08 note, u08 vel, u08 channel) {
- uartSendByte(MIDI_NOTE_OFF | (channel & MIDI_CHANNEL_MASK));
- uartSendByte(MIDI_DATA_MASK & note);
- uartSendByte(MIDI_DATA_MASK & vel);
-
- return 0;
-}
-
-u08 midiControlChangeOut(u08 controller, u08 value, u08 channel) {
- uartSendByte(MIDI_CONTROL_CHANGE | (channel & MIDI_CHANNEL_MASK));
- uartSendByte(MIDI_DATA_MASK & controller);
- uartSendByte(MIDI_DATA_MASK & value);
-
- return 0;
-}
-
-u08 midiProgramChangeOut(u08 program, u08 channel) {
- uartSendByte(MIDI_PROGRAM_CHANGE | (channel & MIDI_CHANNEL_MASK));
- uartSendByte(MIDI_DATA_MASK & program);
-
- return 0;
-}
-
diff --git a/build/shared/lib/avrlib/ccrma/midi.h b/build/shared/lib/avrlib/ccrma/midi.h
deleted file mode 100755
index 0305e723d..000000000
--- a/build/shared/lib/avrlib/ccrma/midi.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _MIDI_H
-#define _MIDI_H
-
-#define MIDI_NOTE_ON 0x90
-#define MIDI_NOTE_OFF 0x80
-
-// 1001cccc 0nnnnnnn 0vvvvvvv
-#define MIDI_POLY_PRESSURE 0xA0
-// 1011cccc 0nnnnnnn 0vvvvvvv
-#define MIDI_CONTROL_CHANGE 0xB0
-// 1100cccc 0ppppppp
-#define MIDI_PROGRAM_CHANGE 0xC0
-
-#define MIDI_DATA_MASK 0x7F
-#define MIDI_STATUS_MASK 0xF0
-#define MIDI_CHANNEL_MASK 0x0F
-
-#define MIDI_BAUD_RATE 31250
-
-#include "global.h"
-#include "buffer.h"
-
-void midiInit(void);
-u08 midiNoteOnOut(u08 note, u08 vel, u08 channel);
-u08 midiNoteOffOut(u08 note, u08 vel, u08 channel);
-u08 midiControlChangeOut(u08 controller, u08 value, u08 channel);
-u08 midiProgramChangeOut(u08 program, u08 channel);
-
-
-#endif
diff --git a/build/shared/lib/avrlib/ccrma/osc.c b/build/shared/lib/avrlib/ccrma/osc.c
deleted file mode 100755
index 7ba977074..000000000
--- a/build/shared/lib/avrlib/ccrma/osc.c
+++ /dev/null
@@ -1,96 +0,0 @@
-// osc.c
-//
-// Open Sound Control message sending fn's for avrmini
-//
-// Scott Wilson
-// July 21, 2002
-//
-
-#include
-#include
-#include "OSC-client.h"
-#include "osc.h"
-//#include "debug.h"
-#include "uart.h"
-
-#define OSC_BUFFER_LEN 40
-
-void _oscSendPacket();
-
-u08 oscDataBuffer[OSC_BUFFER_LEN];
-OSCbuf oscbuf;
-
-void oscInit() {
- uartInit();
- OSC_initBuffer(&oscbuf, OSC_BUFFER_LEN, oscDataBuffer);
-// debug(PSTR("OSC init ok packet"));
-}
-
-
-// call oscInit() and uartInit() before using this function
-void oscSendMessage(const char PROGMEM *address) {
- OSC_writeAddress(&oscbuf, address);
-
- _oscSendPacket();
-}
-
-void oscSendMessageInt(const char PROGMEM *address, s32 arg) {
- OSC_writeAddress(&oscbuf, address);
-
- OSC_writeIntArg(&oscbuf, arg);
-
- _oscSendPacket();
-}
-
-void oscSendMessageIntInt(const char PROGMEM *address, s32 arg, s32 arg2) {
- OSC_writeAddress(&oscbuf, address);
-
- OSC_writeIntArg(&oscbuf, arg);
- OSC_writeIntArg(&oscbuf, arg2);
-
- _oscSendPacket();
-}
-
-void oscSendMessageString(const char PROGMEM *address, const char PROGMEM *arg) {
- OSC_writeAddress(&oscbuf, address);
-
- OSC_writeStringArg(&oscbuf, arg);
-
- _oscSendPacket();
-}
-
-
-void _oscSendPacket() {
- u08 j;
- u08 *oscDataPtr;
- u08 oscPacketSize;
- register u08 checksum=0;
- register u08 data;
-
- // send the packet
- if (OSC_isBufferDone(&oscbuf)) {
- // begin packet sync byte
- uartSendByte((u08)0xbe);
-
- // send length byte
- uartSendByte((u08)(OSC_BUFFER_LEN - OSC_freeSpaceInBuffer(&oscbuf)));
-
- oscDataPtr = OSC_getPacket(&oscbuf);
- oscPacketSize = OSC_packetSize(&oscbuf);
-// debug(PSTR("packet size: %x"),(unsigned int)oscPacketSize);
- for (j=0; j
-
-#define oscSendMessageOneArg oscSendMessageInt
-
-void oscInit(void);
-void oscSendMessage(const char PROGMEM *address);
-void oscSendMessageInt(const char PROGMEM *address, s32 arg);
-void oscSendMessageIntInt(const char PROGMEM *address, s32 arg, s32 arg2);
-void oscSendMessageString(const char PROGMEM *address, const char PROGMEM *arg);
-
-
-#endif
diff --git a/build/shared/lib/avrlib/cmdline.c b/build/shared/lib/avrlib/cmdline.c
deleted file mode 100755
index dc4874d94..000000000
--- a/build/shared/lib/avrlib/cmdline.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/*! \file cmdline.c \brief Command-Line Interface Library. */
-//*****************************************************************************
-//
-// File Name : 'cmdline.c'
-// Title : Command-Line Interface Library
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.07.16
-// Revised : 2003.07.23
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-//----- Include Files ---------------------------------------------------------
-#include // include I/O definitions (port names, pin names, etc)
-#include // include "signal" names (interrupt names)
-#include // include interrupt support
-#include // include AVR program memory support
-#include // include standard C string functions
-#include // include stdlib for string conversion functions
-
-#include "global.h" // include our global settings
-#include "cmdline.h"
-
-// include project-specific configuration
-#include "cmdlineconf.h"
-
-// defines
-#define ASCII_BEL 0x07
-#define ASCII_BS 0x08
-#define ASCII_CR 0x0D
-#define ASCII_LF 0x0A
-#define ASCII_ESC 0x1B
-#define ASCII_DEL 0x7F
-
-#define VT100_ARROWUP 'A'
-#define VT100_ARROWDOWN 'B'
-#define VT100_ARROWRIGHT 'C'
-#define VT100_ARROWLEFT 'D'
-
-#define CMDLINE_HISTORY_SAVE 0
-#define CMDLINE_HISTORY_PREV 1
-#define CMDLINE_HISTORY_NEXT 2
-
-
-// Global variables
-
-// strings
-u08 PROGMEM CmdlinePrompt[] = "cmd>";
-u08 PROGMEM CmdlineNotice[] = "cmdline: ";
-u08 PROGMEM CmdlineCmdNotFound[] = "command not found";
-
-// command list
-// -commands are null-terminated strings
-static char CmdlineCommandList[CMDLINE_MAX_COMMANDS][CMDLINE_MAX_CMD_LENGTH];
-// command function pointer list
-static CmdlineFuncPtrType CmdlineFunctionList[CMDLINE_MAX_COMMANDS];
-// number of commands currently registered
-u08 CmdlineNumCommands;
-
-u08 CmdlineBuffer[CMDLINE_BUFFERSIZE];
-u08 CmdlineBufferLength;
-u08 CmdlineBufferEditPos;
-u08 CmdlineInputVT100State;
-u08 CmdlineHistory[CMDLINE_HISTORYSIZE][CMDLINE_BUFFERSIZE];
-CmdlineFuncPtrType CmdlineExecFunction;
-
-// Functions
-
-// function pointer to single character output routine
-static void (*cmdlineOutputFunc)(unsigned char c);
-
-void cmdlineInit(void)
-{
- // reset vt100 processing state
- CmdlineInputVT100State = 0;
- // initialize input buffer
- CmdlineBufferLength = 0;
- CmdlineBufferEditPos = 0;
- // initialize executing function
- CmdlineExecFunction = 0;
- // initialize command list
- CmdlineNumCommands = 0;
-}
-
-void cmdlineAddCommand(u08* newCmdString, CmdlineFuncPtrType newCmdFuncPtr)
-{
- // add command string to end of command list
- strcpy(CmdlineCommandList[CmdlineNumCommands], newCmdString);
- // add command function ptr to end of function list
- CmdlineFunctionList[CmdlineNumCommands] = newCmdFuncPtr;
- // increment number of registered commands
- CmdlineNumCommands++;
-}
-
-void cmdlineSetOutputFunc(void (*output_func)(unsigned char c))
-{
- // set new output function
- cmdlineOutputFunc = output_func;
-
- // should we really do this?
- // print a prompt
- //cmdlinePrintPrompt();
-}
-
-void cmdlineInputFunc(unsigned char c)
-{
- u08 i;
- // process the received character
-
- // VT100 handling
- // are we processing a VT100 command?
- if(CmdlineInputVT100State == 2)
- {
- // we have already received ESC and [
- // now process the vt100 code
- switch(c)
- {
- case VT100_ARROWUP:
- cmdlineDoHistory(CMDLINE_HISTORY_PREV);
- break;
- case VT100_ARROWDOWN:
- cmdlineDoHistory(CMDLINE_HISTORY_NEXT);
- break;
- case VT100_ARROWRIGHT:
- // if the edit position less than current string length
- if(CmdlineBufferEditPos < CmdlineBufferLength)
- {
- // increment the edit position
- CmdlineBufferEditPos++;
- // move cursor forward one space (no erase)
- cmdlineOutputFunc(ASCII_ESC);
- cmdlineOutputFunc('[');
- cmdlineOutputFunc(VT100_ARROWRIGHT);
- }
- else
- {
- // else, ring the bell
- cmdlineOutputFunc(ASCII_BEL);
- }
- break;
- case VT100_ARROWLEFT:
- // if the edit position is non-zero
- if(CmdlineBufferEditPos)
- {
- // decrement the edit position
- CmdlineBufferEditPos--;
- // move cursor back one space (no erase)
- cmdlineOutputFunc(ASCII_BS);
- }
- else
- {
- // else, ring the bell
- cmdlineOutputFunc(ASCII_BEL);
- }
- break;
- default:
- break;
- }
- // done, reset state
- CmdlineInputVT100State = 0;
- return;
- }
- else if(CmdlineInputVT100State == 1)
- {
- // we last received [ESC]
- if(c == '[')
- {
- CmdlineInputVT100State = 2;
- return;
- }
- else
- CmdlineInputVT100State = 0;
- }
- else
- {
- // anything else, reset state
- CmdlineInputVT100State = 0;
- }
-
- // Regular handling
- if( (c >= 0x20) && (c < 0x7F) )
- {
- // character is printable
- // is this a simple append
- if(CmdlineBufferEditPos == CmdlineBufferLength)
- {
- // echo character to the output
- cmdlineOutputFunc(c);
- // add it to the command line buffer
- CmdlineBuffer[CmdlineBufferEditPos++] = c;
- // update buffer length
- CmdlineBufferLength++;
- }
- else
- {
- // edit/cursor position != end of buffer
- // we're inserting characters at a mid-line edit position
- // make room at the insert point
- CmdlineBufferLength++;
- for(i=CmdlineBufferLength; i>CmdlineBufferEditPos; i--)
- CmdlineBuffer[i] = CmdlineBuffer[i-1];
- // insert character
- CmdlineBuffer[CmdlineBufferEditPos++] = c;
- // repaint
- cmdlineRepaint();
- // reposition cursor
- for(i=CmdlineBufferEditPos; i PD2 (PORTD, pin 2)
-// INT1 -> PD3 (PORTD, pin 3)
-//
-// The external interrupt pins on the processors mega128 and mega64 are:
-//
-// INT0 -> PD0 (PORTD, pin 0)
-// INT1 -> PD1 (PORTD, pin 1)
-// INT2 -> PD2 (PORTD, pin 2)
-// INT3 -> PD3 (PORTD, pin 3)
-// INT4 -> PE4 (PORTE, pin 4)
-// INT5 -> PE5 (PORTE, pin 5)
-// INT6 -> PE6 (PORTE, pin 6)
-// INT7 -> PE7 (PORTE, pin 7)
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef ENCODERCONF_H
-#define ENCODERCONF_H
-
-// constants/macros/typdefs
-
-// defines for processor compatibility
-// quick compatiblity for mega128, mega64
-//#ifndef MCUCR
-// #define MCUCR EICRA
-//#endif
-
-// Set the total number of encoders you wish to support
-#define NUM_ENCODERS 2
-
-
-// -------------------- Encoder 0 connections --------------------
-// Phase A quadrature encoder output should connect to this interrupt line:
-// *** NOTE: the choice of interrupt PORT, DDR, and PIN must match the external
-// interrupt you are using on your processor. Consult the External Interrupts
-// section of your processor's datasheet for more information.
-
-// Interrupt Configuration
-#define ENC0_SIGNAL SIG_INTERRUPT0 // Interrupt signal name
-#define ENC0_INT INT0 // matching INTx bit in GIMSK/EIMSK
-#define ENC0_ICR MCUCR // matching Int. Config Register (MCUCR,EICRA/B)
-#define ENC0_ISCX0 ISC00 // matching Interrupt Sense Config bit0
-#define ENC0_ISCX1 ISC01 // matching Interrupt Sense Config bit1
-// PhaseA Port/Pin Configuration
-// *** PORTx, DDRx, PINx, and Pxn should all have the same letter for "x" ***
-#define ENC0_PHASEA_PORT PORTD // PhaseA port register
-#define ENC0_PHASEA_DDR DDRD // PhaseA port direction register
-#define ENC0_PHASEA_PORTIN PIND // PhaseA port input register
-#define ENC0_PHASEA_PIN PD2 // PhaseA port pin
-// Phase B quadrature encoder output should connect to this direction line:
-// *** PORTx, DDRx, PINx, and Pxn should all have the same letter for "x" ***
-#define ENC0_PHASEB_PORT PORTC // PhaseB port register
-#define ENC0_PHASEB_DDR DDRC // PhaseB port direction register
-#define ENC0_PHASEB_PORTIN PINC // PhaseB port input register
-#define ENC0_PHASEB_PIN PC0 // PhaseB port pin
-
-
-// -------------------- Encoder 1 connections --------------------
-// Phase A quadrature encoder output should connect to this interrupt line:
-// *** NOTE: the choice of interrupt pin and port must match the external
-// interrupt you are using on your processor. Consult the External Interrupts
-// section of your processor's datasheet for more information.
-
-// Interrupt Configuration
-#define ENC1_SIGNAL SIG_INTERRUPT1 // Interrupt signal name
-#define ENC1_INT INT1 // matching INTx bit in GIMSK/EIMSK
-#define ENC1_ICR MCUCR // matching Int. Config Register (MCUCR,EICRA/B)
-#define ENC1_ISCX0 ISC10 // matching Interrupt Sense Config bit0
-#define ENC1_ISCX1 ISC11 // matching Interrupt Sense Config bit1
-// PhaseA Port/Pin Configuration
-// *** PORTx, DDRx, PINx, and Pxn should all have the same letter for "x" ***
-#define ENC1_PHASEA_PORT PORTD // PhaseA port register
-#define ENC1_PHASEA_PORTIN PIND // PhaseA port input register
-#define ENC1_PHASEA_DDR DDRD // PhaseA port direction register
-#define ENC1_PHASEA_PIN PD3 // PhaseA port pin
-// Phase B quadrature encoder output should connect to this direction line:
-// *** PORTx, DDRx, PINx, and Pxn should all have the same letter for "x" ***
-#define ENC1_PHASEB_PORT PORTC // PhaseB port register
-#define ENC1_PHASEB_DDR DDRC // PhaseB port direction register
-#define ENC1_PHASEB_PORTIN PINC // PhaseB port input register
-#define ENC1_PHASEB_PIN PC1 // PhaseB port pin
-
-
-// -------------------- Encoder 2 connections --------------------
-// Phase A quadrature encoder output should connect to this interrupt line:
-// *** NOTE: the choice of interrupt pin and port must match the external
-// interrupt you are using on your processor. Consult the External Interrupts
-// section of your processor's datasheet for more information.
-
-// Interrupt Configuration
-//#define ENC2_SIGNAL SIG_INTERRUPT6 // Interrupt signal name
-#define ENC2_INT INT6 // matching INTx bit in GIMSK/EIMSK
-#define ENC2_ICR EICRB // matching Int. Config Register (MCUCR,EICRA/B)
-#define ENC2_ISCX0 ISC60 // matching Interrupt Sense Config bit0
-#define ENC2_ISCX1 ISC61 // matching Interrupt Sense Config bit1
-// PhaseA Port/Pin Configuration
-// *** PORTx, DDRx, PINx, and Pxn should all have the same letter for "x" ***
-#define ENC2_PHASEA_PORT PORTE // PhaseA port register
-#define ENC2_PHASEA_PORTIN PINE // PhaseA port input register
-#define ENC2_PHASEA_DDR DDRE // PhaseA port direction register
-#define ENC2_PHASEA_PIN PE6 // PhaseA port pin
-// Phase B quadrature encoder output should connect to this direction line:
-// *** PORTx, DDRx, PINx, and Pxn should all have the same letter for "x" ***
-#define ENC2_PHASEB_PORT PORTC // PhaseB port register
-#define ENC2_PHASEB_DDR DDRC // PhaseB port direction register
-#define ENC2_PHASEB_PORTIN PINC // PhaseB port input register
-#define ENC2_PHASEB_PIN PC2 // PhaseB port pin
-
-
-// -------------------- Encoder 3 connections --------------------
-// Phase A quadrature encoder output should connect to this interrupt line:
-// *** NOTE: the choice of interrupt pin and port must match the external
-// interrupt you are using on your processor. Consult the External Interrupts
-// section of your processor's datasheet for more information.
-
-// Interrupt Configuration
-//#define ENC3_SIGNAL SIG_INTERRUPT7 // Interrupt signal name
-#define ENC3_INT INT7 // matching INTx bit in GIMSK/EIMSK
-#define ENC3_ICR EICRB // matching Int. Config Register (MCUCR,EICRA/B)
-#define ENC3_ISCX0 ISC70 // matching Interrupt Sense Config bit0
-#define ENC3_ISCX1 ISC71 // matching Interrupt Sense Config bit1
-// PhaseA Port/Pin Configuration
-// *** PORTx, DDRx, PINx, and Pxn should all have the same letter for "x" ***
-#define ENC3_PHASEA_PORT PORTE // PhaseA port register
-#define ENC3_PHASEA_PORTIN PINE // PhaseA port input register
-#define ENC3_PHASEA_DDR DDRE // PhaseA port direction register
-#define ENC3_PHASEA_PIN PE7 // PhaseA port pin
-// Phase B quadrature encoder output should connect to this direction line:
-// *** PORTx, DDRx, PINx, and Pxn should all have the same letter for "x" ***
-#define ENC3_PHASEB_PORT PORTC // PhaseB port register
-#define ENC3_PHASEB_DDR DDRC // PhaseB port direction register
-#define ENC3_PHASEB_PORTIN PINC // PhaseB port input register
-#define ENC3_PHASEB_PIN PC3 // PhaseB port pin
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/fatconf.h b/build/shared/lib/avrlib/conf/fatconf.h
deleted file mode 100755
index e8821ecaf..000000000
--- a/build/shared/lib/avrlib/conf/fatconf.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*! \file fatconf.h \brief FAT16/32 file system driver configuration. */
-//*****************************************************************************
-//
-// File Name : 'fatconf.h'
-// Title : FAT16/32 file system driver configuration
-// Author : Pascal Stang
-// Date : 4/19/2003
-// Revised : 4/19/2003
-// Version : 0.3
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef FATCONF_H
-#define FATCONF_H
-
-// debug on/off
-#define DEBUG_FAT
-
-#define SECTOR_BUFFER1_ADDR 0x0600+0x0600
-#define SECTOR_BUFFER1_SIZE 0x0200
-
-#define LONGNAME_BUFFER_ADDR 0x0200+0x0600
-#define LONGNAME_BUFFER_SIZE 0x0100
-
-#define DIRNAME_BUFFER_ADDR 0x0300+0x0600
-#define DIRNAME_BUFFER_SIZE 0x0100
-
-#define FAT_CACHE_ADDR 0x0400+0x0600
-#define FAT_CACHE_SIZE 0x0200
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/global.h b/build/shared/lib/avrlib/conf/global.h
deleted file mode 100755
index e5e3b5194..000000000
--- a/build/shared/lib/avrlib/conf/global.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*! \file global.h \brief AVRlib project global include. */
-//*****************************************************************************
-//
-// File Name : 'global.h'
-// Title : AVRlib project global include
-// Author : Pascal Stang - Copyright (C) 2001-2002
-// Created : 7/12/2001
-// Revised : 9/30/2002
-// Version : 1.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// Description : This include file is designed to contain items useful to all
-// code files and projects.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef GLOBAL_H
-#define GLOBAL_H
-
-// global AVRLIB defines
-#include "avrlibdefs.h"
-// global AVRLIB types definitions
-#include "avrlibtypes.h"
-
-// project/system dependent defines
-
-// CPU clock speed
-//#define F_CPU 16000000 // 16MHz processor
-//#define F_CPU 14745000 // 14.745MHz processor
-//#define F_CPU 8000000 // 8MHz processor
-#define F_CPU 7372800 // 7.37MHz processor
-//#define F_CPU 4000000 // 4MHz processor
-//#define F_CPU 3686400 // 3.69MHz processor
-#define CYCLES_PER_US ((F_CPU+500000)/1000000) // cpu cycles per microsecond
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/i2cconf.h b/build/shared/lib/avrlib/conf/i2cconf.h
deleted file mode 100755
index 81521675b..000000000
--- a/build/shared/lib/avrlib/conf/i2cconf.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*! \file i2cconf.h \brief I2C (TWI) interface configuration. */
-//*****************************************************************************
-//
-// File Name : 'i2cconf.h'
-// Title : I2C (TWI) interface configuration
-// Author : Pascal Stang - Copyright (C) 2002-2003
-// Created : 2002.06.25
-// Revised : 2003.03.02
-// Version : 0.7
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef I2CCONF_H
-#define I2CCONF_H
-
-// define I2C data buffer sizes
-// These buffers are used in interrupt-driven Master sending and receiving,
-// and in slave sending and receiving. They must be large enough to store
-// the largest I2C packet you expect to send and receive, respectively.
-#define I2C_SEND_DATA_BUFFER_SIZE 0x20
-#define I2C_RECEIVE_DATA_BUFFER_SIZE 0x20
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/i2cswconf.h b/build/shared/lib/avrlib/conf/i2cswconf.h
deleted file mode 100755
index 008f12e0d..000000000
--- a/build/shared/lib/avrlib/conf/i2cswconf.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*! \file i2cswconf.h \brief Software-driven I2C interface configuration. */
-//*****************************************************************************
-//
-// File Name : 'i2cswconf.h'
-// Title : software-driven I2C interface using port pins
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 11/22/2000
-// Revised : 5/2/2002
-// Version : 1.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef I2CSWCONF_H
-#define I2CSWCONF_H
-
-// clock line port
-#define SCLPORT PORTD // i2c clock port
-#define SCLDDR DDRD // i2c clock port direction
-// data line port
-#define SDAPORT PORTD // i2c data port
-#define SDADDR DDRD // i2c data port direction
-#define SDAPIN PIND // i2c data port input
-// pin assignments
-#define SCL PD0 // i2c clock pin
-#define SDA PD1 // i2c data pin
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/ks0108conf.h b/build/shared/lib/avrlib/conf/ks0108conf.h
deleted file mode 100755
index 69e12affa..000000000
--- a/build/shared/lib/avrlib/conf/ks0108conf.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*! \file ks0108conf.h \brief Graphic LCD driver configuration. */
-//*****************************************************************************
-//
-// File Name : 'ks0108conf.h'
-// Title : Graphic LCD driver for HD61202/KS0108 displays
-// Author : Pascal Stang - Copyright (C) 2001-2003
-// Date : 10/19/2001
-// Revised : 5/1/2003
-// Version : 0.5
-// Target MCU : Atmel AVR
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-
-#ifndef KS0108CONF_H
-#define KS0108CONF_H
-
-// define LCD hardware interface
-// -LCD_MEMORY_INTERFACE assumes that the registers of the LCD have been mapped
-// into the external memory space of the AVR processor memory bus
-// -LCD_PORT_INTERFACE is a direct-connection interface from port pins to LCD
-// SELECT (UNCOMMENT) ONLY ONE!
-
-// *** NOTE: memory interface is not yet fully supported, but it might work
-
-//#define GLCD_MEMORY_INTERFACE
-#define GLCD_PORT_INTERFACE
-
-// GLCD_PORT_INTERFACE specifics
-#ifdef GLCD_PORT_INTERFACE
- // make sure these parameters are not already defined elsewhere
- #ifndef GLCD_CTRL_PORT
- #define GLCD_CTRL_PORT PORTB // PORT for LCD control signals
- #define GLCD_CTRL_DDR DDRB // DDR register of LCD_CTRL_PORT
- #define GLCD_CTRL_RS PB0 // pin for LCD Register Select
- #define GLCD_CTRL_RW PB1 // pin for LCD Read/Write
- #define GLCD_CTRL_E PB2 // pin for LCD Enable
- #define GLCD_CTRL_CS0 PB3 // pin for LCD Controller 0 Chip Select
- #define GLCD_CTRL_CS1 PB4 // pin for LCD Controller 1 Chip Select(*)
- #define GLCD_CTRL_CS2 PB6 // pin for LCD Controller 2 Chip Select(*)
- #define GLCD_CTRL_CS3 PB7 // pin for LCD Controller 3 Chip Select(*)
- #define GLCD_CTRL_RESET PB5 // pin for LCD Reset
- // (*) NOTE: additonal controller chip selects are optional and
- // will be automatically used per each step in 64 pixels of display size
- // Example: Display with 128 hozizontal pixels uses 2 controllers
- #endif
- #ifndef GLCD_DATA_PORT
- #define GLCD_DATA_PORT PORTC // PORT for LCD data signals
- #define GLCD_DATA_DDR DDRC // DDR register of LCD_DATA_PORT
- #define GLCD_DATA_PIN PINC // PIN register of LCD_DATA_PORT
- #endif
-#endif
-
-// GLCD_MEMORY_INTERFACE specifics
-#ifdef GLCD_MEMORY_INTERFACE
- // make sure these parameters are not already defined elsewhere
- #ifndef GLCD_CONTROLLER0_CTRL_ADDR
- // absolute address of LCD Controller #0 CTRL and DATA registers
- #define GLCD_CONTROLLER0_CTRL_ADDR 0x1000
- #define GLCD_CONTROLLER0_DATA_ADDR 0x1001
- // offset of other controllers with respect to controller0
- #define GLCD_CONTROLLER_ADDR_OFFSET 0x0002
- #endif
-#endif
-
-
-// LCD geometry defines (change these definitions to adapt code/settings)
-#define GLCD_XPIXELS 128 // pixel width of entire display
-#define GLCD_YPIXELS 64 // pixel height of entire display
-#define GLCD_CONTROLLER_XPIXELS 64 // pixel width of one display controller
-
-// Set text size of display
-// These definitions are not currently used and will probably move to glcd.h
-#define GLCD_TEXT_LINES 8 // visible lines
-#define GLCD_TEXT_LINE_LENGTH 22 // internal line length
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/lcdconf.h b/build/shared/lib/avrlib/conf/lcdconf.h
deleted file mode 100755
index 92e2c3499..000000000
--- a/build/shared/lib/avrlib/conf/lcdconf.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*! \file lcdconf.h \brief Character LCD driver configuration. */
-//*****************************************************************************
-//
-// File Name : 'lcdconf.h'
-// Title : Character LCD driver for HD44780/SED1278 displays
-// (usable in mem-mapped, or I/O mode)
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 11/22/2000
-// Revised : 4/30/2002
-// Version : 1.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef LCDCONF_H
-#define LCDCONF_H
-
-// Define type of interface used to access the LCD
-// LCD_MEMORY_INTERFACE:
-// To use this mode you must supply the necessary hardware to connect the
-// LCD to the CPU's memory bus. The CONTROL and DATA registers of the LCD
-// (HD44780 chip) must appear in the CPU's memory map. This mode is faster
-// than the port interface but requires a little extra hardware to make it
-// work. It is especially useful when your CPU is already configured to
-// use an external memory bus for other purposes (like accessing memory).
-//
-// LCD_PORT_INTERFACE:
-// This mode allows you to connect the control and data lines of the LCD
-// directly to the I/O port pins (no interfacing hardware is needed),
-// but it generally runs slower than the LCD_MEMORY_INTERFACE.
-// Depending on your needs, when using the LCD_PORT_INTERFACE, the LCD may
-// be accessed in 8-bit or 4-bit mode. In 8-bit mode, one whole I/O port
-// (pins 0-7) is required for the LCD data lines, but transfers are faster.
-// In 4-bit mode, only I/O port pins 4-7 are needed for data lines, but LCD
-// access is slower. In either mode, three additional port pins are
-// required for the LCD interface control lines (RS, R/W, and E).
-
-// Enable one of the following interfaces to your LCD
-//#define LCD_MEMORY_INTERFACE
-#define LCD_PORT_INTERFACE
-
-// Enter the parameters for your chosen interface'
-// if you chose the LCD_PORT_INTERFACE:
-#ifdef LCD_PORT_INTERFACE
- #ifndef LCD_CTRL_PORT
- // port and pins you will use for control lines
- #define LCD_CTRL_PORT PORTC
- #define LCD_CTRL_DDR DDRC
- #define LCD_CTRL_RS 2
- #define LCD_CTRL_RW 3
- #define LCD_CTRL_E 4
- #endif
- #ifndef LCD_DATA_POUT
- // port you will use for data lines
- #define LCD_DATA_POUT PORTA
- #define LCD_DATA_PIN PINA
- #define LCD_DATA_DDR DDRA
- // access mode you will use (default is 8bit unless 4bit is selected)
- //#define LCD_DATA_4BIT
- #endif
-#endif
-
-// if you chose the LCD_MEMORY_INTERFACE:
-#ifdef LCD_MEMORY_INTERFACE
- #ifndef LCD_CTRL_ADDR
- // CPU memory address of the LCD control register
- #define LCD_CTRL_ADDR 0x1000
- #endif
- #ifndef LCD_DATA_ADDR
- // CPU memory address of the LCD data register
- #define LCD_DATA_ADDR 0x1001
- #endif
-#endif
-
-
-// LCD display geometry
-// change these definitions to adapt settings
-#define LCD_LINES 4 // visible lines
-#define LCD_LINE_LENGTH 20 // line length (in characters)
-// cursor position to DDRAM mapping
-#define LCD_LINE0_DDRAMADDR 0x00
-#define LCD_LINE1_DDRAMADDR 0x40
-#define LCD_LINE2_DDRAMADDR 0x14
-#define LCD_LINE3_DDRAMADDR 0x54
-
-// LCD delay
-// This delay affects how quickly accesses are made to the LCD controller.
-// If your clock frequency is low, you can reduce the number of NOPs in the
-// delay. If your clock frequency is high, you may need to add NOPs.
-// The number of NOPs should be between at least 1 and up to 20.
-#define LCD_DELAY asm volatile ("nop\n nop\n nop\n nop\n");
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/mmcconf.h b/build/shared/lib/avrlib/conf/mmcconf.h
deleted file mode 100755
index adb887dd4..000000000
--- a/build/shared/lib/avrlib/conf/mmcconf.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*! \file mmcconf.h \brief MultiMedia and SD Flash Card Interface Configuration. */
-//*****************************************************************************
-//
-// File Name : 'mmc.h'
-// Title : MultiMedia and SD Flash Card Interface Configuration
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.09.22
-// Revised : 2004.09.22
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef MMCCONF_H
-#define MMCCONF_H
-
-// define to enable debugging print statements
-//#define MMC_DEBUG
-
-// MMC card chip select pin defines
-#define MMC_CS_PORT PORTB
-#define MMC_CS_DDR DDRB
-#define MMC_CS_PIN 0
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/readme-conf.txt b/build/shared/lib/avrlib/conf/readme-conf.txt
deleted file mode 100755
index 0011badf7..000000000
--- a/build/shared/lib/avrlib/conf/readme-conf.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
---- AVRlib "conf" files ---
-
-AVRlib contains many function/code libraries which depend upon particular aspects of the
-user's hardware. The most basic of these is the processor clock rate. The clock rate defines
-dozens of aspects of processor operation from code delays to UART baud rates.
-
-To allow AVRlib to work easily with hardware that may vary from project to project, all
-user-configurable parameters of AVRlib are contained in the template configuration files in
-this directory. NOTE that these files are only templates and should be copied, as needed,
-to an individual project's code directory and edited to suit that project's hardware.
-
-
-global.h is the only configuration include file that is common to the entire AVRlib code base.
-To use AVRlib libraries, you must copy global.h to your project's code directory and modify
-the options inside global.h to match your hardware.) Each project should have its own global.h.
-
-Other *conf.h files should be copied to your project's code directory as needed. For example,
-if you intend to use the lcd.c library, you will need to copy lcdconf.h and modify it to match
-the I/O and LCD configuration of your hardware.
-
-** If you fail to copy the configuration files needed for the AVRlib libraries you use,
-the problem will usually exhibit itself as a compile-time error.
-
diff --git a/build/shared/lib/avrlib/conf/servoconf.h b/build/shared/lib/avrlib/conf/servoconf.h
deleted file mode 100755
index a930792a4..000000000
--- a/build/shared/lib/avrlib/conf/servoconf.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*! \file servoconf.h \brief Interrupt-driven RC Servo configuration. */
-//*****************************************************************************
-//
-// File Name : 'servoconf.h'
-// Title : Interrupt-driven RC Servo function library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 07/31/2002
-// Revised : 09/30/2002
-// Version : 1.0
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: you need the latest version (3.2+) of the AVR-GCC compiler to use this
-// function library. Download it from http://www.avrfreaks.net/AVRGCC
-//
-// Description : This code allows you to drive up to 8 RC servos from any
-// combination of ports and pins on the AVR processor. Using interrupts,
-// this code continuously sends control signals to the servo to maintain
-// position even while your code is doing other work.
-//
-// The servoInit and servoOff effectively turn on and turn off servo
-// control. When you run ServoInit, it automatically assigns each
-// "channel" of servo control to be output on the SERVO_DEFAULT_PORT.
-// One "channel" of servo control can control one servo and must be
-// assigned single I/O pin for output.
-//
-// If you're using all eight channels (SERVO_NUM_CHANNELS = 8), then
-// then by default the code will use SERVO_DEFAULT_PORT pins 0-7.
-// If you're only using four channels, then pins 0-3 will be used by
-// default.
-//
-// The command servoSetChannelIO(channel, port, pin) allows you to
-// reassign the output of any channel to any port and I/O pin you
-// choose. For exampe, if you have an RC servo connected to PORTC, pin 6,
-// and you wish to use channel 2 to control it, use:
-//
-// servoSerChannelIO( 2, _SFR_IO_ADDR(PORTC), 6)
-//
-// (NOTE: you must include the "_SRF_IO_ADDR()" part around your port)
-//
-// The servoSetPostion and servoGetPosition commands allow you to command
-// a given servo to your desired position. The position you request must
-// lie between the SERVO_MIN and SERVO_MAX limit you defined.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef SERVOCONF_H
-#define SERVOCONF_H
-
-// set number of servo channels (1 to 8)
-// This is the number of servos you would like to drive
-// Each "Channel" can control one servo and by default will
-// map directly to the port pin of the same number on the
-// SERVO_DEFAULT_PORT. You can change this default port/pin
-// assignment for a given channel to any port/pin you like.
-// See the "servoSetChannelIO" function.
-#define SERVO_NUM_CHANNELS 4
-// set default SERVO output port
-// This is the AVR port which you have connected to your servos
-// See top of file for how servo "channels" map to port pins
-#define SERVO_DEFAULT_PORT PORTB
-// set servo characteristics (min and max raw position)
-// You must find these by testing using your brand/type of servos.
-// The min/max settings will change proportional to F_CPU, the CPU
-// clock frequency.
-// The numbers below good for parallax servos at an F_CPU of ~8MHz.
-//#define SERVO_MAX 71
-//#define SERVO_MIN 17
-// The numbers below good for parallax servos at an F_CPU of ~14.745MHz.
-#define SERVO_MAX 138
-#define SERVO_MIN 34
-
-// set servo scaled range
-// This sets the scaled position range of the servo. Allowed scaled
-// positions are 0 -> SERVO_POSITION_MAX, and correspond to raw
-// positions of SERVO_MIN -> SERVO_MAX.
-#define SERVO_POSITION_MAX 255
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/sramswconf.h b/build/shared/lib/avrlib/conf/sramswconf.h
deleted file mode 100755
index d5c1f2518..000000000
--- a/build/shared/lib/avrlib/conf/sramswconf.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*! \file sramswconf.h \brief Software-driven SRAM memory bus access configuration. */
-//*****************************************************************************
-//
-// File Name : 'sramswconf.h'
-// Title : Software-driven SRAM memory bus access functions
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 11/11/2002
-// Revised : 11/13/2002
-// Version : 1.0
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef SRAMSWCONF_H
-#define SRAMSWCONF_H
-
-// defines
-
-// data bus (DATA[0:7]) and low address (ADDR[0:7]) port
-#define SRAM_ADL PORTA
-#define SRAM_ADL_DDR DDRA
-#define SRAM_ADL_IN PINA
-// high address port (ADDR[8:15])
-#define SRAM_AH PORTC
-#define SRAM_AH_DDR DDRC
-// page address port (PAGE[0:3])
-#define SRAM_PAGE PORTB
-#define SRAM_PAGE_DDR DDRB
-#define SRAM_PAGE_MASK 0x0F
-// control port
-#define SRAM_CTRL PORTD
-#define SRAM_CTRL_DDR DDRD
-// control lines
-#define SRAM_ALE PD5
-#define SRAM_WR PD6
-#define SRAM_RD PD7
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/sta013conf.h b/build/shared/lib/avrlib/conf/sta013conf.h
deleted file mode 100755
index 5882c4402..000000000
--- a/build/shared/lib/avrlib/conf/sta013conf.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*! \file sta013conf.h \brief STA013 MP3 player driver configuration. */
-//*****************************************************************************
-//
-// File Name : 'sta013.h'
-// Title : STMicroelectronics STA013 MP3 player driver
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 10/22/2000
-// Revised : 12/04/2000
-// Version : 0.3
-// Target MCU : ATmega103 (should work for Atmel AVR Series)
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-
-#ifndef STA013CONF_H
-#define STA013CONF_H
-
-// STA013 Configuration
-
-// STA013 demand line
-#define STA013_DEMAND_PORT PORTE // port to which DEMAND line is connected
-#define STA013_DEMAND_PORTIN PINE // input port to which DEMAND line is connected
-#define STA013_DEMAND_PIN PE4 // port pin to which DEMAND line is connected
-#define STA013_DEMAND_INTR SIG_INTERRUPT4 // interrupt to which DEMAND line is connected
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/stxetxconf.h b/build/shared/lib/avrlib/conf/stxetxconf.h
deleted file mode 100755
index 7e6716686..000000000
--- a/build/shared/lib/avrlib/conf/stxetxconf.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*! \file stxetxconf.h \brief STX/ETX Packet Protocol Implementation Configuration. */
-//*****************************************************************************
-//
-// File Name : 'stxetx.h'
-// Title : STX/ETX Packet Protocol Implementation Configuration
-// Author : Pascal Stang - Copyright (C) 2002-2003
-// Created : 10/9/2002
-// Revised : 02/10/2003
-// Version : 0.1
-// Target MCU : any
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef STXETXCONF_H
-#define STXETXCONF_H
-
-// STX/ETX Configuration Options
-
-// This determines the size of the Packet Receive Buffer
-// where whole verified packets are copied after being received
-#define STXETX_MAXRXPACKETSIZE 20 // length of packet buffer
-
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/uartsw2conf.h b/build/shared/lib/avrlib/conf/uartsw2conf.h
deleted file mode 100755
index 88a34d013..000000000
--- a/build/shared/lib/avrlib/conf/uartsw2conf.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*! \file uartsw2conf.h \brief Interrupt-driven Software UART Driver Configuration. */
-//*****************************************************************************
-//
-// File Name : 'uartsw2conf.h'
-// Title : Interrupt-driven Software UART Driver Configuration
-// Author : Pascal Stang - Copyright (C) 2002-2003
-// Created : 7/20/2002
-// Revised : 4/27/2004
-// Version : 0.6
-// Target MCU : Atmel AVR Series (intended for the ATmega16 and ATmega32)
-// Editor Tabs : 4
-//
-// Description :
-// This uart library emulates the operation of a UART (serial port) using
-// the AVR's hardware timers, I/O pins, and some software.
-//
-// Specifically, this code uses:
-// -Timer 2 Output Capture for transmit timing
-// -Timer 0 Output Capture for receive timing
-// -External Interrupt 2 for receive triggering
-//
-// The above resources cannot be used for other purposes while this software
-// UART is enabled. The overflow interrupts from Timer0 and Timer2 can still
-// be used for other timing, but the prescalers for these timers must not be
-// changed.
-//
-// Serial output from this UART can be routed to any I/O pin. Serial input
-// for this UART must come from the External Interrupt 2 (INT2) I/O pin.
-// These options should be configured by editing your local copy of
-// "uartsw2conf.h".
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef UARTSW2CONF_H
-#define UARTSW2CONF_H
-
-// constants/macros/typdefs
-
-#define UARTSW_RX_BUFFER_SIZE 0x20 ///< UART receive buffer size in bytes
-
-#define UARTSW_INVERT ///< define to invert polarity of RX/TX signals
-// when non-inverted, the serial line is appropriate for passing though
-// an RS232 driver like the MAX232. When inverted, the serial line can
-// directly drive/receive RS232 signals to/from a DB9 connector. Be sure
-// to use a current-limiting resistor and perhaps a diode-clamp circuit when
-// connecting incoming RS232 signals to a microprocessor I/O pin.
-
-// if non-inverted, the serial line idles high (logic 1) between bytes
-// if inverted, the serial line idles low (logic 0) between bytes
-
-
-// UART transmit pin defines
-#define UARTSW_TX_PORT PORTB ///< UART Transmit Port
-#define UARTSW_TX_DDR DDRB ///< UART Transmit DDR
-#define UARTSW_TX_PIN PB3 ///< UART Transmit Pin
-
-// UART receive pin defines
-// This pin must correspond to the
-// External Interrupt 2 (INT2) pin for your processor
-#define UARTSW_RX_PORT PORTB ///< UART Receive Port
-#define UARTSW_RX_DDR DDRB ///< UART Receive DDR
-#define UARTSW_RX_PORTIN PINB ///< UART Receive Port Input
-#define UARTSW_RX_PIN PB2 ///< UART Receive Pin
-
-#endif
diff --git a/build/shared/lib/avrlib/conf/uartswconf.h b/build/shared/lib/avrlib/conf/uartswconf.h
deleted file mode 100755
index 36d81c199..000000000
--- a/build/shared/lib/avrlib/conf/uartswconf.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*! \file uartswconf.h \brief Interrupt-driven Software UART Driver Configuration. */
-//*****************************************************************************
-//
-// File Name : 'uartswconf.h'
-// Title : Interrupt-driven Software UART Driver Configuration
-// Author : Pascal Stang - Copyright (C) 2002-2004
-// Created : 7/20/2002
-// Revised : 4/27/2004
-// Version : 0.1
-// Target MCU : Atmel AVR Series (intended for the ATmega16 and ATmega32)
-// Editor Tabs : 4
-//
-// Description :
-// This uart library emulates the operation of a UART (serial port) using
-// the AVR's hardware timers, I/O pins, and some software.
-//
-// Specifically, this code uses:
-// -Timer 1 Output Compare A for transmit timing
-// -Timer 1 Output Compare B for receive timing
-// -Timer 1 Input Capture for receive triggering
-//
-// The above resources cannot be used for other purposes while this software
-// UART is enabled. The overflow interrupt from Timer1 can still be used for
-// other timing, but the prescaler for Timer1 must not be changed.
-//
-// Serial output from this UART can be routed to any I/O pin. Serial input
-// for this UART must come from the Timer1 Input Capture (IC1) I/O pin.
-// These options should be configured by editing your local copy of
-// "uartswconf.h".
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef UARTSWCONF_H
-#define UARTSWCONF_H
-
-// constants/macros/typdefs
-
-#define UARTSW_RX_BUFFER_SIZE 0x20 ///< UART receive buffer size in bytes
-
-#define UARTSW_INVERT ///< define to invert polarity of RX/TX signals
-// when non-inverted, the serial line is appropriate for passing though
-// an RS232 driver like the MAX232. When inverted, the serial line can
-// directly drive/receive RS232 signals to/from a DB9 connector. Be sure
-// to use a current-limiting resistor and perhaps a diode-clamp circuit when
-// connecting incoming RS232 signals to a microprocessor I/O pin.
-
-// if non-inverted, the serial line idles high (logic 1) between bytes
-// if inverted, the serial line idles low (logic 0) between bytes
-
-
-// UART transmit pin defines
-#define UARTSW_TX_PORT PORTD ///< UART Transmit Port
-#define UARTSW_TX_DDR DDRD ///< UART Transmit DDR
-#define UARTSW_TX_PIN PD5 ///< UART Transmit Pin
-
-// UART receive pin defines
-// This pin must correspond to the
-// Timer1 Input Capture (ICP or IC1) pin for your processor
-#define UARTSW_RX_PORT PORTD ///< UART Receive Port
-#define UARTSW_RX_DDR DDRD ///< UART Receive DDR
-#define UARTSW_RX_PORTIN PIND ///< UART Receive Port Input
-#define UARTSW_RX_PIN PD6 ///< UART Receive Pin
-
-#endif
diff --git a/build/shared/lib/avrlib/debug.c b/build/shared/lib/avrlib/debug.c
deleted file mode 100755
index 5d4755c9a..000000000
--- a/build/shared/lib/avrlib/debug.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*! \file debug.c \brief Debugging function library. */
-//*****************************************************************************
-//
-// File Name : 'debug.c'
-// Title : Helpful debugging functions
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003-03-13
-// Revised : 2003-03-13
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// Description : This file contains a set of functions which may be useful
-// for general debugging.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "global.h"
-#include "debug.h"
-
-#include "rprintf.h" // include printf support
-
-// global variables
-
-// functions
-
-// Print a part of memory as a formatted hex table with ascii translation
-void debugPrintHexTable(u16 length, u08 *buffer)
-{
- u08 i;
- u16 j;
- u08 *buf;
- u08 s;
-
- buf = buffer;
-
- // print the low order address indicies and ASCII header
- rprintfProgStrM(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF\r\n");
- rprintfProgStrM(" ----------------------------------------------- ---- ASCII -----\r\n");
-
- // print the data
- for(j=0; j<((length+15)>>4); j++)
- {
- // print the high order address index for this line
- rprintfu16(j<<4);
- rprintfChar(' ');
-
- // print the hex data
- for(i=0; i<0x10; i++)
- {
- // be nice and print only up to the exact end of the data
- if( ((j<<4)+i) < length)
- {
- // print hex byte
- rprintfu08(buf[(j<<4)+i]);
- rprintfChar(' ');
- }
- else
- {
- // we're past the end of the data's length
- // print spaces
- rprintfProgStrM(" ");
- }
- }
-
- // leave some space
- rprintfChar(' ');
-
- // print the ascii data
- for(i=0; i<0x10; i++)
- {
- // be nice and print only up to the exact end of the data
- if( ((j<<4)+i) < length)
- {
- // get the character
- s = buf[(j<<4)+i];
- // make sure character is printable
- if(s >= 0x20)
- rprintfChar(s);
- else
- rprintfChar('.');
- }
- else
- {
- // we're past the end of the data's length
- // print a space
- rprintfChar(' ');
- }
- }
- rprintfCRLF();
- }
-}
diff --git a/build/shared/lib/avrlib/debug.h b/build/shared/lib/avrlib/debug.h
deleted file mode 100755
index 20148dc0c..000000000
--- a/build/shared/lib/avrlib/debug.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*! \file debug.h \brief Debugging function library. */
-//*****************************************************************************
-//
-// File Name : 'debug.h'
-// Title : Helpful debugging functions
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003-03-13
-// Revised : 2003-03-13
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// Description : This file contains a set of functions which may be useful
-// for general debugging.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-#include "global.h"
-
-// defines
-
-// function prototypes
-
-//! Print a part of memory as a formatted hex table with ascii translation
-void debugPrintHexTable(u16 length, u08 *buffer);
-
-
-#endif
diff --git a/build/shared/lib/avrlib/ds1631.c b/build/shared/lib/avrlib/ds1631.c
deleted file mode 100755
index 911df0577..000000000
--- a/build/shared/lib/avrlib/ds1631.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*! \file ds1631.c \brief Dallas DS1631 Temperature Sensor Driver Library. */
-//*****************************************************************************
-//
-// File Name : 'ds1631.c'
-// Title : Dallas DS1631 Temperature Sensor Driver Library
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.02.10
-// Revised : 2004.02.19
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "global.h"
-#include "timer.h"
-#include "i2c.h"
-#include "ds1631.h"
-
-// global variables
-
-// Functions
-u08 ds1631Init(u08 i2cAddr)
-{
- u08 chip_ok;
- // issue a reset
- if(ds1631Reset(i2cAddr) == I2C_OK)
- chip_ok = TRUE;
- else
- chip_ok = FALSE;
- // set a default configuration
- // (1-shot mode, T_OUT active high, and 12-bit conversion)
- ds1631SetConfig(i2cAddr,
- DS1631_CONFIG_1SHOT | DS1631_CONFIG_POL |
- DS1631_CONFIG_R0 | DS1631_CONFIG_R1);
- return chip_ok;
-}
-
-u08 ds1631Reset(u08 i2cAddr)
-{
- u08 buffer[1];
- // return the DS1631 to power-on reset defaults
- buffer[0] = DS1631_CMD_SWPOR;
- return i2cMasterSendNI(i2cAddr, 1, buffer);
-}
-
-void ds1631SetConfig(u08 i2cAddr, u08 config)
-{
- u08 buffer[2];
- // write the DS1631 configuration byte
- buffer[0] = DS1631_CMD_ACCESSCONFIG;
- buffer[1] = config;
- i2cMasterSendNI(i2cAddr, 2, buffer);
-}
-
-u08 ds1631GetConfig(u08 i2cAddr)
-{
- u08 buffer[1];
- // write the DS1631 configuration byte
- buffer[0] = DS1631_CMD_ACCESSCONFIG;
- i2cMasterSendNI(i2cAddr, 2, buffer);
- i2cMasterReceiveNI(i2cAddr, 2, buffer);
- return buffer[0];
-}
-
-void ds1631StartConvert(u08 i2cAddr)
-{
- u08 buffer[1];
- // send the DS1631 Start Convert command
- buffer[0] = DS1631_CMD_STARTCONV;
- i2cMasterSendNI(i2cAddr, 1, buffer);
-}
-
-void ds1631StopConvert(u08 i2cAddr)
-{
- u08 buffer[1];
- // send the DS1631 Stop Convert command
- buffer[0] = DS1631_CMD_STOPCONV;
- i2cMasterSendNI(i2cAddr, 1, buffer);
-}
-
-s16 ds1631ReadTemp(u08 i2cAddr)
-{
- // read the Temperature register and return the result
- return ds1631ReadTempReg(i2cAddr, DS1631_CMD_READTEMP);
-}
-
-void ds1631SetTH(u08 i2cAddr, s16 value)
-{
- // write the TH register
- ds1631WriteTempReg(i2cAddr, DS1631_CMD_ACCESSTH, value);
-}
-
-void ds1631SetTL(u08 i2cAddr, s16 value)
-{
- // write the TL register
- ds1631WriteTempReg(i2cAddr, DS1631_CMD_ACCESSTL, value);
-}
-
-s16 ds1631GetTH(u08 i2cAddr)
-{
- // read the TH register and return the result
- return ds1631ReadTempReg(i2cAddr, DS1631_CMD_ACCESSTH);
-}
-
-s16 ds1631GetTL(u08 i2cAddr)
-{
- // read the TL register and return the result
- return ds1631ReadTempReg(i2cAddr, DS1631_CMD_ACCESSTL);
-}
-
-
-s16 ds1631ReadTempReg(u08 i2cAddr, u08 cmd)
-{
- u08 buffer[2];
- s16 T;
-
- // read the temperature value from the requested register
- i2cMasterSendNI(i2cAddr, 1, &cmd);
- i2cMasterReceiveNI(i2cAddr, 2, buffer);
- // pack bytes
- T = (s16)((buffer[0]<<8) | buffer[1]);
- // return result
- return T;
-}
-
-void ds1631WriteTempReg(u08 i2cAddr, u08 cmd, s16 value)
-{
- u08 buffer[3];
-
- // write the requested register with a temperature value
- buffer[0] = cmd;
- buffer[1] = value>>8;
- buffer[2] = value;
- i2cMasterSendNI(i2cAddr, 3, buffer);
-}
diff --git a/build/shared/lib/avrlib/ds1631.h b/build/shared/lib/avrlib/ds1631.h
deleted file mode 100755
index e2ea713ac..000000000
--- a/build/shared/lib/avrlib/ds1631.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*! \file ds1631.h \brief Dallas DS1631 Temperature Sensor Driver Library. */
-//*****************************************************************************
-//
-// File Name : 'ds1631.h'
-// Title : Dallas DS1631 Temperature Sensor Driver Library
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.02.10
-// Revised : 2004.02.19
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef DS1631_H
-#define DS1631_H
-
-#include "global.h"
-
-// constants/macros/typdefs
-#define DS1631_I2C_ADDR 0x90 //< Base I2C address of DS1631 devices
-
-#define DS1631_CMD_STARTCONV 0x51 //< DS1631 Start conversion command byte
-#define DS1631_CMD_STOPCONV 0x22 //< DS1631 Stop conversion command byte
-#define DS1631_CMD_READTEMP 0xAA //< DS1631 Read Temperature command byte
-#define DS1631_CMD_ACCESSTH 0xA1 //< DS1631 TH read/write command byte
-#define DS1631_CMD_ACCESSTL 0xA2 //< DS1631 TL read/write command byte
-#define DS1631_CMD_ACCESSCONFIG 0xAC //< DS1631 Config read/write command byte
-#define DS1631_CMD_SWPOR 0x54 //< DS1631 Software Reset command byte
-
-#define DS1631_CONFIG_1SHOT 0x01
-#define DS1631_CONFIG_POL 0x02
-#define DS1631_CONFIG_R0 0x04
-#define DS1631_CONFIG_R1 0x08
-#define DS1631_CONFIG_NVB 0x10
-#define DS1631_CONFIG_TLF 0x20
-#define DS1631_CONFIG_THF 0x40
-#define DS1631_CONFIG_DONE 0x80
-
-// functions
-
-//! Initialize the DS1631 chip
-u08 ds1631Init(u08 i2cAddr);
-
-//! Reset the DS1631 chip to its power-on defaults
-u08 ds1631Reset(u08 i2cAddr);
-
-//! Set the configuration byte of the DS1631
-void ds1631SetConfig(u08 i2cAddr, u08 config);
-
-//! Get the configuration byte of the DS1631
-u08 ds1631GetConfig(u08 i2cAddr);
-
-//! Start a temperature conversion
-void ds1631StartConvert(u08 i2cAddr);
-
-//! Stop a temperature conversion (or stop continuous conversion mode)
-void ds1631StopConvert(u08 i2cAddr);
-
-//! Read the result of a temperature conversion
-s16 ds1631ReadTemp(u08 i2cAddr);
-
-//! Set the Temp-High threshold
-void ds1631SetTH(u08 i2cAddr, s16 value);
-
-//! Set the Temp-Low threshold
-void ds1631SetTL(u08 i2cAddr, s16 value);
-
-//! Get the Temp-High threshold
-s16 ds1631GetTH(u08 i2cAddr);
-
-//! Get the Temp-Low threshold
-s16 ds1631GetTL(u08 i2cAddr);
-
-void ds1631WriteTempReg(u08 i2cAddr, u08 cmd, s16 value);
-s16 ds1631ReadTempReg(u08 i2cAddr, u08 cmd);
-
-
-#endif
diff --git a/build/shared/lib/avrlib/encoder.c b/build/shared/lib/avrlib/encoder.c
deleted file mode 100755
index 682d61554..000000000
--- a/build/shared/lib/avrlib/encoder.c
+++ /dev/null
@@ -1,229 +0,0 @@
-/*! \file encoder.c \brief Quadrature Encoder reader/driver. */
-//*****************************************************************************
-//
-// File Name : 'encoder.c'
-// Title : Quadrature Encoder reader/driver
-// Author : Pascal Stang - Copyright (C) 2003-2004
-// Created : 2003.01.26
-// Revised : 2004.06.25
-// Version : 0.3
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
- #include
- #include
- #include
-#endif
-
-#include "global.h"
-#include "encoder.h"
-
-// Program ROM constants
-
-// Global variables
-volatile EncoderStateType EncoderState[NUM_ENCODERS];
-
-// Functions
-
-// encoderInit() initializes hardware and encoder position readings
-// Run this init routine once before using any other encoder functions.
-void encoderInit(void)
-{
- u08 i;
-
- // initialize/clear encoder data
- for(i=0; iright), PhaseB is always low (logic 0) at
-// the rising edge of PhaseA. When we travel backwards in time (right->left),
-// PhaseB is always high (logic 1) at the rising edge of PhaseA. Note that
-// traveling forward or backwards in time is the same thing as rotating
-// forwards or bardwards. Thus, if PhaseA is our counter, PhaseB indicates
-// direction.
-//
-// Here is an example waveform from a quadrature encoder:
-/*
-// /---\ /---\ /---\ /---\ /---\ /---\
-// Phase A: | | | | | | | | | | | |
-// ---/ \---/ \---/ \---/ \---/ \---/ \-
-// -\ /---\ /---\ /---\ /---\ /---\ /---
-// Phase B: | | | | | | | | | | | |
-// \---/ \---/ \---/ \---/ \---/ \---/
-// Time: <--------------------------------------------------->
-// Rotate FWD: >---------------------------------------------->
-// Rotate REV: <----------------------------------------------<
-*/
-// To keep track of the encoder position in software, we connect PhaseA to an
-// external processor interrupt line, and PhaseB to any I/O pin. We set up
-// the external interrupt to trigger whenever PhaseA produces a rising edge.
-// When a rising edge is detected, our interrupt handler function is executed.
-// Inside the handler function, we quickly check the PhaseB line to see if it
-// is high or low. If it is high, we increment the encoder's position
-// counter, otherwise we decrement it. The encoder position counter can be
-// read at any time to find out the current position.
-//
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef ENCODER_H
-#define ENCODER_H
-
-#include "global.h"
-
-// include encoder configuration file
-#include "encoderconf.h"
-
-// constants/macros/typdefs
-
-// defines for processor compatibility
-// chose proper Interrupt Mask (IMSK)
-#ifdef EIMSK
- #define IMSK EIMSK // for processors mega128, mega64
-#else
- #define IMSK GIMSK // for other processors 90s8515, mega163, etc
-#endif
-
-
-//! Encoder state structure
-// stores the position and other information from each encoder
-typedef struct struct_EncoderState
-{
- s32 position; ///< position
-// s32 velocity; ///< velocity
-} EncoderStateType;
-
-
-// functions
-
-//! encoderInit() initializes hardware and encoder position readings
-// Run this init routine once before using any other encoder function.
-void encoderInit(void);
-
-//! encoderOff() disables hardware and stops encoder position updates
-void encoderOff(void);
-
-//! encoderGetPosition() reads the current position of the encoder
-s32 encoderGetPosition(u08 encoderNum);
-
-//! encoderSetPosition() sets the current position of the encoder
-void encoderSetPosition(u08 encoderNum, s32 position);
-
-#endif
diff --git a/build/shared/lib/avrlib/extint.c b/build/shared/lib/avrlib/extint.c
deleted file mode 100755
index 699d71d9e..000000000
--- a/build/shared/lib/avrlib/extint.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/*! \file extint.c \brief External-Interrupt function library. */
-//*****************************************************************************
-//
-// File Name : 'extint.c'
-// Title : External-Interrupt function library
-// Author : Pascal Stang - Copyright (C) 2002-2004
-// Created : 5/10/2002
-// Revised : 11/16/2004
-// Version : 1.0
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// Notes: This library provides convenient standardized configuration and
-// access to external interrupts. The library is designed to make
-// it possible to write code that uses external interrupts without
-// digging into the processor datasheets to find register names and
-// bit-defines. The library also strives to allow code which uses
-// external interrupts to more easily cross-compile between different
-// microcontrollers.
-//
-// NOTE: Using this library has certain advantages, but also adds
-// overhead and latency to interrupt servicing. If the smallest
-// code size or fastest possible latency is needed, do NOT use this
-// library; link your interrupts directly.
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "global.h"
-#include "extint.h"
-
-// Global variables
-typedef void (*voidFuncPtr)(void);
-volatile static voidFuncPtr ExtIntFunc[EXTINT_NUM_INTERRUPTS];
-
-// functions
-
-//! initializes extint library
-void extintInit(void)
-{
- u08 intNum;
- // detach all user functions from interrupts
- for(intNum=0; intNum
-#include
-#include
-
-#include "ata.h"
-#include "rprintf.h"
-
-#include "fat.h"
-#include "fatconf.h"
-
-// globals
-unsigned char *SectorBuffer = (unsigned char *) SECTOR_BUFFER1_ADDR;
-unsigned char *LongNameBuffer = (unsigned char *) LONGNAME_BUFFER_ADDR;
-unsigned char *DirNameBuffer = (unsigned char *) DIRNAME_BUFFER_ADDR;
-
-struct partrecord PartInfo;
-unsigned char Fat32Enabled;
-unsigned long FirstDataSector;
-unsigned int BytesPerSector;
-unsigned int SectorsPerCluster;
-unsigned long FirstFATSector;
-unsigned long FirstDirSector;
-unsigned long FileSize;
-unsigned long FatInCache = 0;
-
-/*************************************************************************/
-/*************************************************************************/
-
-
-unsigned long fatClustToSect(unsigned long clust)
-{
- return ((clust-2) * SectorsPerCluster) + FirstDataSector;
-}
-
-unsigned int fatClusterSize(void)
-{
- // return the number of sectors in a disk cluster
- return SectorsPerCluster;
-}
-
-unsigned char fatInit( unsigned char device)
-{
- //struct partrecord *pr;
- struct bpb710 *bpb;
-
- // read partition table
- // TODO.... error checking
- ataReadSectors(DRIVE0, 0, 1, SectorBuffer);
- // map first partition record
- // save partition information to global PartInfo
- PartInfo = *((struct partrecord *) ((struct partsector *) SectorBuffer)->psPart);
-// PartInfo = *pr;
-
- // Read the Partition BootSector
- // **first sector of partition in PartInfo.prStartLBA
- ataReadSectors( DRIVE0, PartInfo.prStartLBA, 1, SectorBuffer );
- bpb = (struct bpb710 *) ((struct bootsector710 *) SectorBuffer)->bsBPB;
-
- // setup global disk constants
- FirstDataSector = PartInfo.prStartLBA;
- if(bpb->bpbFATsecs)
- {
- // bpbFATsecs is non-zero and is therefore valid
- FirstDataSector += bpb->bpbResSectors + bpb->bpbFATs * bpb->bpbFATsecs;
- }
- else
- {
- // bpbFATsecs is zero, real value is in bpbBigFATsecs
- FirstDataSector += bpb->bpbResSectors + bpb->bpbFATs * bpb->bpbBigFATsecs;
- }
- SectorsPerCluster = bpb->bpbSecPerClust;
- BytesPerSector = bpb->bpbBytesPerSec;
- FirstFATSector = bpb->bpbResSectors + PartInfo.prStartLBA;
-
- switch (PartInfo.prPartType)
- {
- case PART_TYPE_DOSFAT16:
- case PART_TYPE_FAT16:
- case PART_TYPE_FAT16LBA:
- // first directory cluster is 2 by default (clusters range 2->big)
- FirstDirSector = CLUST_FIRST;
- // push data sector pointer to end of root directory area
- //FirstDataSector += (bpb->bpbRootDirEnts)/DIRENTRIES_PER_SECTOR;
- Fat32Enabled = FALSE;
- break;
- case PART_TYPE_FAT32LBA:
- case PART_TYPE_FAT32:
- // bpbRootClust field exists in FAT32 bpb710, but not in lesser bpb's
- FirstDirSector = bpb->bpbRootClust;
- // push data sector pointer to end of root directory area
- // need this? FirstDataSector += (bpb->bpbRootDirEnts)/DIRENTRIES_PER_SECTOR;
- Fat32Enabled = TRUE;
- break;
- default:
- rprintfProgStrM("Found: No Partition!\r\n");
- //return 1;
- break;
- }
-
-
-#ifdef DEBUG_FAT
- switch (PartInfo.prPartType)
- {
- case PART_TYPE_DOSFAT16:
- rprintfProgStrM("Found: DOSFAT 16\r\n");
- break;
- case PART_TYPE_FAT16:
- rprintfProgStrM("Found: FAT16\r\n");
- break;
- case PART_TYPE_FAT16LBA:
- rprintfProgStrM("Found: FAT16 LBA\r\n");
- break;
- case PART_TYPE_FAT32LBA:
- rprintfProgStrM("Found: FAT32 LBA\r\n");
- break;
- case PART_TYPE_FAT32:
- rprintfProgStrM("Found: FAT32\r\n");
- //return 1;
- break;
- default:
- rprintfProgStrM("Found: No Partition!\r\n");
- //return 1;
- break;
- }
-
- rprintfProgStrM("First sector : "); rprintfu32(PartInfo.prStartLBA); rprintfCRLF();
- rprintfProgStrM("Size : "); rprintfu32(PartInfo.prSize); rprintfCRLF();
- rprintfProgStrM("bytes/sector : "); rprintfu16(bpb->bpbBytesPerSec); rprintfCRLF();
- rprintfProgStrM("sectors/cluster : "); rprintfu08(bpb->bpbSecPerClust); rprintfCRLF();
- rprintfProgStrM("reserved sectors: "); rprintfu16(bpb->bpbResSectors); rprintfCRLF();
- rprintfProgStrM("FatSectors : "); rprintfu16(bpb->bpbFATsecs); rprintfCRLF();
- rprintfProgStrM("BigFatSectors : "); rprintfu32(bpb->bpbBigFATsecs); rprintfCRLF();
- rprintfProgStrM("Number of Fats : "); rprintfu08(bpb->bpbFATs); rprintfCRLF();
- rprintfProgStrM("First Fat Sector: "); rprintfu32(FirstFATSector); rprintfCRLF();
- rprintfProgStrM("First Data Sect : "); rprintfu32(FirstDataSector); rprintfCRLF();
- rprintfProgStrM("First Dir Clust : "); rprintfu32(FirstDirSector); rprintfCRLF();
-#endif
-
- return 0;
-}
-
-//////////////////////////////////////////////////////////////
-
-
-unsigned int baseentry = 0;
-unsigned int entrycount = 0;
-
-
-unsigned long fatGetDirEntry(unsigned int entry, unsigned int count)
-{
- unsigned long sector;
- struct direntry *de = 0; // avoid compiler warning by initializing
- struct winentry *we;
- unsigned int hasBuffer;
- unsigned int b;
- int i,index;
- char *p;
-
- if(count == 0)
- {
- entrycount = 0;
- DirNameBuffer = 0;
- }
-
- // read dir data
- sector = fatClustToSect(FirstDirSector);
-
- hasBuffer = 0;
-
- index = 16; // crank it up
- do
- {
- if(index == 16) // time for next sector ?
- {
- ataReadSectors( DRIVE0, sector++, 1, SectorBuffer);
- de = (struct direntry *) SectorBuffer;
- index = 0;
- }
-
- if(*de->deName != 0xE5)
- {
- // if not a deleted entry
- if(de->deAttributes == ATTR_LONG_FILENAME)
- {
- // we have a long name entry
- we = (struct winentry *) de;
- b = 13 *( (we->weCnt-1) & 0x0f); // index into string
- p = &LongNameBuffer[b];
- for (i=0;i<5;i++) *p++ = we->wePart1[i*2]; // copy first part
- for (i=0;i<6;i++) *p++ = we->wePart2[i*2]; // second part
- for (i=0;i<2;i++) *p++ = we->wePart3[i*2]; // and third part
- if (we->weCnt & 0x40) *p = 0; // in case dirnamelength is multiple of 13
- if ((we->weCnt & 0x0f) == 1) hasBuffer = 1; // mark that we have a long entry
- }
- else
- {
- // we have a short name entry
- // check if this is the end of a multi-part long name entry
- if(hasBuffer)
- {
- // a long entry name has been collected
- // is it a directory ?
- if(de->deAttributes == ATTR_DIRECTORY)
- {
- unsigned long save = FirstDirSector;
- unsigned int save2 = baseentry;
- unsigned long rval;
-
- strcpy(DirNameBuffer,LongNameBuffer);
- strcat(DirNameBuffer,"/");
-
-// rprintfStr(LongNameBuffer); rprintfProgStrM("/"); //EOL();
-
- // call recursively
- FirstDirSector = ((unsigned long)de->deHighClust << 16) + de->deStartCluster;
- rval = fatGetDirEntry(entry,1);
- FirstDirSector = save;
- baseentry = save2;
- if (rval)
- return rval;
- else
- {
- // reload original sector
- ataReadSectors( DRIVE0, sector-1, 1, SectorBuffer);
- entrycount--; // decrement entry counter
- *DirNameBuffer = 0;
- }
- }
- else // normal file entry
- if(entrycount == entry)
- break;
- hasBuffer = 0; // clear buffer
- entrycount++; // increment entry counter
- }
- // else ignore short_name_only entries
- }
- }
- de++;
- index++;
- } while (*de->deName || index == 16); // 0 in de->deName[0] if no more entries
-
- if (hasBuffer == 0) // end of entries
- return 0;
-
- FileSize = de->deFileSize;
- return (unsigned long) ((unsigned long)de->deHighClust << 16) + de->deStartCluster;
-}
-
-
-// return the size of the last directory entry
-unsigned long fatGetFilesize(void)
-{
- return FileSize;
-}
-
-
-// return the long name of the last directory entry
-char* fatGetFilename(void)
-{
- return LongNameBuffer;
-}
-
-
-// return the directory of the last directory entry
-char* fatGetDirname(void)
-{
- return DirNameBuffer;
-}
-
-
-// load a clusterfull of data
-void fatLoadCluster(unsigned long cluster, unsigned char *buffer)
-{
- register unsigned char i;
- // read cluster
- //while ( ataReadSectors( DRIVE0, clust2sect(cluster), SectorsPerCluster, buffer) != 0);
- for(i=0; i");
- rprintfu32(nextCluster);
- rprintfCRLF();
-#endif
-
- return nextCluster;
-}
diff --git a/build/shared/lib/avrlib/fat.h b/build/shared/lib/avrlib/fat.h
deleted file mode 100755
index f50fa96f2..000000000
--- a/build/shared/lib/avrlib/fat.h
+++ /dev/null
@@ -1,375 +0,0 @@
-/*! \file fat.h \brief FAT16/32 file system driver. */
-//*****************************************************************************
-//
-// File Name : 'fat.h'
-// Title : FAT16/32 file system driver
-// Author : Pascal Stang
-// Date : 11/07/2000
-// Revised : 12/12/2000
-// Version : 0.3
-// Target MCU : ATmega103 (should work for Atmel AVR Series)
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef FAT_H
-#define FAT_H
-
-#include "global.h"
-
-
-// Some useful cluster numbers
-#define MSDOSFSROOT 0 // cluster 0 means the root dir
-#define CLUST_FREE 0 // cluster 0 also means a free cluster
-#define MSDOSFSFREE CLUST_FREE
-#define CLUST_FIRST 2 // first legal cluster number
-#define CLUST_RSRVD 0xfffffff6 // reserved cluster range
-#define CLUST_BAD 0xfffffff7 // a cluster with a defect
-#define CLUST_EOFS 0xfffffff8 // start of eof cluster range
-#define CLUST_EOFE 0xffffffff // end of eof cluster range
-
-#define FAT12_MASK 0x00000fff // mask for 12 bit cluster numbers
-#define FAT16_MASK 0x0000ffff // mask for 16 bit cluster numbers
-#define FAT32_MASK 0x0fffffff // mask for FAT32 cluster numbers
-
-
-// Partition Type used in the partition record
-#define PART_TYPE_UNKNOWN 0x00
-#define PART_TYPE_FAT12 0x01
-#define PART_TYPE_XENIX 0x02
-#define PART_TYPE_DOSFAT16 0x04
-#define PART_TYPE_EXTDOS 0x05
-#define PART_TYPE_FAT16 0x06
-#define PART_TYPE_NTFS 0x07
-#define PART_TYPE_FAT32 0x0B
-#define PART_TYPE_FAT32LBA 0x0C
-#define PART_TYPE_FAT16LBA 0x0E
-#define PART_TYPE_EXTDOSLBA 0x0F
-#define PART_TYPE_ONTRACK 0x33
-#define PART_TYPE_NOVELL 0x40
-#define PART_TYPE_PCIX 0x4B
-#define PART_TYPE_PHOENIXSAVE 0xA0
-#define PART_TYPE_CPM 0xDB
-#define PART_TYPE_DBFS 0xE0
-#define PART_TYPE_BBT 0xFF
-
-struct partrecord // length 16 bytes
-{
- BYTE prIsActive; // 0x80 indicates active partition
- BYTE prStartHead; // starting head for partition
- WORD prStartCylSect; // starting cylinder and sector
- BYTE prPartType; // partition type (see above)
- BYTE prEndHead; // ending head for this partition
- WORD prEndCylSect; // ending cylinder and sector
- DWORD prStartLBA; // first LBA sector for this partition
- DWORD prSize; // size of this partition (bytes or sectors ?)
-};
-
-
-struct partsector
-{
- CHAR psPartCode[512-64-2]; // pad so struct is 512b
- BYTE psPart[64]; // four partition records (64 bytes)
- BYTE psBootSectSig0; // two signature bytes (2 bytes)
- BYTE psBootSectSig1;
-#define BOOTSIG0 0x55
-#define BOOTSIG1 0xaa
-};
-
-
-
-// Format of a boot sector. This is the first sector on a DOS floppy disk
-// or the first sector of a partition on a hard disk. But, it is not the
-// first sector of a partitioned hard disk.
-struct bootsector33 {
- BYTE bsJump[3]; // jump inst E9xxxx or EBxx90
- CHAR bsOemName[8]; // OEM name and version
- CHAR bsBPB[19]; // BIOS parameter block
- CHAR bsDriveNumber; // drive number (0x80)
- CHAR bsBootCode[479]; // pad so struct is 512b
- BYTE bsBootSectSig0; // boot sector signature byte 0x55
- BYTE bsBootSectSig1; // boot sector signature byte 0xAA
-#define BOOTSIG0 0x55
-#define BOOTSIG1 0xaa
-};
-
-struct extboot {
- CHAR exDriveNumber; // drive number (0x80)
- CHAR exReserved1; // reserved
- CHAR exBootSignature; // ext. boot signature (0x29)
-#define EXBOOTSIG 0x29
- CHAR exVolumeID[4]; // volume ID number
- CHAR exVolumeLabel[11]; // volume label
- CHAR exFileSysType[8]; // fs type (FAT12 or FAT16)
-};
-
-struct bootsector50 {
- BYTE bsJump[3]; // jump inst E9xxxx or EBxx90
- CHAR bsOemName[8]; // OEM name and version
- CHAR bsBPB[25]; // BIOS parameter block
- CHAR bsExt[26]; // Bootsector Extension
- CHAR bsBootCode[448]; // pad so structure is 512b
- BYTE bsBootSectSig0; // boot sector signature byte 0x55
- BYTE bsBootSectSig1; // boot sector signature byte 0xAA
-#define BOOTSIG0 0x55
-#define BOOTSIG1 0xaa
-};
-
-struct bootsector710 {
- BYTE bsJump[3]; // jump inst E9xxxx or EBxx90
- CHAR bsOEMName[8]; // OEM name and version
- CHAR bsBPB[53]; // BIOS parameter block
- CHAR bsExt[26]; // Bootsector Extension
- CHAR bsBootCode[418]; // pad so structure is 512b
- BYTE bsBootSectSig2; // 2 & 3 are only defined for FAT32?
- BYTE bsBootSectSig3;
- BYTE bsBootSectSig0; // boot sector signature byte 0x55
- BYTE bsBootSectSig1; // boot sector signature byte 0xAA
-#define BOOTSIG0 0x55
-#define BOOTSIG1 0xaa
-#define BOOTSIG2 0
-#define BOOTSIG3 0
-};
-
-
-/***************************************************************/
-/***************************************************************/
-
-// BIOS Parameter Block (BPB) for DOS 3.3
-struct bpb33 {
- WORD bpbBytesPerSec; // bytes per sector
- BYTE bpbSecPerClust; // sectors per cluster
- WORD bpbResSectors; // number of reserved sectors
- BYTE bpbFATs; // number of FATs
- WORD bpbRootDirEnts; // number of root directory entries
- WORD bpbSectors; // total number of sectors
- BYTE bpbMedia; // media descriptor
- WORD bpbFATsecs; // number of sectors per FAT
- WORD bpbSecPerTrack; // sectors per track
- WORD bpbHeads; // number of heads
- WORD bpbHiddenSecs; // number of hidden sectors
-};
-
-// BPB for DOS 5.0
-// The difference is bpbHiddenSecs is a short for DOS 3.3,
-// and bpbHugeSectors is not present in the DOS 3.3 bpb.
-struct bpb50 {
- WORD bpbBytesPerSec; // bytes per sector
- BYTE bpbSecPerClust; // sectors per cluster
- WORD bpbResSectors; // number of reserved sectors
- BYTE bpbFATs; // number of FATs
- WORD bpbRootDirEnts; // number of root directory entries
- WORD bpbSectors; // total number of sectors
- BYTE bpbMedia; // media descriptor
- WORD bpbFATsecs; // number of sectors per FAT
- WORD bpbSecPerTrack; // sectors per track
- WORD bpbHeads; // number of heads
- DWORD bpbHiddenSecs; // # of hidden sectors
-// 3.3 compat ends here
- DWORD bpbHugeSectors; // # of sectors if bpbSectors == 0
-};
-
-// BPB for DOS 7.10 (FAT32)
-// This one has a few extensions to bpb50.
-struct bpb710 {
- WORD bpbBytesPerSec; // bytes per sector
- BYTE bpbSecPerClust; // sectors per cluster
- WORD bpbResSectors; // number of reserved sectors
- BYTE bpbFATs; // number of FATs
- WORD bpbRootDirEnts; // number of root directory entries
- WORD bpbSectors; // total number of sectors
- BYTE bpbMedia; // media descriptor
- WORD bpbFATsecs; // number of sectors per FAT
- WORD bpbSecPerTrack; // sectors per track
- WORD bpbHeads; // number of heads
- DWORD bpbHiddenSecs; // # of hidden sectors
-// 3.3 compat ends here
- DWORD bpbHugeSectors; // # of sectors if bpbSectors == 0
-// 5.0 compat ends here
- DWORD bpbBigFATsecs;// like bpbFATsecs for FAT32
- WORD bpbExtFlags; // extended flags:
-#define FATNUM 0xf // mask for numbering active FAT
-#define FATMIRROR 0x80 // FAT is mirrored (like it always was)
- WORD bpbFSVers; // filesystem version
-#define FSVERS 0 // currently only 0 is understood
- DWORD bpbRootClust; // start cluster for root directory
- WORD bpbFSInfo; // filesystem info structure sector
- WORD bpbBackup; // backup boot sector
- // There is a 12 byte filler here, but we ignore it
-};
-
-
-
-
-// ***************************************************************
-// * byte versions of the above structs *
-// ***************************************************************
-
-
-// BIOS Parameter Block (BPB) for DOS 3.3
-struct byte_bpb33 {
- CHAR bpbBytesPerSec[2]; // bytes per sector
- CHAR bpbSecPerClust; // sectors per cluster
- CHAR bpbResSectors[2]; // number of reserved sectors
- CHAR bpbFATs; // number of FATs
- CHAR bpbRootDirEnts[2]; // number of root directory entries
- CHAR bpbSectors[2]; // total number of sectors
- CHAR bpbMedia; // media descriptor
- CHAR bpbFATsecs[2]; // number of sectors per FAT
- CHAR bpbSecPerTrack[2]; // sectors per track
- CHAR bpbHeads[2]; // number of heads
- CHAR bpbHiddenSecs[2]; // number of hidden sectors
-};
-
-// BPB for DOS 5.0
-// The difference is bpbHiddenSecs is a short for DOS 3.3,
-// and bpbHugeSectors is not in the 3.3 bpb.
-struct byte_bpb50 {
- CHAR bpbBytesPerSec[2]; // bytes per sector
- CHAR bpbSecPerClust; // sectors per cluster
- CHAR bpbResSectors[2]; // number of reserved sectors
- CHAR bpbFATs; // number of FATs
- CHAR bpbRootDirEnts[2]; // number of root directory entries
- CHAR bpbSectors[2]; // total number of sectors
- CHAR bpbMedia; // media descriptor
- CHAR bpbFATsecs[2]; // number of sectors per FAT
- CHAR bpbSecPerTrack[2]; // sectors per track
- CHAR bpbHeads[2]; // number of heads
- CHAR bpbHiddenSecs[4]; // number of hidden sectors
- CHAR bpbHugeSectors[4]; // # of sectors if bpbSectors == 0
-};
-
-// BPB for DOS 7.10 (FAT32).
-// This one has a few extensions to bpb50.
-struct byte_bpb710 {
- BYTE bpbBytesPerSec[2]; // bytes per sector
- BYTE bpbSecPerClust; // sectors per cluster
- BYTE bpbResSectors[2]; // number of reserved sectors
- BYTE bpbFATs; // number of FATs
- BYTE bpbRootDirEnts[2]; // number of root directory entries
- BYTE bpbSectors[2]; // total number of sectors
- BYTE bpbMedia; // media descriptor
- BYTE bpbFATsecs[2]; // number of sectors per FAT
- BYTE bpbSecPerTrack[2]; // sectors per track
- BYTE bpbHeads[2]; // number of heads
- BYTE bpbHiddenSecs[4]; // # of hidden sectors
- BYTE bpbHugeSectors[4]; // # of sectors if bpbSectors == 0
- BYTE bpbBigFATsecs[4]; // like bpbFATsecs for FAT32
- BYTE bpbExtFlags[2]; // extended flags:
- BYTE bpbFSVers[2]; // filesystem version
- BYTE bpbRootClust[4]; // start cluster for root directory
- BYTE bpbFSInfo[2]; // filesystem info structure sector
- BYTE bpbBackup[2]; // backup boot sector
- // There is a 12 byte filler here, but we ignore it
-};
-
-// FAT32 FSInfo block.
-struct fsinfo {
- BYTE fsisig1[4];
- BYTE fsifill1[480];
- BYTE fsisig2[4];
- BYTE fsinfree[4];
- BYTE fsinxtfree[4];
- BYTE fsifill2[12];
- BYTE fsisig3[4];
- BYTE fsifill3[508];
- BYTE fsisig4[4];
-};
-
-
-/***************************************************************/
-/***************************************************************/
-
-
-// Structure of a dos directory entry.
-struct direntry {
- BYTE deName[8]; // filename, blank filled
-#define SLOT_EMPTY 0x00 // slot has never been used
-#define SLOT_E5 0x05 // the real value is 0xe5
-#define SLOT_DELETED 0xe5 // file in this slot deleted
- BYTE deExtension[3]; // extension, blank filled
- BYTE deAttributes; // file attributes
-#define ATTR_NORMAL 0x00 // normal file
-#define ATTR_READONLY 0x01 // file is readonly
-#define ATTR_HIDDEN 0x02 // file is hidden
-#define ATTR_SYSTEM 0x04 // file is a system file
-#define ATTR_VOLUME 0x08 // entry is a volume label
-#define ATTR_LONG_FILENAME 0x0f // this is a long filename entry
-#define ATTR_DIRECTORY 0x10 // entry is a directory name
-#define ATTR_ARCHIVE 0x20 // file is new or modified
- BYTE deLowerCase; // NT VFAT lower case flags
-#define LCASE_BASE 0x08 // filename base in lower case
-#define LCASE_EXT 0x10 // filename extension in lower case
- BYTE deCHundredth; // hundredth of seconds in CTime
- BYTE deCTime[2]; // create time
- BYTE deCDate[2]; // create date
- BYTE deADate[2]; // access date
- WORD deHighClust; // high bytes of cluster number
- BYTE deMTime[2]; // last update time
- BYTE deMDate[2]; // last update date
- WORD deStartCluster; // starting cluster of file
- DWORD deFileSize; // size of file in bytes
-};
-
-// number of directory entries in one sector
-#define DIRENTRIES_PER_SECTOR 0x10
-
-// Structure of a Win95 long name directory entry
-struct winentry {
- BYTE weCnt;
-#define WIN_LAST 0x40
-#define WIN_CNT 0x3f
- BYTE wePart1[10];
- BYTE weAttributes;
-#define ATTR_WIN95 0x0f
- BYTE weReserved1;
- BYTE weChksum;
- BYTE wePart2[12];
- WORD weReserved2;
- BYTE wePart3[4];
-};
-
-#define WIN_CHARS 13 // Number of chars per winentry
-
-// Maximum filename length in Win95
-// Note: Must be < sizeof(dirent.d_name)
-#define WIN_MAXLEN 255
-
-// This is the format of the contents of the deTime field in the direntry
-// structure.
-// We don't use bitfields because we don't know how compilers for
-// arbitrary machines will lay them out.
-#define DT_2SECONDS_MASK 0x1F // seconds divided by 2
-#define DT_2SECONDS_SHIFT 0
-#define DT_MINUTES_MASK 0x7E0 // minutes
-#define DT_MINUTES_SHIFT 5
-#define DT_HOURS_MASK 0xF800 // hours
-#define DT_HOURS_SHIFT 11
-
-// This is the format of the contents of the deDate field in the direntry
-// structure.
-#define DD_DAY_MASK 0x1F // day of month
-#define DD_DAY_SHIFT 0
-#define DD_MONTH_MASK 0x1E0 // month
-#define DD_MONTH_SHIFT 5
-#define DD_YEAR_MASK 0xFE00 // year - 1980
-#define DD_YEAR_SHIFT 9
-
-// Prototypes
-unsigned char fatInit( unsigned char device);
-unsigned int fatClusterSize(void);
-unsigned long fatGetDirEntry(unsigned int entry, unsigned int count);
-unsigned long fatGetFilesize(void);
-char* fatGetFilename(void);
-char* fatGetDirname(void);
-void fatLoadCluster(unsigned long cluster, unsigned char *buffer);
-unsigned long fatNextCluster(unsigned long cluster);
-
-#endif
diff --git a/build/shared/lib/avrlib/fixedpt.c b/build/shared/lib/avrlib/fixedpt.c
deleted file mode 100755
index f6c60cc14..000000000
--- a/build/shared/lib/avrlib/fixedpt.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*! \file fixedpt.c \brief Fixed-point math function library. */
-//*****************************************************************************
-//
-// File Name : 'fixedpt.c'
-// Title : Fixed-point math function library
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.01.26
-// Revised : 2003.02.02
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-
-#include "fixedpt.h"
-
-// Program ROM constants
-
-// Global variables
-u08 FixedPtBits;
-
-// Functions
-
-// fixedptInit() initializes fixed-point math function library
-void fixedptInit(u08 fixedPtBits)
-{
- // set the number of bits to use behind the point
- FixedPtBits = fixedPtBits;
-}
-
-s32 fixedptConvertFromInt(s32 int_number)
-{
- // convert integer to fixed-point number
- return (int_number<>FixedPtBits)+1;
- }
- else
- {
- // bit behind the point was a '0'
- // round down (truncate) to next lower integer
- return (fp_number>>FixedPtBits);
- }
-}
-
-s32 fixedptAdd(s32 a, s32 b)
-{
- // add a and b (a+b) with fixed-point math
- return a+b;
-}
-
-s32 fixedptSubtract(s32 a, s32 b)
-{
- // subtract a and b (a-b) with fixed-point math
- return a-b;
-}
-
-s32 fixedptMultiply(s32 a, s32 b)
-{
- // multiply a and b (a*b) with fixed-point math
- return (a*b)>>FixedPtBits;
-}
-
-s32 fixedptDivide(s32 numer, s32 denom)
-{
- // divide numer by denom (numer/denom) with fixed-point math
- return (numer<
- 0x02, 0x01, 0x51, 0x09, 0x06,// ?
- 0x32, 0x49, 0x79, 0x41, 0x3E,// @
- 0x7E, 0x11, 0x11, 0x11, 0x7E,// A
- 0x7F, 0x49, 0x49, 0x49, 0x36,// B
- 0x3E, 0x41, 0x41, 0x41, 0x22,// C
- 0x7F, 0x41, 0x41, 0x22, 0x1C,// D
- 0x7F, 0x49, 0x49, 0x49, 0x41,// E
- 0x7F, 0x09, 0x09, 0x01, 0x01,// F
- 0x3E, 0x41, 0x41, 0x51, 0x32,// G
- 0x7F, 0x08, 0x08, 0x08, 0x7F,// H
- 0x00, 0x41, 0x7F, 0x41, 0x00,// I
- 0x20, 0x40, 0x41, 0x3F, 0x01,// J
- 0x7F, 0x08, 0x14, 0x22, 0x41,// K
- 0x7F, 0x40, 0x40, 0x40, 0x40,// L
- 0x7F, 0x02, 0x04, 0x02, 0x7F,// M
- 0x7F, 0x04, 0x08, 0x10, 0x7F,// N
- 0x3E, 0x41, 0x41, 0x41, 0x3E,// O
- 0x7F, 0x09, 0x09, 0x09, 0x06,// P
- 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
- 0x7F, 0x09, 0x19, 0x29, 0x46,// R
- 0x46, 0x49, 0x49, 0x49, 0x31,// S
- 0x01, 0x01, 0x7F, 0x01, 0x01,// T
- 0x3F, 0x40, 0x40, 0x40, 0x3F,// U
- 0x1F, 0x20, 0x40, 0x20, 0x1F,// V
- 0x7F, 0x20, 0x18, 0x20, 0x7F,// W
- 0x63, 0x14, 0x08, 0x14, 0x63,// X
- 0x03, 0x04, 0x78, 0x04, 0x03,// Y
- 0x61, 0x51, 0x49, 0x45, 0x43,// Z
- 0x00, 0x00, 0x7F, 0x41, 0x41,// [
- 0x02, 0x04, 0x08, 0x10, 0x20,// "\"
- 0x41, 0x41, 0x7F, 0x00, 0x00,// ]
- 0x04, 0x02, 0x01, 0x02, 0x04,// ^
- 0x40, 0x40, 0x40, 0x40, 0x40,// _
- 0x00, 0x01, 0x02, 0x04, 0x00,// `
- 0x20, 0x54, 0x54, 0x54, 0x78,// a
- 0x7F, 0x48, 0x44, 0x44, 0x38,// b
- 0x38, 0x44, 0x44, 0x44, 0x20,// c
- 0x38, 0x44, 0x44, 0x48, 0x7F,// d
- 0x38, 0x54, 0x54, 0x54, 0x18,// e
- 0x08, 0x7E, 0x09, 0x01, 0x02,// f
- 0x08, 0x14, 0x54, 0x54, 0x3C,// g
- 0x7F, 0x08, 0x04, 0x04, 0x78,// h
- 0x00, 0x44, 0x7D, 0x40, 0x00,// i
- 0x20, 0x40, 0x44, 0x3D, 0x00,// j
- 0x00, 0x7F, 0x10, 0x28, 0x44,// k
- 0x00, 0x41, 0x7F, 0x40, 0x00,// l
- 0x7C, 0x04, 0x18, 0x04, 0x78,// m
- 0x7C, 0x08, 0x04, 0x04, 0x78,// n
- 0x38, 0x44, 0x44, 0x44, 0x38,// o
- 0x7C, 0x14, 0x14, 0x14, 0x08,// p
- 0x08, 0x14, 0x14, 0x18, 0x7C,// q
- 0x7C, 0x08, 0x04, 0x04, 0x08,// r
- 0x48, 0x54, 0x54, 0x54, 0x20,// s
- 0x04, 0x3F, 0x44, 0x40, 0x20,// t
- 0x3C, 0x40, 0x40, 0x20, 0x7C,// u
- 0x1C, 0x20, 0x40, 0x20, 0x1C,// v
- 0x3C, 0x40, 0x30, 0x40, 0x3C,// w
- 0x44, 0x28, 0x10, 0x28, 0x44,// x
- 0x0C, 0x50, 0x50, 0x50, 0x3C,// y
- 0x44, 0x64, 0x54, 0x4C, 0x44,// z
- 0x00, 0x08, 0x36, 0x41, 0x00,// {
- 0x00, 0x00, 0x7F, 0x00, 0x00,// |
- 0x00, 0x41, 0x36, 0x08, 0x00,// }
- 0x08, 0x08, 0x2A, 0x1C, 0x08,// ->
- 0x08, 0x1C, 0x2A, 0x08, 0x08 // <-
-};
-
-#endif
diff --git a/build/shared/lib/avrlib/fontgr.h b/build/shared/lib/avrlib/fontgr.h
deleted file mode 100755
index 5d8890987..000000000
--- a/build/shared/lib/avrlib/fontgr.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*! \file fontgr.h \brief Graphic LCD Font (Graphic Characters). */
-//*****************************************************************************
-//
-// File Name : 'fontgr.h'
-// Title : Graphic LCD Font (Graphic Charaters)
-// Author : Pascal Stang
-// Date : 10/19/2001
-// Revised : 10/19/2001
-// Version : 0.1
-// Target MCU : Atmel AVR
-// Editor Tabs : 4
-//
-//*****************************************************************************
-
-#ifndef FONTGR_H
-#define FONTGR_H
-
-#ifndef WIN32
-// AVR specific includes
- #include
-#endif
-
-static unsigned char __attribute__ ((progmem)) FontGr[] =
-{
-// format is one character per line:
-// length, byte array[length]
- 0x0B,0x3E,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x3C,0x00,// 0. Folder Icon
- 0x06,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF // 1. Solid 6x8 block
-};
-
-#endif
diff --git a/build/shared/lib/avrlib/glcd.c b/build/shared/lib/avrlib/glcd.c
deleted file mode 100755
index 6e70b59b0..000000000
--- a/build/shared/lib/avrlib/glcd.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*! \file glcd.c \brief Graphic LCD API functions. */
-//*****************************************************************************
-//
-// File Name : 'glcd.c'
-// Title : Graphic LCD API functions
-// Author : Pascal Stang - Copyright (C) 2002
-// Date : 5/30/2002
-// Revised : 5/30/2002
-// Version : 0.5
-// Target MCU : Atmel AVR
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
-// AVR specific includes
- #include
- #include
-#endif
-
-#include "glcd.h"
-
-// include hardware support
-#include "ks0108.h"
-// include fonts
-#include "font5x7.h"
-#include "fontgr.h"
-
-// graphic routines
-
-// set dot
-void glcdSetDot(u08 x, u08 y)
-{
- unsigned char temp;
-
- glcdSetAddress(x, y/8);
- temp = glcdDataRead(); // dummy read
- temp = glcdDataRead(); // read back current value
- glcdSetAddress(x, y/8);
- glcdDataWrite(temp | (1 << (y % 8)));
-
- glcdStartLine(0);
-}
-
-// clear dot
-void glcdClearDot(u08 x, u08 y)
-{
- unsigned char temp;
-
- glcdSetAddress(x, y/8);
- temp = glcdDataRead(); // dummy read
- temp = glcdDataRead(); // read back current value
- glcdSetAddress(x, y/8);
- glcdDataWrite(temp & ~(1 << (y % 8)));
-
- glcdStartLine(0);
-}
-
-// draw line
-void glcdLine(u08 x1, u08 y1, u08 x2, u08 y2)
-{
-};
-
-// draw rectangle
-void glcdRectangle(u08 x, u08 y, u08 a, u08 b)
-{
- unsigned char j;
-
- for (j = 0; j < a; j++) {
- glcdSetDot(x, y + j);
- glcdSetDot(x + b - 1, y + j);
- }
- for (j = 0; j < b; j++) {
- glcdSetDot(x + j, y);
- glcdSetDot(x + j, y + a - 1);
- }
-}
-
-// draw circle
-void glcdCircle(u08 xcenter, u08 ycenter, u08 radius)
-{
- int tswitch, y, x = 0;
- unsigned char d;
-
- d = ycenter - xcenter;
- y = radius;
- tswitch = 3 - 2 * radius;
- while (x <= y) {
- glcdSetDot(xcenter + x, ycenter + y); glcdSetDot(xcenter + x, ycenter - y);
- glcdSetDot(xcenter - x, ycenter + y); glcdSetDot(xcenter - x, ycenter - y);
- glcdSetDot(ycenter + y - d, ycenter + x); glcdSetDot(ycenter + y - d, ycenter - x);
- glcdSetDot(ycenter - y - d, ycenter + x); glcdSetDot(ycenter - y - d, ycenter - x);
-
- if (tswitch < 0) tswitch += (4 * x + 6);
- else {
- tswitch += (4 * (x - y) + 10);
- y--;
- }
- x++;
- }
-}
-
-// text routines
-
-// write a character at the current position
-void glcdWriteChar(unsigned char c)
-{
- u08 i = 0;
-
- for(i=0; i<5; i++)
- {
- glcdDataWrite(pgm_read_byte(&Font5x7[((c - 0x20) * 5) + i]));
- }
-
- // write a spacer line
- glcdDataWrite(0x00);
- // unless we're at the end of the display
- //if(xx == 128)
- // xx = 0;
- //else
- // glcdWriteData(0x00);
-
- //cbi(GLCD_Control, GLCD_CS1);
- //cbi(GLCD_Control, GLCD_CS2);
- glcdStartLine(0);
-}
-
-void glcdWriteCharGr(u08 grCharIdx)
-{
- u08 idx;
- u08 grLength;
- u08 grStartIdx = 0;
-
- // get starting index of graphic bitmap
- for(idx=0; idx
-#endif
-
-#include "global.h"
-
-#define LINE1 0
-#define LINE2 1
-#define LINE3 2
-#define LINE4 3
-#define LINE5 4
-#define LINE6 5
-#define LINE7 6
-#define LINE8 7
-
-#define ON 1
-#define OFF 0
-
-// API-level interface commands
-// ***** Public Functions *****
-
-//! set a dot on the display (x is horiz 0:127, y is vert 0:63)
-void glcdSetDot(u08 x, u08 y);
-
-//! clear a dot on the display (x is horiz 0:127, y is vert 0:63)
-void glcdClearDot(u08 x, u08 y);
-
-//! draw line
-void glcdLine(u08 x1, u08 y1, u08 x2, u08 y2);
-
-//! draw rectangle (coords????)
-void glcdRectangle(u08 x, u08 y, u08 a, u08 b);
-
-//! draw circle of at
-void glcdCircle(u08 xcenter, u08 ycenter, u08 radius);
-
-//! write a standard ascii charater (values 20-127)
-// to the display at current position
-void glcdWriteChar(unsigned char c);
-
-//! write a special graphic character/icon
-// to the display at current position
-void glcdWriteCharGr(u08 grCharIndex);
-
-// ***** Private Functions ***** (or depricated)
-void glcdPutStr(u08 *data);
-
-#endif
diff --git a/build/shared/lib/avrlib/gps.c b/build/shared/lib/avrlib/gps.c
deleted file mode 100755
index 01b9259ed..000000000
--- a/build/shared/lib/avrlib/gps.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*! \file gps.c \brief GPS position storage and processing library. */
-//*****************************************************************************
-//
-// File Name : 'gps.c'
-// Title : GPS position storage and processing function library
-// Author : Pascal Stang - Copyright (C) 2002-2005
-// Created : 2005.01.14
-// Revised : 2002.07.17
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
- #include
- #include
- #include
- #include
- #include
- #include
-#endif
-
-#include "global.h"
-#include "rprintf.h"
-#include "gps.h"
-
-// Global variables
-GpsInfoType GpsInfo;
-
-// Functions
-void gpsInit(void)
-{
-
-}
-
-GpsInfoType* gpsGetInfo(void)
-{
- return &GpsInfo;
-}
-
-void gpsInfoPrint(void)
-{
-
- rprintfProgStrM("TOW: "); rprintfFloat(8, GpsInfo.TimeOfWeek.f); rprintfCRLF();
- rprintfProgStrM("WkNum: "); rprintfNum(10,4,0,' ',GpsInfo.WeekNum); rprintfCRLF();
- rprintfProgStrM("UTCoffset:"); rprintfFloat(8, GpsInfo.UtcOffset.f); rprintfCRLF();
- rprintfProgStrM("Num SVs: "); rprintfNum(10,4,0,' ',GpsInfo.numSVs); rprintfCRLF();
-
- rprintfProgStrM("X_ECEF: "); rprintfFloat(8, GpsInfo.PosECEF.x.f); rprintfCRLF();
- rprintfProgStrM("Y_ECEF: "); rprintfFloat(8, GpsInfo.PosECEF.y.f); rprintfCRLF();
- rprintfProgStrM("Z_ECEF: "); rprintfFloat(8, GpsInfo.PosECEF.z.f); rprintfCRLF();
- rprintfProgStrM("TOF: "); rprintfFloat(8, GpsInfo.PosECEF.TimeOfFix.f); rprintfCRLF();
- rprintfProgStrM("Updates: "); rprintfNum(10,6,0,' ',GpsInfo.PosECEF.updates); rprintfCRLF();
-
- //u08 str[20];
- //rprintfProgStrM(" PosLat: "); rprintfStr(dtostrf(GpsInfo.PosLat.f, 10, 5, str));
- rprintfProgStrM("PosLat: "); rprintfFloat(8, 180*(GpsInfo.PosLLA.lat.f/PI)); rprintfCRLF();
- rprintfProgStrM("PosLon: "); rprintfFloat(8, 180*(GpsInfo.PosLLA.lon.f/PI)); rprintfCRLF();
- rprintfProgStrM("PosAlt: "); rprintfFloat(8, GpsInfo.PosLLA.alt.f); rprintfCRLF();
- rprintfProgStrM("TOF: "); rprintfFloat(8, GpsInfo.PosLLA.TimeOfFix.f); rprintfCRLF();
- rprintfProgStrM("Updates: "); rprintfNum(10,6,0,' ',GpsInfo.PosLLA.updates); rprintfCRLF();
-
- rprintfProgStrM("Vel East: "); rprintfFloat(8, GpsInfo.VelENU.east.f); rprintfCRLF();
- rprintfProgStrM("Vel North:"); rprintfFloat(8, GpsInfo.VelENU.north.f); rprintfCRLF();
- rprintfProgStrM("Vel Up: "); rprintfFloat(8, GpsInfo.VelENU.up.f); rprintfCRLF();
-// rprintfProgStrM("TOF: "); rprintfFloat(8, GpsInfo.VelENU.TimeOfFix.f); rprintfCRLF();
- rprintfProgStrM("Updates: "); rprintfNum(10,6,0,' ',GpsInfo.VelENU.updates); rprintfCRLF();
-
- rprintfProgStrM("Vel Head: "); rprintfFloat(8, GpsInfo.VelHS.heading.f); rprintfCRLF();
- rprintfProgStrM("Vel Speed:"); rprintfFloat(8, GpsInfo.VelHS.speed.f); rprintfCRLF();
-// rprintfProgStrM("TOF: "); rprintfFloat(8, GpsInfo.VelHS.TimeOfFix.f); rprintfCRLF();
- rprintfProgStrM("Updates: "); rprintfNum(10,6,0,' ',GpsInfo.VelHS.updates); rprintfCRLF();
-
-}
-
-
diff --git a/build/shared/lib/avrlib/gps.h b/build/shared/lib/avrlib/gps.h
deleted file mode 100755
index 68f2ff10c..000000000
--- a/build/shared/lib/avrlib/gps.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*! \file gps.h \brief GPS position storage and processing library. */
-//*****************************************************************************
-//
-// File Name : 'gps.h'
-// Title : GPS position storage and processing function library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 2002.08.29
-// Revised : 2002.08.29
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef GPS_H
-#define GPS_H
-
-#include "global.h"
-
-// constants/macros/typdefs
-typedef union union_float_u32
-{
- float f;
- unsigned long i;
- unsigned char b[4];
-} float_u32;
-
-typedef union union_double_u64
-{
- double f;
- unsigned long long i;
- unsigned char b[8];
-} double_u64;
-
-struct PositionLLA
-{
- float_u32 lat;
- float_u32 lon;
- float_u32 alt;
- float_u32 TimeOfFix;
- u16 updates;
-};
-
-struct VelocityENU
-{
- float_u32 east;
- float_u32 north;
- float_u32 up;
- float_u32 TimeOfFix;
- u16 updates;
-};
-
-struct VelocityHS
-{
- float_u32 heading;
- float_u32 speed;
- float_u32 TimeOfFix;
- u16 updates;
-};
-
-struct PositionECEF
-{
- float_u32 x;
- float_u32 y;
- float_u32 z;
- float_u32 TimeOfFix;
- u16 updates;
-};
-
-struct VelocityECEF
-{
- float_u32 x;
- float_u32 y;
- float_u32 z;
- float_u32 TimeOfFix;
- u16 updates;
-};
-
-typedef struct struct_GpsInfo
-{
- float_u32 TimeOfWeek;
- u16 WeekNum;
- float_u32 UtcOffset;
- u08 numSVs;
-
- struct PositionLLA PosLLA;
- struct PositionECEF PosECEF;
- struct VelocityECEF VelECEF;
- struct VelocityENU VelENU;
- struct VelocityHS VelHS;
-
-} GpsInfoType;
-
-// functions
-void gpsInit(void);
-GpsInfoType* gpsGetInfo(void);
-void gpsInfoPrint(void);
-
-#endif
diff --git a/build/shared/lib/avrlib/i2c.c b/build/shared/lib/avrlib/i2c.c
deleted file mode 100755
index 898e16483..000000000
--- a/build/shared/lib/avrlib/i2c.c
+++ /dev/null
@@ -1,635 +0,0 @@
-/*! \file i2c.c \brief I2C interface using AVR Two-Wire Interface (TWI) hardware. */
-//*****************************************************************************
-//
-// File Name : 'i2c.c'
-// Title : I2C interface using AVR Two-Wire Interface (TWI) hardware
-// Author : Pascal Stang - Copyright (C) 2002-2003
-// Created : 2002.06.25
-// Revised : 2003.03.02
-// Version : 0.9
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// Description : I2C (pronounced "eye-squared-see") is a two-wire bidirectional
-// network designed for easy transfer of information between a wide variety
-// of intelligent devices. Many of the Atmel AVR series processors have
-// hardware support for transmitting and receiving using an I2C-type bus.
-// In addition to the AVRs, there are thousands of other parts made by
-// manufacturers like Philips, Maxim, National, TI, etc that use I2C as
-// their primary means of communication and control. Common device types
-// are A/D & D/A converters, temp sensors, intelligent battery monitors,
-// MP3 decoder chips, EEPROM chips, multiplexing switches, etc.
-//
-// I2C uses only two wires (SDA and SCL) to communicate bidirectionally
-// between devices. I2C is a multidrop network, meaning that you can have
-// several devices on a single bus. Because I2C uses a 7-bit number to
-// identify which device it wants to talk to, you cannot have more than
-// 127 devices on a single bus.
-//
-// I2C ordinarily requires two 4.7K pull-up resistors to power (one each on
-// SDA and SCL), but for small numbers of devices (maybe 1-4), it is enough
-// to activate the internal pull-up resistors in the AVR processor. To do
-// this, set the port pins, which correspond to the I2C pins SDA/SCL, high.
-// For example, on the mega163, sbi(PORTC, 0); sbi(PORTC, 1);.
-//
-// For complete information about I2C, see the Philips Semiconductor
-// website. They created I2C and have the largest family of devices that
-// work with I2C.
-//
-// Note: Many manufacturers market I2C bus devices under a different or generic
-// bus name like "Two-Wire Interface". This is because Philips still holds
-// "I2C" as a trademark. For example, SMBus and SMBus devices are hardware
-// compatible and closely related to I2C. They can be directly connected
-// to an I2C bus along with other I2C devices are are generally accessed in
-// the same way as I2C devices. SMBus is often found on modern motherboards
-// for temp sensing and other low-level control tasks.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "i2c.h"
-
-#include "rprintf.h" // include printf function library
-#include "uart2.h"
-
-// Standard I2C bit rates are:
-// 100KHz for slow speed
-// 400KHz for high speed
-
-//#define I2C_DEBUG
-
-// I2C state and address variables
-static volatile eI2cStateType I2cState;
-static u08 I2cDeviceAddrRW;
-// send/transmit buffer (outgoing data)
-static u08 I2cSendData[I2C_SEND_DATA_BUFFER_SIZE];
-static u08 I2cSendDataIndex;
-static u08 I2cSendDataLength;
-// receive buffer (incoming data)
-static u08 I2cReceiveData[I2C_RECEIVE_DATA_BUFFER_SIZE];
-static u08 I2cReceiveDataIndex;
-static u08 I2cReceiveDataLength;
-
-// function pointer to i2c receive routine
-//! I2cSlaveReceive is called when this processor
-// is addressed as a slave for writing
-static void (*i2cSlaveReceive)(u08 receiveDataLength, u08* recieveData);
-//! I2cSlaveTransmit is called when this processor
-// is addressed as a slave for reading
-static u08 (*i2cSlaveTransmit)(u08 transmitDataLengthMax, u08* transmitData);
-
-// functions
-void i2cInit(void)
-{
- // set pull-up resistors on I2C bus pins
- // TODO: should #ifdef these
- sbi(PORTC, 0); // i2c SCL on ATmega163,323,16,32,etc
- sbi(PORTC, 1); // i2c SDA on ATmega163,323,16,32,etc
- sbi(PORTD, 0); // i2c SCL on ATmega128,64
- sbi(PORTD, 1); // i2c SDA on ATmega128,64
-
- // clear SlaveReceive and SlaveTransmit handler to null
- i2cSlaveReceive = 0;
- i2cSlaveTransmit = 0;
- // set i2c bit rate to 100KHz
- i2cSetBitrate(100);
- // enable TWI (two-wire interface)
- sbi(TWCR, TWEN);
- // set state
- I2cState = I2C_IDLE;
- // enable TWI interrupt and slave address ACK
- sbi(TWCR, TWIE);
- sbi(TWCR, TWEA);
- //outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWEA));
- // enable interrupts
- sei();
-}
-
-void i2cSetBitrate(u16 bitrateKHz)
-{
- u08 bitrate_div;
- // set i2c bitrate
- // SCL freq = F_CPU/(16+2*TWBR))
- #ifdef TWPS0
- // for processors with additional bitrate division (mega128)
- // SCL freq = F_CPU/(16+2*TWBR*4^TWPS)
- // set TWPS to zero
- cbi(TWSR, TWPS0);
- cbi(TWSR, TWPS1);
- #endif
- // calculate bitrate division
- bitrate_div = ((F_CPU/1000l)/bitrateKHz);
- if(bitrate_div >= 16)
- bitrate_div = (bitrate_div-16)/2;
- outb(TWBR, bitrate_div);
-}
-
-void i2cSetLocalDeviceAddr(u08 deviceAddr, u08 genCallEn)
-{
- // set local device address (used in slave mode only)
- outb(TWAR, ((deviceAddr&0xFE) | (genCallEn?1:0)) );
-}
-
-void i2cSetSlaveReceiveHandler(void (*i2cSlaveRx_func)(u08 receiveDataLength, u08* recieveData))
-{
- i2cSlaveReceive = i2cSlaveRx_func;
-}
-
-void i2cSetSlaveTransmitHandler(u08 (*i2cSlaveTx_func)(u08 transmitDataLengthMax, u08* transmitData))
-{
- i2cSlaveTransmit = i2cSlaveTx_func;
-}
-
-inline void i2cSendStart(void)
-{
- // send start condition
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWSTA));
-}
-
-inline void i2cSendStop(void)
-{
- // transmit stop condition
- // leave with TWEA on for slave receiving
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWEA)|BV(TWSTO));
-}
-
-inline void i2cWaitForComplete(void)
-{
- // wait for i2c interface to complete operation
- while( !(inb(TWCR) & BV(TWINT)) );
-}
-
-inline void i2cSendByte(u08 data)
-{
- // save data to the TWDR
- outb(TWDR, data);
- // begin send
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT));
-}
-
-inline void i2cReceiveByte(u08 ackFlag)
-{
- // begin receive over i2c
- if( ackFlag )
- {
- // ackFlag = TRUE: ACK the recevied data
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWEA));
- }
- else
- {
- // ackFlag = FALSE: NACK the recevied data
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT));
- }
-}
-
-inline u08 i2cGetReceivedByte(void)
-{
- // retieve received data byte from i2c TWDR
- return( inb(TWDR) );
-}
-
-inline u08 i2cGetStatus(void)
-{
- // retieve current i2c status from i2c TWSR
- return( inb(TWSR) );
-}
-
-void i2cMasterSend(u08 deviceAddr, u08 length, u08* data)
-{
- u08 i;
- // wait for interface to be ready
- while(I2cState);
- // set state
- I2cState = I2C_MASTER_TX;
- // save data
- I2cDeviceAddrRW = (deviceAddr & 0xFE); // RW cleared: write operation
- for(i=0; i 1)
- {
- i2cReceiveByte(TRUE);
- i2cWaitForComplete();
- *data++ = i2cGetReceivedByte();
- // decrement length
- length--;
- }
-
- // accept receive data and nack it (last-byte signal)
- i2cReceiveByte(FALSE);
- i2cWaitForComplete();
- *data++ = i2cGetReceivedByte();
- }
- else
- {
- // device did not ACK it's address,
- // data will not be transferred
- // return error
- retval = I2C_ERROR_NODEV;
- }
-
- // transmit stop condition
- // leave with TWEA on for slave receiving
- i2cSendStop();
-
- // enable TWI interrupt
- sbi(TWCR, TWIE);
-
- return retval;
-}
-/*
-void i2cMasterTransferNI(u08 deviceAddr, u08 sendlength, u08* senddata, u08 receivelength, u08* receivedata)
-{
- // disable TWI interrupt
- cbi(TWCR, TWIE);
-
- // send start condition
- i2cSendStart();
- i2cWaitForComplete();
-
- // if there's data to be sent, do it
- if(sendlength)
- {
- // send device address with write
- i2cSendByte( deviceAddr & 0xFE );
- i2cWaitForComplete();
-
- // send data
- while(sendlength)
- {
- i2cSendByte( *senddata++ );
- i2cWaitForComplete();
- sendlength--;
- }
- }
-
- // if there's data to be received, do it
- if(receivelength)
- {
- // send repeated start condition
- i2cSendStart();
- i2cWaitForComplete();
-
- // send device address with read
- i2cSendByte( deviceAddr | 0x01 );
- i2cWaitForComplete();
-
- // accept receive data and ack it
- while(receivelength > 1)
- {
- i2cReceiveByte(TRUE);
- i2cWaitForComplete();
- *receivedata++ = i2cGetReceivedByte();
- // decrement length
- receivelength--;
- }
-
- // accept receive data and nack it (last-byte signal)
- i2cReceiveByte(TRUE);
- i2cWaitForComplete();
- *receivedata++ = i2cGetReceivedByte();
- }
-
- // transmit stop condition
- // leave with TWEA on for slave receiving
- i2cSendStop();
- while( !(inb(TWCR) & BV(TWSTO)) );
-
- // enable TWI interrupt
- sbi(TWCR, TWIE);
-}
-*/
-
-//! I2C (TWI) interrupt service routine
-SIGNAL(SIG_2WIRE_SERIAL)
-{
- // read status bits
- u08 status = inb(TWSR) & TWSR_STATUS_MASK;
-
- switch(status)
- {
- // Master General
- case TW_START: // 0x08: Sent start condition
- case TW_REP_START: // 0x10: Sent repeated start condition
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: M->START\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // send device address
- i2cSendByte(I2cDeviceAddrRW);
- break;
-
- // Master Transmitter & Receiver status codes
- case TW_MT_SLA_ACK: // 0x18: Slave address acknowledged
- case TW_MT_DATA_ACK: // 0x28: Data acknowledged
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: MT->SLA_ACK or DATA_ACK\r\n");
- rprintfInit(uart1SendByte);
- #endif
- if(I2cSendDataIndex < I2cSendDataLength)
- {
- // send data
- i2cSendByte( I2cSendData[I2cSendDataIndex++] );
- }
- else
- {
- // transmit stop condition, enable SLA ACK
- i2cSendStop();
- // set state
- I2cState = I2C_IDLE;
- }
- break;
- case TW_MR_DATA_NACK: // 0x58: Data received, NACK reply issued
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: MR->DATA_NACK\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // store final received data byte
- I2cReceiveData[I2cReceiveDataIndex++] = inb(TWDR);
- // continue to transmit STOP condition
- case TW_MR_SLA_NACK: // 0x48: Slave address not acknowledged
- case TW_MT_SLA_NACK: // 0x20: Slave address not acknowledged
- case TW_MT_DATA_NACK: // 0x30: Data not acknowledged
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: MTR->SLA_NACK or MT->DATA_NACK\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // transmit stop condition, enable SLA ACK
- i2cSendStop();
- // set state
- I2cState = I2C_IDLE;
- break;
- case TW_MT_ARB_LOST: // 0x38: Bus arbitration lost
- //case TW_MR_ARB_LOST: // 0x38: Bus arbitration lost
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: MT->ARB_LOST\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // release bus
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT));
- // set state
- I2cState = I2C_IDLE;
- // release bus and transmit start when bus is free
- //outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWSTA));
- break;
- case TW_MR_DATA_ACK: // 0x50: Data acknowledged
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: MR->DATA_ACK\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // store received data byte
- I2cReceiveData[I2cReceiveDataIndex++] = inb(TWDR);
- // fall-through to see if more bytes will be received
- case TW_MR_SLA_ACK: // 0x40: Slave address acknowledged
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: MR->SLA_ACK\r\n");
- rprintfInit(uart1SendByte);
- #endif
- if(I2cReceiveDataIndex < (I2cReceiveDataLength-1))
- // data byte will be received, reply with ACK (more bytes in transfer)
- i2cReceiveByte(TRUE);
- else
- // data byte will be received, reply with NACK (final byte in transfer)
- i2cReceiveByte(FALSE);
- break;
-
- // Slave Receiver status codes
- case TW_SR_SLA_ACK: // 0x60: own SLA+W has been received, ACK has been returned
- case TW_SR_ARB_LOST_SLA_ACK: // 0x68: own SLA+W has been received, ACK has been returned
- case TW_SR_GCALL_ACK: // 0x70: GCA+W has been received, ACK has been returned
- case TW_SR_ARB_LOST_GCALL_ACK: // 0x78: GCA+W has been received, ACK has been returned
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: SR->SLA_ACK\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // we are being addressed as slave for writing (data will be received from master)
- // set state
- I2cState = I2C_SLAVE_RX;
- // prepare buffer
- I2cReceiveDataIndex = 0;
- // receive data byte and return ACK
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWEA));
- break;
- case TW_SR_DATA_ACK: // 0x80: data byte has been received, ACK has been returned
- case TW_SR_GCALL_DATA_ACK: // 0x90: data byte has been received, ACK has been returned
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: SR->DATA_ACK\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // get previously received data byte
- I2cReceiveData[I2cReceiveDataIndex++] = inb(TWDR);
- // check receive buffer status
- if(I2cReceiveDataIndex < I2C_RECEIVE_DATA_BUFFER_SIZE)
- {
- // receive data byte and return ACK
- i2cReceiveByte(TRUE);
- //outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWEA));
- }
- else
- {
- // receive data byte and return NACK
- i2cReceiveByte(FALSE);
- //outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT));
- }
- break;
- case TW_SR_DATA_NACK: // 0x88: data byte has been received, NACK has been returned
- case TW_SR_GCALL_DATA_NACK: // 0x98: data byte has been received, NACK has been returned
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: SR->DATA_NACK\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // receive data byte and return NACK
- i2cReceiveByte(FALSE);
- //outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT));
- break;
- case TW_SR_STOP: // 0xA0: STOP or REPEATED START has been received while addressed as slave
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: SR->SR_STOP\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // switch to SR mode with SLA ACK
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWEA));
- // i2c receive is complete, call i2cSlaveReceive
- if(i2cSlaveReceive) i2cSlaveReceive(I2cReceiveDataIndex, I2cReceiveData);
- // set state
- I2cState = I2C_IDLE;
- break;
-
- // Slave Transmitter
- case TW_ST_SLA_ACK: // 0xA8: own SLA+R has been received, ACK has been returned
- case TW_ST_ARB_LOST_SLA_ACK: // 0xB0: GCA+R has been received, ACK has been returned
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: ST->SLA_ACK\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // we are being addressed as slave for reading (data must be transmitted back to master)
- // set state
- I2cState = I2C_SLAVE_TX;
- // request data from application
- if(i2cSlaveTransmit) I2cSendDataLength = i2cSlaveTransmit(I2C_SEND_DATA_BUFFER_SIZE, I2cSendData);
- // reset data index
- I2cSendDataIndex = 0;
- // fall-through to transmit first data byte
- case TW_ST_DATA_ACK: // 0xB8: data byte has been transmitted, ACK has been received
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: ST->DATA_ACK\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // transmit data byte
- outb(TWDR, I2cSendData[I2cSendDataIndex++]);
- if(I2cSendDataIndex < I2cSendDataLength)
- // expect ACK to data byte
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWEA));
- else
- // expect NACK to data byte
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT));
- break;
- case TW_ST_DATA_NACK: // 0xC0: data byte has been transmitted, NACK has been received
- case TW_ST_LAST_DATA: // 0xC8:
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: ST->DATA_NACK or LAST_DATA\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // all done
- // switch to open slave
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWEA));
- // set state
- I2cState = I2C_IDLE;
- break;
-
- // Misc
- case TW_NO_INFO: // 0xF8: No relevant state information
- // do nothing
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: NO_INFO\r\n");
- rprintfInit(uart1SendByte);
- #endif
- break;
- case TW_BUS_ERROR: // 0x00: Bus error due to illegal start or stop condition
- #ifdef I2C_DEBUG
- rprintfInit(uart1AddToTxBuffer);
- rprintf("I2C: BUS_ERROR\r\n");
- rprintfInit(uart1SendByte);
- #endif
- // reset internal hardware and release bus
- outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK)|BV(TWINT)|BV(TWSTO)|BV(TWEA));
- // set state
- I2cState = I2C_IDLE;
- break;
- }
-}
-
-eI2cStateType i2cGetState(void)
-{
- return I2cState;
-}
diff --git a/build/shared/lib/avrlib/i2c.h b/build/shared/lib/avrlib/i2c.h
deleted file mode 100755
index aaf192b80..000000000
--- a/build/shared/lib/avrlib/i2c.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/*! \file i2c.h \brief I2C interface using AVR Two-Wire Interface (TWI) hardware. */
-//*****************************************************************************
-//
-// File Name : 'i2c.h'
-// Title : I2C interface using AVR Two-Wire Interface (TWI) hardware
-// Author : Pascal Stang - Copyright (C) 2002-2003
-// Created : 2002.06.25
-// Revised : 2003.03.03
-// Version : 0.9
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef I2C_H
-#define I2C_H
-
-#include "global.h"
-
-// include project-specific configuration
-#include "i2cconf.h"
-
-// TWSR values (not bits)
-// (taken from avr-libc twi.h - thank you Marek Michalkiewicz)
-// Master
-#define TW_START 0x08
-#define TW_REP_START 0x10
-// Master Transmitter
-#define TW_MT_SLA_ACK 0x18
-#define TW_MT_SLA_NACK 0x20
-#define TW_MT_DATA_ACK 0x28
-#define TW_MT_DATA_NACK 0x30
-#define TW_MT_ARB_LOST 0x38
-// Master Receiver
-#define TW_MR_ARB_LOST 0x38
-#define TW_MR_SLA_ACK 0x40
-#define TW_MR_SLA_NACK 0x48
-#define TW_MR_DATA_ACK 0x50
-#define TW_MR_DATA_NACK 0x58
-// Slave Transmitter
-#define TW_ST_SLA_ACK 0xA8
-#define TW_ST_ARB_LOST_SLA_ACK 0xB0
-#define TW_ST_DATA_ACK 0xB8
-#define TW_ST_DATA_NACK 0xC0
-#define TW_ST_LAST_DATA 0xC8
-// Slave Receiver
-#define TW_SR_SLA_ACK 0x60
-#define TW_SR_ARB_LOST_SLA_ACK 0x68
-#define TW_SR_GCALL_ACK 0x70
-#define TW_SR_ARB_LOST_GCALL_ACK 0x78
-#define TW_SR_DATA_ACK 0x80
-#define TW_SR_DATA_NACK 0x88
-#define TW_SR_GCALL_DATA_ACK 0x90
-#define TW_SR_GCALL_DATA_NACK 0x98
-#define TW_SR_STOP 0xA0
-// Misc
-#define TW_NO_INFO 0xF8
-#define TW_BUS_ERROR 0x00
-
-// defines and constants
-#define TWCR_CMD_MASK 0x0F
-#define TWSR_STATUS_MASK 0xF8
-
-// return values
-#define I2C_OK 0x00
-#define I2C_ERROR_NODEV 0x01
-
-// types
-typedef enum
-{
- I2C_IDLE = 0, I2C_BUSY = 1,
- I2C_MASTER_TX = 2, I2C_MASTER_RX = 3,
- I2C_SLAVE_TX = 4, I2C_SLAVE_RX = 5
-} eI2cStateType;
-
-// functions
-
-//! Initialize I2C (TWI) interface
-void i2cInit(void);
-
-//! Set the I2C transaction bitrate (in KHz)
-void i2cSetBitrate(u16 bitrateKHz);
-
-// I2C setup and configurations commands
-//! Set the local (AVR processor's) I2C device address
-void i2cSetLocalDeviceAddr(u08 deviceAddr, u08 genCallEn);
-
-//! Set the user function which handles receiving (incoming) data as a slave
-void i2cSetSlaveReceiveHandler(void (*i2cSlaveRx_func)(u08 receiveDataLength, u08* recieveData));
-//! Set the user function which handles transmitting (outgoing) data as a slave
-void i2cSetSlaveTransmitHandler(u08 (*i2cSlaveTx_func)(u08 transmitDataLengthMax, u08* transmitData));
-
-// Low-level I2C transaction commands
-//! Send an I2C start condition in Master mode
-void i2cSendStart(void);
-//! Send an I2C stop condition in Master mode
-void i2cSendStop(void);
-//! Wait for current I2C operation to complete
-void i2cWaitForComplete(void);
-//! Send an (address|R/W) combination or a data byte over I2C
-void i2cSendByte(u08 data);
-//! Receive a data byte over I2C
-// ackFlag = TRUE if recevied data should be ACK'ed
-// ackFlag = FALSE if recevied data should be NACK'ed
-void i2cReceiveByte(u08 ackFlag);
-//! Pick up the data that was received with i2cReceiveByte()
-u08 i2cGetReceivedByte(void);
-//! Get current I2c bus status from TWSR
-u08 i2cGetStatus(void);
-
-// high-level I2C transaction commands
-
-//! send I2C data to a device on the bus
-void i2cMasterSend(u08 deviceAddr, u08 length, u08 *data);
-//! receive I2C data from a device on the bus
-void i2cMasterReceive(u08 deviceAddr, u08 length, u08* data);
-
-//! send I2C data to a device on the bus (non-interrupt based)
-u08 i2cMasterSendNI(u08 deviceAddr, u08 length, u08* data);
-//! receive I2C data from a device on the bus (non-interrupt based)
-u08 i2cMasterReceiveNI(u08 deviceAddr, u08 length, u08 *data);
-
-//! Get the current high-level state of the I2C interface
-eI2cStateType i2cGetState(void);
-
-#endif
diff --git a/build/shared/lib/avrlib/i2ceeprom.c b/build/shared/lib/avrlib/i2ceeprom.c
deleted file mode 100755
index e0721ec6f..000000000
--- a/build/shared/lib/avrlib/i2ceeprom.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*! \file i2ceeprom.c \brief Interface for standard I2C EEPROM memories. */
-//*****************************************************************************
-//
-// File Name : 'i2ceeprom.c'
-// Title : Interface for standard I2C EEPROM memories
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.04.23
-// Revised : 2003.04.23
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "i2c.h"
-#include "i2ceeprom.h"
-
-// Standard I2C bit rates are:
-// 100KHz for slow speed
-// 400KHz for high speed
-
-// functions
-void i2ceepromInit(void)
-{
- // although there is no code here
- // don't forget to initialize the I2C interface itself
-}
-
-u08 i2ceepromReadByte(u08 i2cAddr, u32 memAddr)
-{
- u08 packet[2];
- // prepare address
- packet[0] = (memAddr>>8);
- packet[1] = (memAddr&0x00FF);
- // send memory address we wish to access to the memory chip
- i2cMasterSendNI(i2cAddr, 2, packet);
- // retrieve the data at this memory address
- i2cMasterReceiveNI(i2cAddr, 1, packet);
- // return data
- return packet[0];
-}
-
-void i2ceepromWriteByte(u08 i2cAddr, u32 memAddr, u08 data)
-{
- u08 packet[3];
- // prepare address + data
- packet[0] = (memAddr>>8);
- packet[1] = (memAddr&0x00FF);
- packet[2] = data;
- // send memory address we wish to access to the memory chip
- // along with the data we wish to write
- i2cMasterSendNI(i2cAddr, 3, packet);
-}
diff --git a/build/shared/lib/avrlib/i2ceeprom.h b/build/shared/lib/avrlib/i2ceeprom.h
deleted file mode 100755
index 9c14f66c3..000000000
--- a/build/shared/lib/avrlib/i2ceeprom.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*! \file i2ceeprom.h \brief Interface for standard I2C EEPROM memories. */
-//*****************************************************************************
-//
-// File Name : 'i2ceeprom.h'
-// Title : Interface for standard I2C EEPROM memories
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.04.23
-// Revised : 2003.04.23
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef I2CEEPROM_H
-#define I2CEEPROM_H
-
-#include "global.h"
-
-// functions
-
-//! Initialize I2C EEPROM interface
-void i2ceepromInit(void);
-
-//! In the I2C EEPROM at [i2cAddr], read a byte from memory location [memAddr]
-u08 i2ceepromReadByte(u08 i2cAddr, u32 memAddr);
-
-//! In the I2C EEPROM at [i2cAddr], write a byte [data] to the memory location [memAddr]
-void i2ceepromWriteByte(u08 i2cAddr, u32 memAddr, u08 data);
-
-#endif
diff --git a/build/shared/lib/avrlib/i2csw.c b/build/shared/lib/avrlib/i2csw.c
deleted file mode 100755
index 65cd03e7b..000000000
--- a/build/shared/lib/avrlib/i2csw.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*! \file i2csw.c \brief Software-driven I2C interface using port pins. */
-//*****************************************************************************
-//
-// File Name : 'i2csw.c'
-// Title : Software-driven I2C interface using port pins
-// Author : Pascal Stang
-// Created : 11/22/2000
-// Revised : 5/2/2002
-// Version : 1.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-
-#include "i2csw.h"
-
-// Standard I2C bit rates are:
-// 100KHz for slow speed
-// 400KHz for high speed
-
-//#define QDEL delay(5) // i2c quarter-bit delay
-//#define HDEL delay(10) // i2c half-bit delay
-
-// i2c quarter-bit delay
-#define QDEL asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop");
-// i2c half-bit delay
-#define HDEL asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop");
-
-#define I2C_SDL_LO cbi( SDAPORT, SDA)
-#define I2C_SDL_HI sbi( SDAPORT, SDA)
-
-#define I2C_SCL_LO cbi( SCLPORT, SCL);
-#define I2C_SCL_HI sbi( SCLPORT, SCL);
-
-#define I2C_SCL_TOGGLE HDEL; I2C_SCL_HI; HDEL; I2C_SCL_LO;
-#define I2C_START I2C_SDL_LO; QDEL; I2C_SCL_LO;
-#define I2C_STOP HDEL; I2C_SCL_HI; QDEL; I2C_SDL_HI; HDEL;
-
-/*
-void i2ct(void)
-{
- HDEL; I2C_SCL_HI; HDEL; I2C_SCL_LO;
-}
-
-void i2cstart(void)
-{
- I2C_SDL_LO; QDEL; I2C_SCL_LO;
-}
-
-void i2cstop(void)
-{
- HDEL; I2C_SCL_HI; QDEL; I2C_SDL_HI; HDEL;
-}
-
-
-#define I2C_SCL_TOGGLE i2ct();
-#define I2C_START i2cstart();
-#define I2C_STOP i2cstop();
-*/
-
-UINT i2cPutbyte(u08 b)
-{
- int i;
-
- for (i=7;i>=0;i--)
- {
- if ( b & (1<=0;i--)
- {
- HDEL;
- I2C_SCL_HI; // clock HI
- c = inb(SDAPIN) & (1< register
-void i2cSend(BYTE device, BYTE sub, BYTE length, BYTE *data);
-
-// receive I2C data from register
-void i2cReceive(BYTE device, BYTE sub, BYTE length, BYTE *data);
-
-#endif
diff --git a/build/shared/lib/avrlib/index.html b/build/shared/lib/avrlib/index.html
deleted file mode 100755
index b6f77b535..000000000
--- a/build/shared/lib/avrlib/index.html
+++ /dev/null
@@ -1,134 +0,0 @@
-
-
-Procyon AVRlib - C-Language Function Library for Atmel AVR Processors
-
-
-
-
-Procyon AVRlib
- C-Language Function Library for
- Atmel AVR Processors
-
-
- Written by Pascal Stang | Updated:
-
-
-
-
- - AVRlib is a library of easy-to-use C functions for a variety of common
- and uncommon tasks using AVR processors.
- - The goal of AVRlib is to allow programmers to work quickly towards their
- end goal by reducing the time needed to write basic support functions and
- code.
- - Most AVRlib header (*.h) files have lengthy descriptions of how to use
- the supplied library functions. All code (*.c) files are heavily commented
- with additional information.
- - Documentation is still being improved and refined on many libraries. When
- getting familiar with a library, look first at the HTML docs and any example
- code that is available in the examples directory. Then look inside the *.h
- and *conf.h files, and then the *.c file for that library for more details
- and documentation.
- - Significant example code is included in avrlib.zip. The example
- code is heavily commented and strives to illustrate how to use various AVRlib
- function libraries.
- - Download AVRlib (with docs and code examples)
-
-
-
- - On-line HTML Documentation
- - Release Notes
- - AVRlib Install Guide for manual installation
- of zip file
-
-
-
-
-
-
Procyon AVRlib Overview
-
-
-
-
- General |
- AVR Built-In Peripheral
- Drivers |
-
-
-
-
- - Byte Buffering (circular)
- - Bit Buffering (linear)
- - Printf and other formatted print functions
- - VT100 Terminal Output
- - Command Line Interface
- - FAT16/32 File System (support is read-only for now)
- - STX/ETX Packet Protocol
- - Fixed-Point Math Library (basic operations only)
-
- |
-
-
- - Timers (with PWM, interrupt management)
- - UART (interrupt driven)
- - A/D Converter
- - I2C Master/Slave (interrupt and non-intr)
- - SPI Interface
- - External Interrupts
-
- |
-
-
- External Hardware
- Device Drivers |
- AVR Software-Emulated Devices |
-
-
-
-
- - Character LCD Modules (HD44780-based)
- - I2C EEPROM Memories
- - SPI EEPROM Memories
- - MMC/SD Card Interface (SPI mode)
- - LIS3L02 ST Accelerometer
- - IDE/ATA Interface (for hard disks and CF cards)
- - Quadrature Encoders
- - RC-Servos (up to 8 channels)
- - STA013 MP3 Decoder Chip
- - GPS Receivers (via serial port)
-
- - NMEA-0813 Protocol
- - Trimble TSIP Protocol
-
-
- - Graphic LCD Modules
-
- - KS0108/HD61202 Controller
- - T6963 Controller
- - LCD Fonts and Symbols
-
-
-
- |
-
- - I2c Master (Bit-Bang)
- - UART (software-based, timer interrupt driven)
- - Pulse Output (timer-based, variable frequency)
- - Intel-type Memory Bus (Address & Data Buses + nRD,nWR)
-
- |
-
-
-
-
- Written by Pascal Stang | Updated:
-
-
-
-
-
-
diff --git a/build/shared/lib/avrlib/install.html b/build/shared/lib/avrlib/install.html
deleted file mode 100755
index 927c9691d..000000000
--- a/build/shared/lib/avrlib/install.html
+++ /dev/null
@@ -1,154 +0,0 @@
-
-
-
-SCU Robotic Systems Laboratory - Installing Procyon AVRlib
-
-
-
-
-
-Installing Procyon AVRlib
-Sections
-
- - Overview
- - Downloading
- - Installing
- - Testing
-
-Written by Pascal Stang | Updated:
-
-
-
-1. Overview
-
- Procyon AVRlib is an open-source collection of C-language function libraries
- for the Atmel AVR series processors. The goal of AVRlib is to provide the
- programmer with a code base which performs the most often needed tasks in
- embedded system programming. Hopefully, this will allow the programmer to
- focus on high-level operation of their code rather than get bogged down in
- the details of low-level code.
- In short, AVRlib is a bunch of functions that do things commonly needed in
- embedded systems. Despite the learning curve of getting started, for most
- projects, using AVRlib will shorten the time spent programming and/or improve
- the quality or functionality of the final product.
- AVRlib functions are available for a wide variety of tasks and purposes.
- In general, AVRlib tries to address the following kinds of needs:
-
- - Functions which control or interface to AVR processor hardware (like timers,
- uarts, the a2d converter, etc)
- - Functions which interface to or drive devices often used in embedded systems
- (like LCDs, hard disks, gps units, etc)
- - Functions which create higher-level functionality from processor resources
- (like pulse generation, software uarts, software i2c bus, etc)
-
- For a partial list of currently available function libraries see the AVRlib
- Main Page.
-
-2. Downloading
-
- AVRlib is currently available as individual files, or a complete zip file.
- Both are available from the AVRlib Main Page.
- Downloading the complete avrlib.zip
- file is highly recommended as documentation and code examples are included
- in the zip.
-
-3. Installing
-
- This installation for AVRlib assumes you have
- already installed the AVR-GCC or WinAVR compiler and successfully tested it.
- You can install AVRlib anywhere you like, however, it's suggested that you
- install it in a directory alongside your own AVR code projects. Create or
- choose a top-level directory to hold both AVRlib and the project folders which
- you will create to hold the code for each individual project you work on.
- The directory you choose should not contain spaces in its name or path. Some
- examples are:
-
-c:\Code\AVR (GOOD)
-c:\My Code (NOT RECOMMENDED - HAS SPACES IN PATH)
-
- From the download step you should have an avrlib.zip file.
- Unzip this file into the code directory you chose above. Be sure to preserve
- the internal directory structure of the zip file when you unzip it. Afterward,
- you can delete avrlib.zip but you may want to keep it for later re-installs
- or as a backup.
- You should now have an avrlib directory where you installed
- AVRlib. If you have some time, get familiar with what's inside some of the
- directories. Your directories should look something like this:
-
-c:\Code\AVR\avrlib <-- AVRlib header and code files
-c:\Code\AVR\avrlib\conf <-- AVRlib template configuration files
-c:\Code\AVR\avrlib\docs <-- AVRlib documentation
-c:\Code\AVR\avrlib\examples <-- AVRlib example applications
-c:\Code\AVR\avrlib\make <-- AVRlib makefile include (avrproj_make file in here)
- Finally, you need to create an environment variable AVRLIB
- which points to the directory where you "installed" or unzipped
- the AVRlib files so the compiler can find them. An example might be:
- AVRLIB = c:/code/avr/avrlib <-- change to actual AVRlib install directory
-
- If you are unsure how to set environment variables on your system, look at
- the WinAVR/AVR-GCC installation guide elsewhere on this site or consult the
- web.
- AVRlib installation is complete!
-
-4. Testing
-
- There are a few simple steps you can take to verify that AVRlib is properly
- installed:
- (This assumes you have previously installed
- and tested the AVR-GCC or WinAVR compiler)
-
- - Open a Command Prompt (find it in your Start Menu or
- select Run, and run cmd.exe)
- - Change directories to the location where you installed AVRlib. For example:
- cd c:\Code\AVR\AVRlib
- - Go into the examples directory. cd examples
- - Pick an example to try compiling such as rprintf and change to that directory.
- cd rprintf
- - Type make clean at the prompt
- - Type make
- - If your output looked like this then you just compiled your first AVRlib
- program:
-
-C:\Code\AVR\avrlib\examples\rprintf>make
-avr-gcc -c -g -Os -Wall -Wstrict-prototypes -Ic:/code/avr/avrlib -Wa,-ahlms=rpri
-ntftest.lst -mmcu=atmega323 -I. rprintftest.c -o rprintftest.o
-avr-gcc -c -g -Os -Wall -Wstrict-prototypes -Ic:/code/avr/avrlib -Wa,-ahlms=c:/c
-ode/avr/avrlib/buffer.lst -mmcu=atmega323 -I. c:/code/avr/avrlib/buffer.c -o c:/
-code/avr/avrlib/buffer.o
-avr-gcc -c -g -Os -Wall -Wstrict-prototypes -Ic:/code/avr/avrlib -Wa,-ahlms=c:/c
-ode/avr/avrlib/uart.lst -mmcu=atmega323 -I. c:/code/avr/avrlib/uart.c -o c:/code
-/avr/avrlib/uart.o
-avr-gcc -c -g -Os -Wall -Wstrict-prototypes -Ic:/code/avr/avrlib -Wa,-ahlms=c:/c
-ode/avr/avrlib/rprintf.lst -mmcu=atmega323 -I. c:/code/avr/avrlib/rprintf.c -o c
-:/code/avr/avrlib/rprintf.o
-avr-gcc -c -g -Os -Wall -Wstrict-prototypes -Ic:/code/avr/avrlib -Wa,-ahlms=c:/c
-ode/avr/avrlib/timer.lst -mmcu=atmega323 -I. c:/code/avr/avrlib/timer.c -o c:/co
-de/avr/avrlib/timer.o
-avr-gcc -c -g -Os -Wall -Wstrict-prototypes -Ic:/code/avr/avrlib -Wa,-ahlms=c:/c
-ode/avr/avrlib/vt100.lst -mmcu=atmega323 -I. c:/code/avr/avrlib/vt100.c -o c:/co
-de/avr/avrlib/vt100.o
-avr-gcc c:/code/avr/avrlib/buffer.o c:/code/avr/avrlib/uart.o c:/code/avr/avrli
-b/rprintf.o c:/code/avr/avrlib/timer.o c:/code/avr/avrlib/vt100.o rprintftest.o
- -Wl,-Map=rprintftest.map,--cref -mmcu=atmega323 -o rprintftest.elf
-avr-objcopy -O ihex -R .eeprom rprintftest.elf rprintftest.hex
-avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section
--lma .eeprom=0 -O ihex rprintftest.elf rprintftest.eep
-avr-size rprintftest.elf
- text data bss dec hex filename
- 9596 0 192 9788 263c rprintftest.elf
-Errors: none
-rm c:/code/avr/avrlib/vt100.o c:/code/avr/avrlib/rprintf.o c:/code/avr/avrlib/ua
-rt.o c:/code/avr/avrlib/timer.o c:/code/avr/avrlib/buffer.o
-
-C:\Code\AVR\avrlib\examples\rprintf>
-
-
- AVRlib is ready to use!
-
-
-
-Written by Pascal Stang | Updated:
-
-
-
-
diff --git a/build/shared/lib/avrlib/ks0108.c b/build/shared/lib/avrlib/ks0108.c
deleted file mode 100755
index e1fec2c3f..000000000
--- a/build/shared/lib/avrlib/ks0108.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*! \file ks0108.c \brief Graphic LCD driver for HD61202/KS0108 displays. */
-//*****************************************************************************
-//
-// File Name : 'ks0108.c'
-// Title : Graphic LCD driver for HD61202/KS0108 displays
-// Author : Pascal Stang - Copyright (C) 2001-2003
-// Date : 10/19/2002
-// Revised : 5/5/2003
-// Version : 0.5
-// Target MCU : Atmel AVR
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
-// AVR specific includes
- #include
- #include
-#endif
-
-#include "global.h"
-#include "ks0108.h"
-
-// global variables
-GrLcdStateType GrLcdState;
-
-/*************************************************************/
-/********************** LOCAL FUNCTIONS **********************/
-/*************************************************************/
-
-void glcdInitHW(void)
-{
- // initialize I/O ports
- // if I/O interface is in use
-#ifdef GLCD_PORT_INTERFACE
-
- //TODO: make setup of chip select lines contingent on how
- // many controllers are actually in the display
-
- // initialize LCD control lines levels
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS0);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS1);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS2);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS3);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RESET);
- // initialize LCD control port to output
- sbi(GLCD_CTRL_DDR, GLCD_CTRL_RS);
- sbi(GLCD_CTRL_DDR, GLCD_CTRL_RW);
- sbi(GLCD_CTRL_DDR, GLCD_CTRL_E);
- sbi(GLCD_CTRL_DDR, GLCD_CTRL_CS0);
- sbi(GLCD_CTRL_DDR, GLCD_CTRL_CS1);
- sbi(GLCD_CTRL_DDR, GLCD_CTRL_CS2);
- sbi(GLCD_CTRL_DDR, GLCD_CTRL_CS3);
- sbi(GLCD_CTRL_DDR, GLCD_CTRL_RESET);
- // initialize LCD data
- outb(GLCD_DATA_PORT, 0x00);
- // initialize LCD data port to output
- outb(GLCD_DATA_DDR, 0xFF);
-#endif
-}
-
-void glcdControllerSelect(u08 controller)
-{
-#ifdef GLCD_PORT_INTERFACE
- //TODO: make control of chip select lines contingent on how
- // many controllers are actually in the display
-
- // unselect all controllers
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS0);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS1);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS2);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS3);
-
- // select requested controller
- switch(controller)
- {
- case 0: sbi(GLCD_CTRL_PORT, GLCD_CTRL_CS0); break;
- case 1: sbi(GLCD_CTRL_PORT, GLCD_CTRL_CS1); break;
- case 2: sbi(GLCD_CTRL_PORT, GLCD_CTRL_CS2); break;
- case 3: sbi(GLCD_CTRL_PORT, GLCD_CTRL_CS3); break;
- default: break;
- }
-#endif
-}
-
-void glcdBusyWait(u08 controller)
-{
-#ifdef GLCD_PORT_INTERFACE
- cli();
- // wait until LCD busy bit goes to zero
- // select the controller chip
- glcdControllerSelect(controller);
- // do a read from control register
- outb(GLCD_DATA_PORT, 0xFF);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
- outb(GLCD_DATA_DDR, 0x00);
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- asm volatile ("nop"); asm volatile ("nop");
- while(inb(GLCD_DATA_PIN) & GLCD_STATUS_BUSY)
- {
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- }
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
- outb(GLCD_DATA_DDR, 0xFF);
- sei();
-#else
- // sbi(MCUCR, SRW); // enable RAM waitstate
- // wait until LCD busy bit goes to zero
- while(*(volatile unsigned char *)
- (GLCD_CONTROLLER0_CTRL_ADDR + GLCD_CONTROLLER_ADDR_OFFSET*controller) & GLCD_STATUS_BUSY);
- // cbi(MCUCR, SRW); // disable RAM waitstate
-#endif
-}
-
-void glcdControlWrite(u08 controller, u08 data)
-{
-#ifdef GLCD_PORT_INTERFACE
- cli();
- glcdBusyWait(controller); // wait until LCD not busy
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- outb(GLCD_DATA_DDR, 0xFF);
- outb(GLCD_DATA_PORT, data);
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- sei();
-#else
- //sbi(MCUCR, SRW); // enable RAM waitstate
- glcdBusyWait(controller); // wait until LCD not busy
- *(volatile unsigned char *) (GLCD_CONTROLLER0_CTRL_ADDR + GLCD_CONTROLLER_ADDR_OFFSET*controller) = data;
- //cbi(MCUCR, SRW); // disable RAM waitstate
-#endif
-}
-
-u08 glcdControlRead(u08 controller)
-{
- register u08 data;
-#ifdef GLCD_PORT_INTERFACE
- cli();
- glcdBusyWait(controller); // wait until LCD not busy
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
- outb(GLCD_DATA_DDR, 0x00);
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- data = inb(GLCD_DATA_PIN);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
- outb(GLCD_DATA_DDR, 0xFF);
- sei();
-#else
- //sbi(MCUCR, SRW); // enable RAM waitstate
- glcdBusyWait(controller); // wait until LCD not busy
- data = *(volatile unsigned char *) (GLCD_CONTROLLER0_CTRL_ADDR + GLCD_CONTROLLER_ADDR_OFFSET*controller);
- //cbi(MCUCR, SRW); // disable RAM waitstate
-#endif
- return data;
-}
-
-void glcdDataWrite(u08 data)
-{
- register u08 controller = (GrLcdState.lcdXAddr/GLCD_CONTROLLER_XPIXELS);
-#ifdef GLCD_PORT_INTERFACE
- cli();
- glcdBusyWait(controller); // wait until LCD not busy
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- outb(GLCD_DATA_DDR, 0xFF);
- outb(GLCD_DATA_PORT, data);
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- sei();
-#else
- //sbi(MCUCR, SRW); // enable RAM waitstate
- glcdBusyWait(controller); // wait until LCD not busy
- *(volatile unsigned char *) (GLCD_CONTROLLER0_CTRL_ADDR + GLCD_CONTROLLER_ADDR_OFFSET*controller) = data;
- //cbi(MCUCR, SRW); // disable RAM waitstate
-#endif
- // increment our local address counter
- GrLcdState.ctrlr[controller].xAddr++;
- GrLcdState.lcdXAddr++;
- if(GrLcdState.lcdXAddr >= GLCD_XPIXELS)
- {
- GrLcdState.lcdYAddr++;
- glcdSetYAddress(GrLcdState.lcdYAddr);
- glcdSetXAddress(0);
- }
-}
-
-u08 glcdDataRead(void)
-{
- register u08 data;
- register u08 controller = (GrLcdState.lcdXAddr/GLCD_CONTROLLER_XPIXELS);
-#ifdef GLCD_PORT_INTERFACE
- cli();
- glcdBusyWait(controller); // wait until LCD not busy
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
- outb(GLCD_DATA_DDR, 0x00);
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- asm volatile ("nop"); asm volatile ("nop");
- data = inb(GLCD_DATA_PIN);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
- sei();
-#else
- //sbi(MCUCR, SRW); // enable RAM waitstate
- glcdBusyWait(controller); // wait until LCD not busy
- data = *(volatile unsigned char *) (GLCD_CONTROLLER0_CTRL_ADDR + GLCD_CONTROLLER_ADDR_OFFSET*controller);
- //cbi(MCUCR, SRW); // disable RAM waitstate
-#endif
- // increment our local address counter
- GrLcdState.ctrlr[controller].xAddr++;
- GrLcdState.lcdXAddr++;
- if(GrLcdState.lcdXAddr >= GLCD_XPIXELS)
- {
- GrLcdState.lcdYAddr++;
- glcdSetYAddress(GrLcdState.lcdYAddr);
- glcdSetXAddress(0);
- }
- return data;
-}
-
-void glcdReset(u08 resetState)
-{
- // reset lcd if argument is true
- // run lcd if argument is false
-#ifdef GLCD_PORT_INTERFACE
- if(resetState)
- cbi(GLCD_CTRL_PORT, GLCD_CTRL_RESET);
- else
- sbi(GLCD_CTRL_PORT, GLCD_CTRL_RESET);
-#endif
-}
-
-void glcdSetXAddress(u08 xAddr)
-{
- u08 i;
- // record address change locally
- GrLcdState.lcdXAddr = xAddr;
-
- // clear y (col) address on all controllers
- for(i=0; i>3); pageAddr++)
- {
- // set page address
- glcdSetAddress(0, pageAddr);
- // clear all lines of this page of display memory
- for(xAddr=0; xAddrLCD IS BUSY
-#define GLCD_STATUS_ONOFF 0x20 // (0)->LCD IS ON
-#define GLCD_STATUS_RESET 0x10 // (1)->LCD IS RESET
-
-// determine the number of controllers
-// (make sure we round up for partial use of more than one controller)
-#define GLCD_NUM_CONTROLLERS ((GLCD_XPIXELS+GLCD_CONTROLLER_XPIXELS-1)/GLCD_CONTROLLER_XPIXELS)
-
-// typedefs/structures
-typedef struct struct_GrLcdCtrlrStateType
-{
- unsigned char xAddr;
- unsigned char yAddr;
-} GrLcdCtrlrStateType;
-
-typedef struct struct_GrLcdStateType
-{
- unsigned char lcdXAddr;
- unsigned char lcdYAddr;
- GrLcdCtrlrStateType ctrlr[GLCD_NUM_CONTROLLERS];
-} GrLcdStateType;
-
-// function prototypes
-void glcdInitHW(void);
-void glcdBusyWait(u08 controller);
-void glcdControlWrite(u08 controller, u08 data);
-u08 glcdControlRead(u08 controller);
-void glcdDataWrite(u08 data);
-u08 glcdDataRead(void);
-void glcdSetXAddress(u08 xAddr);
-void glcdSetYAddress(u08 yAddr);
-
-
-//! Initialize the display, clear it, and prepare it for access
-void glcdInit(void);
-//! Clear the display
-void glcdClearScreen(void);
-//! Set display memory access point back to upper,left corner
-void glcdHome(void);
-//! Set display memory access point to row [line] and column [col] assuming 5x7 font
-void glcdGotoChar(u08 line, u08 col);
-//! Set display memory access point to [x] horizontal pixel and [y] vertical line
-void glcdSetAddress(u08 x, u08 yLine);
-//! Set display memory access point to row [line] and column [col] assuming 5x7 font
-void glcdStartLine(u08 start);
-//! Generic delay routine for timed glcd access
-void glcdDelay(u16 p);
-#endif
diff --git a/build/shared/lib/avrlib/lcd.c b/build/shared/lib/avrlib/lcd.c
deleted file mode 100755
index cfe823e92..000000000
--- a/build/shared/lib/avrlib/lcd.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/*! \file lcd.c \brief Character LCD driver for HD44780/SED1278 displays. */
-//*****************************************************************************
-//
-// File Name : 'lcd.c'
-// Title : Character LCD driver for HD44780/SED1278 displays
-// (usable in mem-mapped, or I/O mode)
-// Author : Pascal Stang
-// Created : 11/22/2000
-// Revised : 4/30/2002
-// Version : 1.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-
-#include "global.h"
-#include "timer.h"
-
-#include "lcd.h"
-
-// custom LCD characters
-unsigned char __attribute__ ((progmem)) LcdCustomChar[] =
-{
- 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, // 0. 0/5 full progress block
- 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x00, // 1. 1/5 full progress block
- 0x00, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, // 2. 2/5 full progress block
- 0x00, 0x1F, 0x1C, 0x1C, 0x1C, 0x1C, 0x1F, 0x00, // 3. 3/5 full progress block
- 0x00, 0x1F, 0x1E, 0x1E, 0x1E, 0x1E, 0x1F, 0x00, // 4. 4/5 full progress block
- 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, // 5. 5/5 full progress block
- 0x03, 0x07, 0x0F, 0x1F, 0x0F, 0x07, 0x03, 0x00, // 6. rewind arrow
- 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, // 7. stop block
- 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x00, // 8. pause bars
- 0x18, 0x1C, 0x1E, 0x1F, 0x1E, 0x1C, 0x18, 0x00, // 9. fast-forward arrow
- 0x00, 0x04, 0x04, 0x0E, 0x0E, 0x1F, 0x1F, 0x00, // 10. scroll up arrow
- 0x00, 0x1F, 0x1F, 0x0E, 0x0E, 0x04, 0x04, 0x00, // 11. scroll down arrow
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 12. blank character
- 0x00, 0x0E, 0x19, 0x15, 0x13, 0x0E, 0x00, 0x00, // 13. animated play icon frame 0
- 0x00, 0x0E, 0x15, 0x15, 0x15, 0x0E, 0x00, 0x00, // 14. animated play icon frame 1
- 0x00, 0x0E, 0x13, 0x15, 0x19, 0x0E, 0x00, 0x00, // 15. animated play icon frame 2
- 0x00, 0x0E, 0x11, 0x1F, 0x11, 0x0E, 0x00, 0x00, // 16. animated play icon frame 3
-};
-
-/*************************************************************/
-/********************** LOCAL FUNCTIONS **********************/
-/*************************************************************/
-
-void lcdInitHW(void)
-{
- // initialize I/O ports
- // if I/O interface is in use
-#ifdef LCD_PORT_INTERFACE
- // initialize LCD control lines
- cbi(LCD_CTRL_PORT, LCD_CTRL_RS);
- cbi(LCD_CTRL_PORT, LCD_CTRL_RW);
- cbi(LCD_CTRL_PORT, LCD_CTRL_E);
- // initialize LCD control lines to output
- sbi(LCD_CTRL_DDR, LCD_CTRL_RS);
- sbi(LCD_CTRL_DDR, LCD_CTRL_RW);
- sbi(LCD_CTRL_DDR, LCD_CTRL_E);
- // initialize LCD data port to input
- // initialize LCD data lines to pull-up
- #ifdef LCD_DATA_4BIT
- outb(LCD_DATA_DDR, inb(LCD_DATA_DDR)&0x0F); // set data I/O lines to input (4bit)
- outb(LCD_DATA_POUT, inb(LCD_DATA_POUT)|0xF0); // set pull-ups to on (4bit)
- #else
- outb(LCD_DATA_DDR, 0x00); // set data I/O lines to input (8bit)
- outb(LCD_DATA_POUT, 0xFF); // set pull-ups to on (8bit)
- #endif
-#else
- // enable external memory bus if not already enabled
- sbi(MCUCR, SRE); // enable bus interface
-#endif
-}
-
-void lcdBusyWait(void)
-{
- // wait until LCD busy bit goes to zero
- // do a read from control register
-#ifdef LCD_PORT_INTERFACE
- cbi(LCD_CTRL_PORT, LCD_CTRL_RS); // set RS to "control"
- #ifdef LCD_DATA_4BIT
- outb(LCD_DATA_DDR, inb(LCD_DATA_DDR)&0x0F); // set data I/O lines to input (4bit)
- outb(LCD_DATA_POUT, inb(LCD_DATA_POUT)|0xF0); // set pull-ups to on (4bit)
- #else
- outb(LCD_DATA_DDR, 0x00); // set data I/O lines to input (8bit)
- outb(LCD_DATA_POUT, 0xFF); // set pull-ups to on (8bit)
- #endif
- sbi(LCD_CTRL_PORT, LCD_CTRL_RW); // set R/W to "read"
- sbi(LCD_CTRL_PORT, LCD_CTRL_E); // set "E" line
- LCD_DELAY; // wait
- while(inb(LCD_DATA_PIN) & 1<>4; // input data, low 4 bits
- cbi(LCD_CTRL_PORT, LCD_CTRL_E); // clear "E" line
- #else
- // 8 bit read
- sbi(LCD_CTRL_PORT, LCD_CTRL_E); // set "E" line
- LCD_DELAY; // wait
- LCD_DELAY; // wait
- data = inb(LCD_DATA_PIN); // input data, 8bits
- cbi(LCD_CTRL_PORT, LCD_CTRL_E); // clear "E" line
- #endif
- // leave data lines in input mode so they can be most easily used for other purposes
-#else
- //sbi(MCUCR, SRW); // enable RAM waitstate
- lcdBusyWait(); // wait until LCD not busy
- data = *((volatile unsigned char *) (LCD_CTRL_ADDR));
- //cbi(MCUCR, SRW); // disable RAM waitstate
-#endif
- return data;
-}
-
-void lcdDataWrite(u08 data)
-{
-// write a data byte to the display
-#ifdef LCD_PORT_INTERFACE
- lcdBusyWait(); // wait until LCD not busy
- sbi(LCD_CTRL_PORT, LCD_CTRL_RS); // set RS to "data"
- cbi(LCD_CTRL_PORT, LCD_CTRL_RW); // set R/W to "write"
- #ifdef LCD_DATA_4BIT
- // 4 bit write
- sbi(LCD_CTRL_PORT, LCD_CTRL_E); // set "E" line
- outb(LCD_DATA_DDR, inb(LCD_DATA_DDR)|0xF0); // set data I/O lines to output (4bit)
- outb(LCD_DATA_POUT, (inb(LCD_DATA_POUT)&0x0F) | (data&0xF0) ); // output data, high 4 bits
- LCD_DELAY; // wait
- LCD_DELAY; // wait
- cbi(LCD_CTRL_PORT, LCD_CTRL_E); // clear "E" line
- LCD_DELAY; // wait
- LCD_DELAY; // wait
- sbi(LCD_CTRL_PORT, LCD_CTRL_E); // set "E" line
- outb(LCD_DATA_POUT, (inb(LCD_DATA_POUT)&0x0F) | (data<<4) ); // output data, low 4 bits
- LCD_DELAY; // wait
- LCD_DELAY; // wait
- cbi(LCD_CTRL_PORT, LCD_CTRL_E); // clear "E" line
- #else
- // 8 bit write
- sbi(LCD_CTRL_PORT, LCD_CTRL_E); // set "E" line
- outb(LCD_DATA_DDR, 0xFF); // set data I/O lines to output (8bit)
- outb(LCD_DATA_POUT, data); // output data, 8bits
- LCD_DELAY; // wait
- LCD_DELAY; // wait
- cbi(LCD_CTRL_PORT, LCD_CTRL_E); // clear "E" line
- #endif
- // leave data lines in input mode so they can be most easily used for other purposes
- #ifdef LCD_DATA_4BIT
- outb(LCD_DATA_DDR, inb(LCD_DATA_DDR)&0x0F); // set data I/O lines to input (4bit)
- outb(LCD_DATA_POUT, inb(LCD_DATA_POUT)|0xF0); // set pull-ups to on (4bit)
- #else
- outb(LCD_DATA_DDR, 0x00); // set data I/O lines to input (8bit)
- outb(LCD_DATA_POUT, 0xFF); // set pull-ups to on (8bit)
- #endif
-#else
- // memory bus write
- //sbi(MCUCR, SRW); // enable RAM waitstate
- lcdBusyWait(); // wait until LCD not busy
- *((volatile unsigned char *) (LCD_DATA_ADDR)) = data;
- //cbi(MCUCR, SRW); // disable RAM waitstate
-#endif
-}
-
-u08 lcdDataRead(void)
-{
-// read a data byte from the display
- register u08 data;
-#ifdef LCD_PORT_INTERFACE
- lcdBusyWait(); // wait until LCD not busy
- #ifdef LCD_DATA_4BIT
- outb(LCD_DATA_DDR, inb(LCD_DATA_DDR)&0x0F); // set data I/O lines to input (4bit)
- outb(LCD_DATA_POUT, inb(LCD_DATA_POUT)|0xF0); // set pull-ups to on (4bit)
- #else
- outb(LCD_DATA_DDR, 0x00); // set data I/O lines to input (8bit)
- outb(LCD_DATA_POUT, 0xFF); // set pull-ups to on (8bit)
- #endif
- sbi(LCD_CTRL_PORT, LCD_CTRL_RS); // set RS to "data"
- sbi(LCD_CTRL_PORT, LCD_CTRL_RW); // set R/W to "read"
- #ifdef LCD_DATA_4BIT
- // 4 bit read
- sbi(LCD_CTRL_PORT, LCD_CTRL_E); // set "E" line
- LCD_DELAY; // wait
- LCD_DELAY; // wait
- data = inb(LCD_DATA_PIN)&0xF0; // input data, high 4 bits
- cbi(LCD_CTRL_PORT, LCD_CTRL_E); // clear "E" line
- LCD_DELAY; // wait
- LCD_DELAY; // wait
- sbi(LCD_CTRL_PORT, LCD_CTRL_E); // set "E" line
- LCD_DELAY; // wait
- LCD_DELAY; // wait
- data |= inb(LCD_DATA_PIN)>>4; // input data, low 4 bits
- cbi(LCD_CTRL_PORT, LCD_CTRL_E); // clear "E" line
- #else
- // 8 bit read
- sbi(LCD_CTRL_PORT, LCD_CTRL_E); // set "E" line
- LCD_DELAY; // wait
- LCD_DELAY; // wait
- data = inb(LCD_DATA_PIN); // input data, 8bits
- cbi(LCD_CTRL_PORT, LCD_CTRL_E); // clear "E" line
- #endif
- // leave data lines in input mode so they can be most easily used for other purposes
-#else
- // memory bus read
- //sbi(MCUCR, SRW); // enable RAM waitstate
- lcdBusyWait(); // wait until LCD not busy
- data = *((volatile unsigned char *) (LCD_DATA_ADDR));
- //cbi(MCUCR, SRW); // disable RAM waitstate
-#endif
- return data;
-}
-
-
-
-/*************************************************************/
-/********************* PUBLIC FUNCTIONS **********************/
-/*************************************************************/
-
-void lcdInit()
-{
- // initialize hardware
- lcdInitHW();
- // LCD function set
- lcdControlWrite(LCD_FUNCTION_DEFAULT);
- // clear LCD
- lcdControlWrite(1< pixelprogress )
- {
- // this is a partial or empty block
- if( ((i*(u16)PROGRESSPIXELS_PER_CHAR)) > pixelprogress )
- {
- // this is an empty block
- // use space character?
- c = 0;
- }
- else
- {
- // this is a partial block
- c = pixelprogress % PROGRESSPIXELS_PER_CHAR;
- }
- }
- else
- {
- // this is a full block
- c = 5;
- }
-
- // write character to display
- lcdDataWrite(c);
- }
-
-}
-
diff --git a/build/shared/lib/avrlib/lcd.h b/build/shared/lib/avrlib/lcd.h
deleted file mode 100755
index e78a82978..000000000
--- a/build/shared/lib/avrlib/lcd.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*! \file lcd.h \brief Character LCD driver for HD44780/SED1278 displays. */
-//*****************************************************************************
-//
-// File Name : 'lcd.h'
-// Title : Character LCD driver for HD44780/SED1278 displays
-// (usable in mem-mapped, or I/O mode)
-// Author : Pascal Stang
-// Created : 11/22/2000
-// Revised : 4/30/2002
-// Version : 1.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef LCD_H
-#define LCD_H
-
-#include "global.h"
-
-// include project-dependent configurations
-#include "lcdconf.h"
-
-// HD44780 LCD controller command set (do not modify these)
-// writing:
-#define LCD_CLR 0 // DB0: clear display
-#define LCD_HOME 1 // DB1: return to home position
-#define LCD_ENTRY_MODE 2 // DB2: set entry mode
-#define LCD_ENTRY_INC 1 // DB1: increment
-#define LCD_ENTRY_SHIFT 0 // DB2: shift
-#define LCD_ON_CTRL 3 // DB3: turn lcd/cursor on
-#define LCD_ON_DISPLAY 2 // DB2: turn display on
-#define LCD_ON_CURSOR 1 // DB1: turn cursor on
-#define LCD_ON_BLINK 0 // DB0: blinking cursor
-#define LCD_MOVE 4 // DB4: move cursor/display
-#define LCD_MOVE_DISP 3 // DB3: move display (0-> move cursor)
-#define LCD_MOVE_RIGHT 2 // DB2: move right (0-> left)
-#define LCD_FUNCTION 5 // DB5: function set
-#define LCD_FUNCTION_8BIT 4 // DB4: set 8BIT mode (0->4BIT mode)
-#define LCD_FUNCTION_2LINES 3 // DB3: two lines (0->one line)
-#define LCD_FUNCTION_10DOTS 2 // DB2: 5x10 font (0->5x7 font)
-#define LCD_CGRAM 6 // DB6: set CG RAM address
-#define LCD_DDRAM 7 // DB7: set DD RAM address
-// reading:
-#define LCD_BUSY 7 // DB7: LCD is busy
-
-// Default LCD setup
-// this default setup is loaded on LCD initialization
-#ifdef LCD_DATA_4BIT
- #define LCD_FDEF_1 (0< is a pointer to a ROM array containing custom characters
-// is the index of the character to load from lcdCustomCharArray
-// is the RAM location in the LCD (legal value: 0-7)
-void lcdLoadCustomChar(u08* lcdCustomCharArray, u08 romCharNum, u08 lcdCharNum);
-
-// prints a series of bytes/characters to the display
-void lcdPrintData(char* data, u08 nBytes);
-
-// displays a horizontal progress bar at the current cursor location
-//
-2/24/2003
-
- - Encoder Library
-
- - Improved interrupt flexibility and processor compatibility for this library
- - Unfortunately, the complexity comes at the cost of a somewhat more complicated
- encoderconf.h which the user must edit to suit their specific needs on a per-project basis.
-
-
- - I2C Library
-
- - Second major revision of I2C library in an attempt to make it general enough to use for
- any common I2C operations.
- - Changes include the "functionalizing" of basic low-level I2C operations
- such as generate start,stop, and send address/data.
- - NOTE: Structure of the library has changed somewhat and will likely continue to be refined.
-
-
- - Timer128 Library
-
- - Added missing PWM on and off functions in Timer128 library
-
-
-
-
-2/24/2003
-
- - Release Notes Started
-
-
-
-Written by Pascal Stang | Updated:
-
-
-
-
diff --git a/build/shared/lib/avrlib/rprintf.c b/build/shared/lib/avrlib/rprintf.c
deleted file mode 100755
index d1aec4db2..000000000
--- a/build/shared/lib/avrlib/rprintf.c
+++ /dev/null
@@ -1,773 +0,0 @@
-/*! \file rprintf.c \brief printf routine and associated routines. */
-//*****************************************************************************
-//
-// File Name : 'rprintf.c'
-// Title : printf routine and associated routines
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 2000.12.26
-// Revised : 2003.5.1
-// Version : 1.0
-// Target MCU : Atmel AVR series and other targets
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-//#include
-//#include
-#include
-#include "global.h"
-#include "rprintf.h"
-
-#ifndef TRUE
- #define TRUE -1
- #define FALSE 0
-#endif
-
-#define INF 32766 // maximum field size to print
-#define READMEMBYTE(a,char_ptr) ((a)?(pgm_read_byte(char_ptr)):(*char_ptr))
-
-#ifdef RPRINTF_COMPLEX
- static unsigned char buf[128];
-#endif
-
-// use this to store hex conversion in RAM
-//static char HexChars[] = "0123456789ABCDEF";
-// use this to store hex conversion in program memory
-//static prog_char HexChars[] = "0123456789ABCDEF";
-static char __attribute__ ((progmem)) HexChars[] = "0123456789ABCDEF";
-
-// function pointer to single character output routine
-static void (*rputchar)(unsigned char c);
-
-// *** rprintf initialization ***
-// you must call this function once and supply the character output
-// routine before using other functions in this library
-void rprintfInit(void (*putchar_func)(unsigned char c))
-{
- rputchar = putchar_func;
-}
-
-// *** rprintfChar ***
-// send a character/byte to the current output device
-inline void rprintfChar(unsigned char c)
-{
- // send character
- rputchar(c);
-}
-
-// *** rprintfStr ***
-// prints a null-terminated string stored in RAM
-void rprintfStr(char str[])
-{
- // send a string stored in RAM
- // check to make sure we have a good pointer
- if (!str) return;
-
- // print the string until a null-terminator
- while (*str)
- rprintfChar(*str++);
-}
-
-// *** rprintfStrLen ***
-// prints a section of a string stored in RAM
-// begins printing at position indicated by
-// prints number of characters indicated by
-void rprintfStrLen(char str[], unsigned int start, unsigned int len)
-{
- register int i=0;
-
- // check to make sure we have a good pointer
- if (!str) return;
- // spin through characters up to requested start
- // keep going as long as there's no null
- while((i++9)
-// Character+='A'-10;
-// else
-// Character+='0';
- rprintfChar(pgm_read_byte( HexChars+(data&0x0f) ));
-}
-
-// *** rprintfu08 ***
-// prints an unsigned 8-bit number in hex (2 digits)
-void rprintfu08(unsigned char data)
-{
- // print 8-bit hex value
- rprintfu04(data>>4);
- rprintfu04(data);
-}
-
-// *** rprintfu16 ***
-// prints an unsigned 16-bit number in hex (4 digits)
-void rprintfu16(unsigned short data)
-{
- // print 16-bit hex value
- rprintfu08(data>>8);
- rprintfu08(data);
-}
-
-// *** rprintfu32 ***
-// prints an unsigned 32-bit number in hex (8 digits)
-void rprintfu32(unsigned long data)
-{
- // print 32-bit hex value
- rprintfu16(data>>16);
- rprintfu16(data);
-}
-
-// *** rprintfNum ***
-// special printf for numbers only
-// see formatting information below
-// Print the number "n" in the given "base"
-// using exactly "numDigits"
-// print +/- if signed flag "isSigned" is TRUE
-// use the character specified in "padchar" to pad extra characters
-//
-// Examples:
-// uartPrintfNum(10, 6, TRUE, ' ', 1234); --> " +1234"
-// uartPrintfNum(10, 6, FALSE, '0', 1234); --> "001234"
-// uartPrintfNum(16, 6, FALSE, '.', 0x5AA5); --> "..5AA5"
-void rprintfNum(char base, char numDigits, char isSigned, char padchar, long n)
-{
- // define a global HexChars or use line below
- //static char HexChars[16] = "0123456789ABCDEF";
- char *p, buf[32];
- unsigned long x;
- unsigned char count;
-
- // prepare negative number
- if( isSigned && (n < 0) )
- {
- x = -n;
- }
- else
- {
- x = n;
- }
-
- // setup little string buffer
- count = (numDigits-1)-(isSigned?1:0);
- p = buf + sizeof (buf);
- *--p = '\0';
-
- // force calculation of first digit
- // (to prevent zero from not printing at all!!!)
- *--p = pgm_read_byte(HexChars + (x%base)); x /= base;
- // calculate remaining digits
- while(count--)
- {
- if(x != 0)
- {
- // calculate next digit
- *--p = pgm_read_byte(HexChars + (x%base)); x /= base;
- }
- else
- {
- // no more digits left, pad out to desired length
- *--p = padchar;
- }
- }
-
- // apply signed notation if requested
- if( isSigned )
- {
- if(n < 0)
- {
- *--p = '-';
- }
- else if(n > 0)
- {
- *--p = '+';
- }
- else
- {
- *--p = ' ';
- }
- }
-
- // print the string right-justified
- count = numDigits;
- while(count--)
- {
- rprintfChar(*p++);
- }
-}
-
-#ifdef RPRINTF_FLOAT
-// *** rprintfFloat ***
-// floating-point print
-void rprintfFloat(char numDigits, double x)
-{
- unsigned char firstplace = FALSE;
- unsigned char negative;
- unsigned char i, digit;
- double place = 1.0;
-
- // save sign
- negative = (x<0);
- // convert to absolute value
- x = (x>0)?(x):(-x);
-
- // find starting digit place
- for(i=0; i<15; i++)
- {
- if((x/place) < 10.0)
- break;
- else
- place *= 10.0;
- }
- // print polarity character
- if(negative)
- rprintfChar('-');
- else
- rprintfChar('+');
-
- // print digits
- for(i=0; i 1 && div_val > u_val) div_val /= 10;
- }
- do
- {
- rprintfChar(pgm_read_byte(HexChars+(u_val/div_val)));
- u_val %= div_val;
- div_val /= base;
- } while (div_val);
- }
- }
- va_end(ap);
-}
-#endif
-
-
-#ifdef RPRINTF_COMPLEX
-// *** rprintf2RamRom ***
-//! called by rprintf() - does a more powerful printf (supports %d, %u, %o, %x, %c, %s)
-// Supports:
-// %d - decimal
-// %u - unsigned decimal
-// %o - octal
-// %x - hex
-// %c - character
-// %s - strings
-// and the width,precision,padding modifiers
-// **this printf does not support floating point numbers
-int rprintf2RamRom(unsigned char stringInRom, const char *sfmt, ...)
-{
- register unsigned char *f, *bp;
- register long l;
- register unsigned long u;
- register int i;
- register int fmt;
- register unsigned char pad = ' ';
- int flush_left = 0, f_width = 0, prec = INF, hash = 0, do_long = 0;
- int sign = 0;
-
- va_list ap;
- va_start(ap, sfmt);
-
- f = (unsigned char *) sfmt;
-
- for (; READMEMBYTE(stringInRom,f); f++)
- {
- if (READMEMBYTE(stringInRom,f) != '%')
- { // not a format character
- // then just output the char
- rprintfChar(READMEMBYTE(stringInRom,f));
- }
- else
- {
- f++; // if we have a "%" then skip it
- if (READMEMBYTE(stringInRom,f) == '-')
- {
- flush_left = 1; // minus: flush left
- f++;
- }
- if (READMEMBYTE(stringInRom,f) == '0'
- || READMEMBYTE(stringInRom,f) == '.')
- {
- // padding with 0 rather than blank
- pad = '0';
- f++;
- }
- if (READMEMBYTE(stringInRom,f) == '*')
- { // field width
- f_width = va_arg(ap, int);
- f++;
- }
- else if (Isdigit(READMEMBYTE(stringInRom,f)))
- {
- f_width = atoiRamRom(stringInRom, (char *) f);
- while (Isdigit(READMEMBYTE(stringInRom,f)))
- f++; // skip the digits
- }
- if (READMEMBYTE(stringInRom,f) == '.')
- { // precision
- f++;
- if (READMEMBYTE(stringInRom,f) == '*')
- {
- prec = va_arg(ap, int);
- f++;
- }
- else if (Isdigit(READMEMBYTE(stringInRom,f)))
- {
- prec = atoiRamRom(stringInRom, (char *) f);
- while (Isdigit(READMEMBYTE(stringInRom,f)))
- f++; // skip the digits
- }
- }
- if (READMEMBYTE(stringInRom,f) == '#')
- { // alternate form
- hash = 1;
- f++;
- }
- if (READMEMBYTE(stringInRom,f) == 'l')
- { // long format
- do_long = 1;
- f++;
- }
-
- fmt = READMEMBYTE(stringInRom,f);
- bp = buf;
- switch (fmt) { // do the formatting
- case 'd': // 'd' signed decimal
- if (do_long)
- l = va_arg(ap, long);
- else
- l = (long) (va_arg(ap, int));
- if (l < 0)
- {
- sign = 1;
- l = -l;
- }
- do {
- *bp++ = l % 10 + '0';
- } while ((l /= 10) > 0);
- if (sign)
- *bp++ = '-';
- f_width = f_width - (bp - buf);
- if (!flush_left)
- while (f_width-- > 0)
- rprintfChar(pad);
- for (bp--; bp >= buf; bp--)
- rprintfChar(*bp);
- if (flush_left)
- while (f_width-- > 0)
- rprintfChar(' ');
- break;
- case 'o': // 'o' octal number
- case 'x': // 'x' hex number
- case 'u': // 'u' unsigned decimal
- if (do_long)
- u = va_arg(ap, unsigned long);
- else
- u = (unsigned long) (va_arg(ap, unsigned));
- if (fmt == 'u')
- { // unsigned decimal
- do {
- *bp++ = u % 10 + '0';
- } while ((u /= 10) > 0);
- }
- else if (fmt == 'o')
- { // octal
- do {
- *bp++ = u % 8 + '0';
- } while ((u /= 8) > 0);
- if (hash)
- *bp++ = '0';
- }
- else if (fmt == 'x')
- { // hex
- do {
- i = u % 16;
- if (i < 10)
- *bp++ = i + '0';
- else
- *bp++ = i - 10 + 'a';
- } while ((u /= 16) > 0);
- if (hash)
- {
- *bp++ = 'x';
- *bp++ = '0';
- }
- }
- i = f_width - (bp - buf);
- if (!flush_left)
- while (i-- > 0)
- rprintfChar(pad);
- for (bp--; bp >= buf; bp--)
- rprintfChar((int) (*bp));
- if (flush_left)
- while (i-- > 0)
- rprintfChar(' ');
- break;
- case 'c': // 'c' character
- i = va_arg(ap, int);
- rprintfChar((int) (i));
- break;
- case 's': // 's' string
- bp = va_arg(ap, unsigned char *);
- if (!bp)
- bp = (unsigned char *) "(nil)";
- f_width = f_width - strlen((char *) bp);
- if (!flush_left)
- while (f_width-- > 0)
- rprintfChar(pad);
- for (i = 0; *bp && i < prec; i++)
- {
- rprintfChar(*bp);
- bp++;
- }
- if (flush_left)
- while (f_width-- > 0)
- rprintfChar(' ');
- break;
- case '%': // '%' character
- rprintfChar('%');
- break;
- }
- flush_left = 0, f_width = 0, prec = INF, hash = 0, do_long = 0;
- sign = 0;
- pad = ' ';
- }
- }
-
- va_end(ap);
- return 0;
-}
-
-unsigned char Isdigit(char c)
-{
- if((c >= 0x30) && (c <= 0x39))
- return TRUE;
- else
- return FALSE;
-}
-
-int atoiRamRom(unsigned char stringInRom, char *str)
-{
- int num = 0;;
-
- while(Isdigit(READMEMBYTE(stringInRom,str)))
- {
- num *= 10;
- num += ((READMEMBYTE(stringInRom,str++)) - 0x30);
- }
- return num;
-}
-
-#endif
-
-//******************************************************************************
-// code below this line is commented out and can be ignored
-//******************************************************************************
-/*
-char* sprintf(const char *sfmt, ...)
-{
- register unsigned char *f, *bp, *str;
- register long l;
- register unsigned long u;
- register int i;
- register int fmt;
- register unsigned char pad = ' ';
- int flush_left = 0, f_width = 0, prec = INF, hash = 0, do_long = 0;
- int sign = 0;
-
- va_list ap;
- va_start(ap, sfmt);
-
- str = bufstring;
- f = (unsigned char *) sfmt;
-
- for (; *f; f++)
- {
- if (*f != '%')
- { // not a format character
- *str++ = (*f); // then just output the char
- }
- else
- {
- f++; // if we have a "%" then skip it
- if (*f == '-')
- {
- flush_left = 1; // minus: flush left
- f++;
- }
- if (*f == '0' || *f == '.')
- {
- // padding with 0 rather than blank
- pad = '0';
- f++;
- }
- if (*f == '*')
- { // field width
- f_width = va_arg(ap, int);
- f++;
- }
- else if (Isdigit(*f))
- {
- f_width = atoi((char *) f);
- while (Isdigit(*f))
- f++; // skip the digits
- }
- if (*f == '.')
- { // precision
- f++;
- if (*f == '*')
- {
- prec = va_arg(ap, int);
- f++;
- }
- else if (Isdigit(*f))
- {
- prec = atoi((char *) f);
- while (Isdigit(*f))
- f++; // skip the digits
- }
- }
- if (*f == '#')
- { // alternate form
- hash = 1;
- f++;
- }
- if (*f == 'l')
- { // long format
- do_long = 1;
- f++;
- }
-
- fmt = *f;
- bp = buf;
- switch (fmt) { // do the formatting
- case 'd': // 'd' signed decimal
- if (do_long)
- l = va_arg(ap, long);
- else
- l = (long) (va_arg(ap, int));
- if (l < 0)
- {
- sign = 1;
- l = -l;
- }
- do {
- *bp++ = l % 10 + '0';
- } while ((l /= 10) > 0);
- if (sign)
- *bp++ = '-';
- f_width = f_width - (bp - buf);
- if (!flush_left)
- while (f_width-- > 0)
- *str++ = (pad);
- for (bp--; bp >= buf; bp--)
- *str++ = (*bp);
- if (flush_left)
- while (f_width-- > 0)
- *str++ = (' ');
- break;
- case 'o': // 'o' octal number
- case 'x': // 'x' hex number
- case 'u': // 'u' unsigned decimal
- if (do_long)
- u = va_arg(ap, unsigned long);
- else
- u = (unsigned long) (va_arg(ap, unsigned));
- if (fmt == 'u')
- { // unsigned decimal
- do {
- *bp++ = u % 10 + '0';
- } while ((u /= 10) > 0);
- }
- else if (fmt == 'o')
- { // octal
- do {
- *bp++ = u % 8 + '0';
- } while ((u /= 8) > 0);
- if (hash)
- *bp++ = '0';
- }
- else if (fmt == 'x')
- { // hex
- do {
- i = u % 16;
- if (i < 10)
- *bp++ = i + '0';
- else
- *bp++ = i - 10 + 'a';
- } while ((u /= 16) > 0);
- if (hash)
- {
- *bp++ = 'x';
- *bp++ = '0';
- }
- }
- i = f_width - (bp - buf);
- if (!flush_left)
- while (i-- > 0)
- *str++ = (pad);
- for (bp--; bp >= buf; bp--)
- *str++ = ((int) (*bp));
- if (flush_left)
- while (i-- > 0)
- *str++ = (' ');
- break;
- case 'c': // 'c' character
- i = va_arg(ap, int);
- *str++ = ((int) (i));
- break;
- case 's': // 's' string
- bp = va_arg(ap, unsigned char *);
- if (!bp)
- bp = (unsigned char *) "(nil)";
- f_width = f_width - strlen((char *) bp);
- if (!flush_left)
- while (f_width-- > 0)
- *str++ = (pad);
- for (i = 0; *bp && i < prec; i++)
- {
- *str++ = (*bp);
- bp++;
- }
- if (flush_left)
- while (f_width-- > 0)
- *str++ = (' ');
- break;
- case '%': // '%' character
- *str++ = ('%');
- break;
- }
- flush_left = 0, f_width = 0, prec = INF, hash = 0, do_long = 0;
- sign = 0;
- pad = ' ';
- }
- }
-
- va_end(ap);
- // terminate string with null
- *str++ = '\0';
- return bufstring;
-}
-
-*/
diff --git a/build/shared/lib/avrlib/rprintf.h b/build/shared/lib/avrlib/rprintf.h
deleted file mode 100755
index 63af4ea6b..000000000
--- a/build/shared/lib/avrlib/rprintf.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*! \file rprintf.h \brief printf routine and associated routines. */
-//****************************************************************************
-//
-// File Name : 'rprintf.h'
-// Title : printf routine and associated routines
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 2000.12.26
-// Revised : 2003.5.1
-// Version : 1.0
-// Target MCU : Atmel AVR series and other targets
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//****************************************************************************
-
-#ifndef RPRINTF_H
-#define RPRINTF_H
-
-// needed for use of PSTR below
-#include
-
-// configuration
-// defining RPRINTF_SIMPLE will compile a smaller, simpler, and faster printf() function
-// defining RPRINTF_COMPLEX will compile a larger, more capable, and slower printf() function
-#ifndef RPRINTF_COMPLEX
- #define RPRINTF_SIMPLE
-#endif
-
-// Define RPRINTF_FLOAT to enable the floating-point printf function: rprintfFloat()
-// (adds +4600bytes or 2.2Kwords of code)
-
-// defines/constants
-#define STRING_IN_RAM 0
-#define STRING_IN_ROM 1
-
-// make a putchar for those that are used to using it
-//#define putchar(c) rprintfChar(c);
-
-// functions
-
-//! initializes the rprintf library for an output stream
-// you must call this initializer once before using any other rprintf function
-// the argument must be a single-character stream output function
-void rprintfInit(void (*putchar_func)(unsigned char c));
-
-//! prints a single character to the current output device
-void rprintfChar(unsigned char c);
-
-//! prints a null-terminated string stored in RAM
-void rprintfStr(char str[]);
-
-//! prints a section of a string stored in RAM
-// begins printing at position indicated by
-// prints number of characters indicated by
-void rprintfStrLen(char str[], unsigned int start, unsigned int len);
-
-//! prints a string stored in program rom
-// NOTE: this function does not actually store your string in
-// program rom, but merely reads it assuming you stored it properly.
-void rprintfProgStr(const prog_char str[]);
-// Using the function rprintfProgStrM(...) automatically causes
-// your string to be stored in ROM, thereby not wasting precious RAM
-// Example usage:
-// rprintfProgStrM("Hello, this string is stored in program rom");
-#define rprintfProgStrM(string) (rprintfProgStr(PSTR(string)))
-
-//! prints a carriage return and line feed
-// useful when printing to serial ports/terminals
-void rprintfCRLF(void);
-
-// prints the number contained in "data" in hex format
-// u04,u08,u16,and u32 functions handle 4,8,16,or 32 bits respectively
-void rprintfu04(unsigned char data); ///< print 4-bit hex number
-void rprintfu08(unsigned char data); ///< print 8-bit hex number
-void rprintfu16(unsigned short data); ///< print 16-bit hex number
-void rprintfu32(unsigned long data); ///< print 32-bit hex number
-
-//! a flexible integer number printing routine
-void rprintfNum(char base, char numDigits, char isSigned, char padchar, long n);
-
-#ifdef RPRINTF_FLOAT
- //! floating-point print routine
- void rprintfFloat(char numDigits, double x);
-#endif
-
-// NOTE: Below you'll see the function prototypes of rprintf1RamRom and
-// rprintf2RamRom. rprintf1RamRom and rprintf2RamRom are both reduced versions
-// of the regular C printf() command. However, they are modified to be able
-// to read their text/format strings from RAM or ROM in the Atmel microprocessors.
-// Unless you really intend to, do not use the "RamRom" versions of the functions
-// directly. Instead use the #defined function versions:
-//
-// printfx("text/format",args) ...to keep your text/format string stored in RAM
-// - or -
-// printfxROM("text/format",args) ...to keep your text/format string stored in ROM
-//
-// where x is either 1 or 2 for the simple or more powerful version of printf()
-//
-// Since there is much more ROM than RAM available in the Atmel microprocessors,
-// and nearly all text/format strings are constant (never change in the course
-// of the program), you should try to use the ROM printf version exclusively.
-// This will ensure you leave as much RAM as possible for program variables and
-// data.
-
-#ifdef RPRINTF_SIMPLE
- // a simple printf routine
- int rprintf1RamRom(unsigned char stringInRom, const char *format, ...);
- // #defines for RAM or ROM operation
- #define rprintf1(format, args...) rprintf1RamRom(STRING_IN_ROM, PSTR(format), ## args)
- #define rprintf1RAM(format, args...) rprintf1RamRom(STRING_IN_RAM, format, ## args)
-
- // *** Default rprintf(...) ***
- // this next line determines what the the basic rprintf() defaults to:
- #define rprintf(format, args...) rprintf1RamRom(STRING_IN_ROM, PSTR(format), ## args)
-#endif
-
-#ifdef RPRINTF_COMPLEX
- // a more powerful printf routine
- int rprintf2RamRom(unsigned char stringInRom, const char *sfmt, ...);
- // #defines for RAM or ROM operation
- #define rprintf2(format, args...) rprintf2RamRom(STRING_IN_ROM, format, ## args)
- #define rprintf2RAM(format, args...) rprintf2RamRom(STRING_IN_RAM, format, ## args)
-
- // *** Default rprintf(...) ***
- // this next line determines what the the basic rprintf() defaults to:
- #define rprintf(format, args...) rprintf2RamRom(STRING_IN_ROM, PSTR(format), ## args)
-#endif
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/avrcore.c b/build/shared/lib/avrlib/rsl/avrcore.c
deleted file mode 100755
index 00d01837b..000000000
--- a/build/shared/lib/avrlib/rsl/avrcore.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*! \file avrcore.c \brief AVR-Core Board Driver Functions. */
-//*****************************************************************************
-//
-// File Name : 'avrcore.c'
-// Title : AVR-Core Board Driver Functions
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.10.1
-// Revised : 2004.10.1
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-//----- Include Files ---------------------------------------------------------
-#include // include I/O definitions (port names, pin names, etc)
-#include // include "signal" names (interrupt names)
-#include // include interrupt support
-
-#include "global.h" // include our global settings
-#include "avrcore.h"
-
-// globals
-u08 AvrcoreLatch;
-
-// functions
-void avrcoreInit(void)
-{
- // initialize ports to input with pullup
- // (this is done to avoid contentions and input-pin oscillation)
- outb(DDRA, 0x00);
- outb(DDRB, 0x00);
- outb(DDRC, 0x00);
- outb(DDRD, 0x00);
- outb(DDRE, 0x00);
- outb(DDRF, 0x00);
- outb(PORTA, 0xFF);
- outb(PORTB, 0xFF);
- outb(PORTC, 0xFF);
- outb(PORTD, 0xFF);
- outb(PORTE, 0xFF);
- outb(PORTF, 0xFF);
- // turn on RAM interface
- sbi(MCUCR, SRE);
- // initialize RAM page
- avrcoreSetRamPage(0);
- // initialize LEDs
- avrcoreSetLeds(0);
- // set serial power to on by default
- avrcoreSetSerialPortPower(1);
-}
-
-void avrcoreSetRamPage(u08 page)
-{
- // update latch state
- AvrcoreLatch &= ~AVRCORELATCH_ADDRMASK;
- AvrcoreLatch |= page & AVRCORELATCH_ADDRMASK;
- // write new latch state to latch
- AVRCORELATCH = AvrcoreLatch;
-}
-
-void avrcoreSetLeds(u08 leds)
-{
- // NOTE: LEDs are negative-logic (active-low)
- // update latch state
- AvrcoreLatch |= AVRCORELATCH_LEDMASK;
- AvrcoreLatch &= ~(leds<<4);
- // write new latch state to latch
- AVRCORELATCH = AvrcoreLatch;
-}
-
-void avrcoreSetLedsOn(u08 leds)
-{
- // NOTE: LEDs are negative-logic (active-low)
- // update latch state to turn on inidicated leds
- AvrcoreLatch &= ~(leds<<4);
- // write new latch state to latch
- AVRCORELATCH = AvrcoreLatch;
-}
-
-void avrcoreSetLedsOff(u08 leds)
-{
- // NOTE: LEDs are negative-logic (active-low)
- // update latch state to turn off inidicated leds
- AvrcoreLatch |= (leds<<4);
- // write new latch state to latch
- AVRCORELATCH = AvrcoreLatch;
-}
-
-void avrcoreSetSerialPortPower(u08 on)
-{
- // this function simply manipulates LED3/power control
- if(on)
- AvrcoreLatch &= ~(0x80);
- else
- AvrcoreLatch |= (0x80);
- // write new latch state to latch
- AVRCORELATCH = AvrcoreLatch;
-}
diff --git a/build/shared/lib/avrlib/rsl/avrcore.h b/build/shared/lib/avrlib/rsl/avrcore.h
deleted file mode 100755
index bae278f18..000000000
--- a/build/shared/lib/avrlib/rsl/avrcore.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*! \file avrcore.h \brief AVR-Core Board Driver Functions. */
-//*****************************************************************************
-//
-// File Name : 'avrcore.h'
-// Title : AVR-Core Board Driver Functions
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.10.1
-// Revised : 2004.10.1
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef AVRCORE_H
-#define AVRCORE_H
-
-// defines and typedefs
-#define AVRCORELATCH (*((unsigned char*)0x4000))
-#define AVRCORELATCH_ADDRMASK 0x0F
-#define AVRCORELATCH_LEDMASK 0xF0
-
-// functions
-
-//! Initialize AVRCore hardware
-void avrcoreInit(void);
-
-//! Set the current external RAM page
-// The AVRCore on-board external RAM is typically 512KBytes.
-// The RAM is memory-mapped into the 32KByte address space from
-// 0x8000-0xFFFF, and must therefore be accessed in pages (32KB chunks).
-// Use this function to select which of the 16 (0-15) 32KByte pages
-// you wish to access.
-void avrcoreSetRamPage(u08 page);
-
-//! Set the state of the four LEDs on AVRCore
-// leds bit0 => LED1 (0=off, 1=on)
-// leds bit1 => LED2 (0=off, 1=on)
-// leds bit2 => LED3 (0=off, 1=on)
-// leds bit3 => LED4 (0=off, 1=on)
-void avrcoreSetLeds(u08 leds);
-
-//! Turn on selected LEDs
-// '0' bit = no change
-// '1' bit = turn on
-void avrcoreSetLedsOn(u08 leds);
-
-//! Turn off selected LEDs
-// '0' bit = no change
-// '1' bit = turn off
-void avrcoreSetLedsOff(u08 leds);
-
-//! Set on/off power setting of AVRCore serial port
-// (0=off, 1=on)
-void avrcoreSetSerialPortPower(u08 on);
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/edp.c b/build/shared/lib/avrlib/rsl/edp.c
deleted file mode 100755
index 410108e9e..000000000
--- a/build/shared/lib/avrlib/rsl/edp.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/*! \file edp.c \brief Emerald Data Protocol System. */
-//*****************************************************************************
-//
-// File Name : 'edp.c'
-// Title : Emerald Data Protocol System
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.07.01
-// Revised : 2003.07.21
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-//----- Include Files ---------------------------------------------------------
-#include // include I/O definitions (port names, pin names, etc)
-#include // include "signal" names (interrupt names)
-#include // include interrupt support
-#include // include program-space support
-
-#include "global.h" // include our global settings
-#include "i2c.h" // include I2C support
-#include "rprintf.h" // include printf function library
-
-#include "edp.h"
-
-// globals
-// EDP master/command: response code and reply buffer
-u08 EdpCommandResponseCode;
-//u08 EdpCommandReplyLength;
-u08 EdpCommandReplyBuffer[EDP_REPLY_BUFFER_SIZE];
-u08 EdpCommandReplyChecksum;
-// EDP slave: response code and reply buffer
-u08 EdpSlaveResponseCode;
-u08 EdpSlaveReplyLength;
-u08 EdpSlaveReplyBuffer[EDP_REPLY_BUFFER_SIZE];
-// EDP slave request handler function pointer
-EdpSlaveHandlerFuncType edpSlaveHandlerFunc;
-
-// functions
-void edpInit(void)
-{
- // initialize i2c interface and function library
- i2cInit();
- // set i2c bit rate to 30KHz
- i2cSetBitrate(30);
- // set the Slave Receive Handler function
- // (this function will run whenever a master somewhere else on the bus
- // writes data to us as a slave)
- i2cSetSlaveReceiveHandler( edpSlaveReceiveService );
- // set the Slave Transmit Handler function
- // (this function will run whenever a master somewhere else on the bus
- // attempts to read data from us as a slave)
- i2cSetSlaveTransmitHandler( edpSlaveTransmitService );
-}
-
-void edpSetSlaveHandler(EdpSlaveHandlerFuncType edpSlaveHandlerFunction)
-{
- edpSlaveHandlerFunc = edpSlaveHandlerFunction;
-}
-
-// ************ EDP Master operations ************
-u08 edpSendCommand(u08 deviceAddr, u08 cmdLength, EdpCommand* edpCommand)
-{
- EdpReply* edpCommandReply = (EdpReply*)EdpCommandReplyBuffer;
- u08* sendData;
- u08* replyData;
- u08 replyLength;
- u08 checksum;
-
- // initialize response variables
- edpCommandReply->Length = 0;
- EdpCommandReplyChecksum = 0;
-
- #ifdef EDP_DEBUG
- rprintf("\r\nBegin EdpSendCommand, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // disable TWI interrupt
- cbi(TWCR, TWIE);
-
- // clear TWI interface
- //outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK));
-
- // send start condition
- i2cSendStart();
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Start, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // send device address with write
- i2cSendByte( (deviceAddr&0xFE) );
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Device Address+Write, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // check if device is present and live
- if( i2cGetStatus() != TW_MT_SLA_ACK)
- {
- // device did not ACK it's address, command will not continue
- // transmit stop condition
- // leave with TWEA on for slave receiving
- i2cSendStop();
- while( !(inb(TWCR) & BV(TWSTO)) );
- #ifdef EDP_DEBUG
- rprintf("No Device!, Sent Stop, TWSR:0x%x\r\n",inb(TWSR));
- #endif
- // enable TWI interrupt
- sbi(TWCR, TWIE);
- // return error
- return EDP_COMMAND_NODEV;
- }
-
- // send data
- sendData = (u08*)edpCommand;
- checksum = 0;
- while(cmdLength)
- {
- i2cSendByte( *sendData );
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Data, TWSR:0x%x\r\n",inb(TWSR));
- #endif
- checksum += *sendData++;
- cmdLength--;
- }
-
- // send the checksum
- i2cSendByte( ~checksum );
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Checksum, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // send repeated start condition
- i2cSendStart();
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Repeated Start, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // send device address with read
- i2cSendByte( deviceAddr|0x01 );
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Device Address+Read, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // read response code, return NACK
- i2cReceiveByte(FALSE);
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Read Data, TWSR:0x%x\r\n",inb(TWSR));
- #endif
- EdpCommandResponseCode = i2cGetReceivedByte();
-
- if(EdpCommandResponseCode==EDP_RESP_DATA_REPLY)
- {
- // a data reply is being sent
-
- // send repeated start condition
- i2cSendStart();
- i2cWaitForComplete();
-
- // send device address with read
- i2cSendByte( deviceAddr|0x01 );
- i2cWaitForComplete();
-
- // get length, return ACK
- i2cReceiveByte(TRUE);
- i2cWaitForComplete();
- edpCommandReply->Length = i2cGetReceivedByte();
- // set temp variables
- replyLength = edpCommandReply->Length;
- replyData = edpCommandReply->Data;
-
- // get data, return ACKs
- // preset checksum with the datalength byte
- checksum = replyLength;
- while(replyLength > 1)
- {
- i2cReceiveByte(TRUE); // receive data byte and return ACK
- i2cWaitForComplete();
- *replyData = i2cGetReceivedByte();
- checksum += *replyData++;
- replyLength--;
- }
-
- // get last data (actually the checksum), return NACK (last-byte signal)
- i2cReceiveByte(FALSE);
- i2cWaitForComplete();
- *replyData = i2cGetReceivedByte();
- // add received checksum+1 to our checksum, the result should be zero
- checksum += (*replyData) + 1;
- // save the reply checksum
- EdpCommandReplyChecksum = checksum;
- }
-
- // transmit stop condition
- // leave with TWEA on for slave receiving
- i2cSendStop();
- while( !(inb(TWCR) & BV(TWSTO)) );
- #ifdef EDP_DEBUG
- rprintf("Sent Stop, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // enable TWI interrupt
- sbi(TWCR, TWIE);
-
- return EDP_COMMAND_OK;
-}
-
-// get the response code and reply from last command
-u08 edpGetCommandReply(u08* responseCode, EdpReply** edpReply)
-{
- u08 retval=EDP_REPLY_OK;
-
- // get the response code from last command
- *responseCode = EdpCommandResponseCode;
- // get the reply from last command
- *edpReply = (EdpReply*)EdpCommandReplyBuffer;
-
- // check response code
- if(EdpCommandResponseCode == EDP_RESP_DATA_REPLY)
- {
- // there was a reply, check the checksum
- // if it's non-zero, data corruption is present
- if(EdpCommandReplyChecksum)
- retval = EDP_REPLY_BADCHKSUM;
- }
- return retval;
-}
-
-/*
-u08 edpSendCommand(u08 deviceAddr, u08 sendLength, u08* sendData)
-{
- u08* replyData = EdpCommandReplyBuffer;
- u08 replyLength;
- u08 checksum;
-
- // initialize response variables
- EdpCommandReplyLength = 0;
- EdpCommandReplyChecksum = 0;
-
- #ifdef EDP_DEBUG
- rprintf("\r\nBegin EdpSendCommand, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // disable TWI interrupt
- cbi(TWCR, TWIE);
-
- // clear TWI interface
- //outb(TWCR, (inb(TWCR)&TWCR_CMD_MASK));
-
- // send start condition
- i2cSendStart();
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Start, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // send device address with write
- i2cSendByte( (deviceAddr&0xFE) );
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Device Address+Write, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // check if device is present and live
- if( i2cGetStatus() != TW_MT_SLA_ACK)
- {
- // device did not ACK it's address, command will not continue
- // transmit stop condition
- // leave with TWEA on for slave receiving
- i2cSendStop();
- while( !(inb(TWCR) & BV(TWSTO)) );
- #ifdef EDP_DEBUG
- rprintf("No Device!, Sent Stop, TWSR:0x%x\r\n",inb(TWSR));
- #endif
- // enable TWI interrupt
- sbi(TWCR, TWIE);
- // return error
- return EDP_COMMAND_NODEV;
- }
-
- // send data
- checksum = 0;
- while(sendLength)
- {
- i2cSendByte( *sendData );
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Data, TWSR:0x%x\r\n",inb(TWSR));
- #endif
- checksum += *sendData++;
- sendLength--;
- }
-
- // send the checksum
- i2cSendByte( ~checksum );
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Checksum, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // send repeated start condition
- i2cSendStart();
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Repeated Start, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // send device address with read
- i2cSendByte( deviceAddr|0x01 );
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Sent Device Address+Read, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // read response code, return NACK
- i2cReceiveByte(FALSE);
- i2cWaitForComplete();
- #ifdef EDP_DEBUG
- rprintf("Read Data, TWSR:0x%x\r\n",inb(TWSR));
- #endif
- EdpCommandResponseCode = i2cGetReceivedByte();
-
- if(EdpCommandResponseCode==EDP_RESP_DATA_REPLY)
- {
- // a data reply is being sent
-
- // send repeated start condition
- i2cSendStart();
- i2cWaitForComplete();
-
- // send device address with read
- i2cSendByte( deviceAddr|0x01 );
- i2cWaitForComplete();
-
- // get length, return ACK
- i2cReceiveByte(TRUE);
- i2cWaitForComplete();
- replyLength = i2cGetReceivedByte();
- EdpCommandReplyLength = replyLength;
-
- // get data, return ACKs
- // preset checksum with the datalength byte
- checksum = replyLength;
- while(replyLength > 1)
- {
- i2cReceiveByte(TRUE); // receive data byte and return ACK
- i2cWaitForComplete();
- *replyData = i2cGetReceivedByte();
- checksum += *replyData++;
- replyLength--;
- }
-
- // get last data (actually the checksum), return NACK (last-byte signal)
- i2cReceiveByte(FALSE);
- i2cWaitForComplete();
- *replyData = i2cGetReceivedByte();
- // add received checksum+1 to our checksum, the result should be zero
- checksum += (*replyData) + 1;
- // save the reply checksum
- EdpCommandReplyChecksum = checksum;
- }
-
- // transmit stop condition
- // leave with TWEA on for slave receiving
- i2cSendStop();
- while( !(inb(TWCR) & BV(TWSTO)) );
- #ifdef EDP_DEBUG
- rprintf("Sent Stop, TWSR:0x%x\r\n",inb(TWSR));
- #endif
-
- // enable TWI interrupt
- sbi(TWCR, TWIE);
-
- return EDP_COMMAND_OK;
-}
-
-u08 edpGetCommandReply(u08* responseCode, u08* replyLength, u08** replyData)
-{
- u08 retval=EDP_REPLY_OK;
-
- // get the response code and reply data from last command
- *responseCode = EdpCommandResponseCode;
- // get the reply length from last command
- *replyLength = EdpCommandReplyLength;
- // get the reply data from last command
- *replyData = EdpCommandReplyBuffer;
-
- // check response code
- if(EdpCommandResponseCode == EDP_RESP_DATA_REPLY)
- {
- // there was a reply, check the checksum
- // if it's non-zero, data corruption is present
- if(EdpCommandReplyChecksum)
- retval = EDP_REPLY_BADCHKSUM;
- }
- return retval;
-}
-*/
-
-// ************ EDP Slave operations ************
-
-// this function will run when a master somewhere else on the bus
-// addresses us and wishes to write data to us
-void edpSlaveReceiveService(u08 receiveDataLength, u08* receiveData)
-{
- u08 i,checksum;
-
- // initialize the reply length from this command
- EdpSlaveReplyLength = 0;
- // verify the checksum
- // initialize the checksum with 1
- checksum = 0x01;
- // sum all the data in the packet and the data's checksum
- for(i=0; iLength+1;
- // initialize checksum
- checksum = edpReply->Length+1;
- // copy reply buffer to the transmit buffer
- for(i=0; iLength; i++)
- {
- *transmitData++ = edpReply->Data[i];
- checksum += edpReply->Data[i];
- }
- // copy checksum to transmit buffer
- *transmitData++ = ~checksum;
- // set number of bytes to transmit
- transmitDataLength = edpReply->Length+2;
- }
-
- // return number of bytes written to transmit buffer
- return transmitDataLength;
-}
diff --git a/build/shared/lib/avrlib/rsl/edp.h b/build/shared/lib/avrlib/rsl/edp.h
deleted file mode 100755
index cd209fe19..000000000
--- a/build/shared/lib/avrlib/rsl/edp.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*! \file edp.h \brief Emerald Data Protocol System. */
-//*****************************************************************************
-//
-// File Name : 'edp.h'
-// Title : Emerald Data Protocol System
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.07.01
-// Revised : 2003.07.21
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef EDP_H
-#define EDP_H
-
-#include "edpdefs.h"
-
-// defines
-//#define EDP_DEBUG
-// edp reply buffer size
-#ifndef EDP_REPLY_BUFFER_SIZE
-#define EDP_REPLY_BUFFER_SIZE 128
-#endif
-// edpSendCommand return values
-#define EDP_COMMAND_OK 0
-#define EDP_COMMAND_NODEV 1
-// edpGetCommandReply return values
-#define EDP_REPLY_OK 0
-#define EDP_REPLY_BADCHKSUM 1
-
-// structs and typedefs
-typedef struct
-{
- u08 SrcAddr;
- u08 Command;
- u08 Data[];
-} EdpCommand;
-
-typedef struct
-{
- u08 Length;
- u08 Data[];
-} EdpReply;
-
-// typedefs
-typedef u08 (*EdpSlaveHandlerFuncType)(u08 edpCmdLength, EdpCommand* edpCmd,
- u08 edpReplyLengthMax, EdpReply* edpReply);
-
-// functions
-void edpInit(void);
-void edpSetSlaveHandler(EdpSlaveHandlerFuncType edpSlaveHandlerFunction);
-
-// ************ EDP Master operations ************
-u08 edpSendCommand(u08 deviceAddr, u08 cmdLength, EdpCommand* edpCommand);
-u08 edpGetCommandReply(u08* responseCode, EdpReply** edpReply);
-//u08 edpSendCommand(u08 deviceAddr, u08 sendLength, u08* sendData);
-//u08 edpGetCommandReply(u08* responseCode, u08* replyLength, u08** replyData);
-
-// ************ EDP Slave operations ************
-void edpSlaveReceiveService(u08 receiveDataLength, u08* receiveData);
-u08 edpSlaveTransmitService(u08 transmitDataLengthMax, u08* transmitData);
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/edpaddr.h b/build/shared/lib/avrlib/rsl/edpaddr.h
deleted file mode 100755
index 2951456f4..000000000
--- a/build/shared/lib/avrlib/rsl/edpaddr.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*! \file edpaddr.h \brief Emerald Satellite EDP/I2C Bus Addresses. */
-//*****************************************************************************
-//
-// File Name : 'edpaddr.h'
-// Title : Emerald Satellite EDP/I2C Bus Addresses
-// Author : Bryan Palmintier & Pascal Stang - Copyright (C) 2003
-// Created : 09/08/2003 by PS
-// Revised : 11/10/2003 by BP
-// Version : 0.9
-// Target MCU : Any
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef EDPADDR_H
-#define EDPADDR_H
-
-// The 8 bits of an EDP address byte breakdown as follows:
-// b0: R/W bit (1=read, 0=write)
-// b1-4: subsystem address (16 availible)
-// b5-7: satellite network mask (up to 7 unique networks with 1 reserved by I2C)
-// The ground station is a special case which uses 1110xxxx
-#define EDPNET_MASK 0xE0 // mask for satellite/ground networks
-#define EDPADDR_MASK 0x1E // mask for subsystem addresses
-
-// Satellite network addresses
-#define EDPNET_SAT_A 0x00 // EM-1
-#define EDPNET_SAT_B 0x20 // EM-2
-#define EDPNET_SAT_C 0x40 // EM-3
-#define EDPNET_SAT_D 0x60 // EM-4
-#define EDPNET_SAT_E 0x80 // OK-1
-#define EDPNET_SAT_F 0xA0 // OK-2
-#define EDPNET_SAT_G 0xC0
-
-// Ground Station network address
-// NOTE: all devices on this network must maintain b4=0
-// or risk problems with 10bit I2C addressing
-#define EDPNET_GROUND 0xE0
-
-// Test subsystem address
-// Note: it is OK to use these susbsystem addresses with the EDPADDR_GROUND mask
-#define EDPADDR_TEST 0x02 // generic test address (LEDs etc)
-#define EDPADDR_GROUND 0x04 // address for ground testing
-
-// Subsystem addresses
-// "Core" subsystems, those found on all satellites, DO NOT EDIT
-// Note: it is OK to use these subsystem addresses with the EDPADDR_GROUND mask
-#define EDPADDR_COMM 0x06
-#define EDPADDR_DALMAST 0x08
-#define EDPADDR_SCHED 0x0A
-#define EDPADDR_EXPSYS 0x0C
-#define EDPADDR_ISCOMM 0x0E
-
-// "Common" subsystems, those found on many satellites, DO NOT EDIT
-// Note: it is NOT OK to use these subsystem addresses with the EDPADDR_GROUND mask
-#define EDPADDR_GPS 0x10
-#define EDPADDR_TORQUER 0x12
-#define EDPADDR_MECH 0x14
-
-// Mission Specific subsystems, EDIT AS NEEDED
-// Note: it is NOT OK to use these subsystem addresses with the EDPADDR_GROUND mask
-#define EDPADDR_ODDSS 0x16
-#define EDPADDR_ULTRAWB 0x18
-#define EDPADDR_TETHER 0x1A
-
-
-// As part of the I2C protocol 000000000 is reserved for general calls and
-// all 1111xxxx are reserved for 10 bit addressing
-#define EDPADDR_RESERVED_GENCALL 0x00 // reserved by I2C for general call address
-#define EDPADDR_RESERVED_10BIT 0xF0 // reserved by I2C for 10bit addressing
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/edpdebug.c b/build/shared/lib/avrlib/rsl/edpdebug.c
deleted file mode 100755
index c389fd7c1..000000000
--- a/build/shared/lib/avrlib/rsl/edpdebug.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/*! \file edpdebug.c \brief Emerald Data Protocol Debug Functions. */
-//*****************************************************************************
-//
-// File Name : 'edpdebug.c'
-// Title : Emerald Data Protocol Debug Functions
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.09.20
-// Revised : 2003.09.20
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-//----- Include Files ---------------------------------------------------------
-#include // include I/O definitions (port names, pin names, etc)
-#include // include "signal" names (interrupt names)
-#include // include interrupt support
-#include // include program-space support
-
-#include "global.h" // include our global settings
-#include "rprintf.h" // include printf function library
-#include "debug.h" // include debug helper library
-#include "input.h" // include user-input functions
-
-#include "edp.h"
-#include "edpdebug.h"
-
-// globals
-
-// functions
-
-void edpDisplayCommand(u08 length, EdpCommand* edpCommand)
-{
- // print source and command char
- rprintf("EDP SrcAddr: 0x%x Cmd: 0x%x '%c'\r\n",
- edpCommand->SrcAddr,
- edpCommand->Command, edpCommand->Command);
- if(length-2)
- {
- // print data
- rprintf("Data:\r\n");
- debugPrintHexTable(length-2, edpCommand->Data);
- }
-}
-
-void edpDisplayReply(u08 response, EdpReply* edpReply)
-{
- u08 i;
- u08 checksum;
-
- // display response
- rprintf("EDP Response: 0x%x '%c'\r\n",response,response);
-
- // if data was received
- if(response==EDP_RESP_DATA_REPLY)
- {
- // do checksum on reply
- checksum = edpReply->Length;
- for(i=0; i<(edpReply->Length-1); i++)
- {
- checksum += edpReply->Data[i];
- }
- checksum = ~checksum;
- // print message
- rprintf("EDP Reply: ");
- // show data received
- rprintf("Length: 0x%x ",edpReply->Length);
- rprintf("RxChksum=0x%x MyChksum=0x%x",edpReply->Data[edpReply->Length-1], checksum);
- rprintfCRLF();
- rprintf("Data:\r\n");
- debugPrintHexTable((edpReply->Length-1), edpReply->Data);
- rprintfCRLF();
- }
-}
-/*
-void edpDisplayReplyOld(u08 response, u08 replyLength, u08* replyData)
-{
- u08 i;
- u08 checksum;
-
- // display response
- rprintf("EDP Response: 0x%x '%c'\r\n",response,response);
-
- // if data was received
- if(response==EDP_RESP_DATA_REPLY)
- {
- // do checksum on reply
- checksum = replyLength;
- for(i=0; i<(replyLength-1); i++)
- {
- checksum += replyData[i];
- }
- checksum = ~checksum;
- // print message
- rprintf("EDP Reply: ");
- // show data received
- rprintf("Length: 0x%x ",replyLength);
- rprintf("RxChksum=0x%x MyChksum=0x%x",replyData[replyLength-1], checksum);
- rprintfCRLF();
- rprintf("Data:\r\n");
- debugPrintHexTable((replyLength-1), replyData);
- rprintfCRLF();
- }
-}
-*/
-
-u08 edpComposeCommand(u08 srcEdpAddr, u08* cmdBuffer)
-{
- u08 string[80];
- u08 len;
- u08 i;
-
- // instructions
- rprintfProgStrM("Enter EDP Command, format [c][p1][p2][p3]...[pN]\r\n");
- rprintfProgStrM("[c] is command char, [px] parameters in 2-digit hex\r\n");
-
- // get user input
- rprintfProgStrM("EDP Command>");
- len = inputString(0x0D, 80, string);
- rprintfCRLF();
-
- // check for null user input
- if(!len)
- {
- rprintfProgStrM("ERROR: No command\r\n");
- // return immediately with zero command length
- return 0;
- }
-
- // prepare command
- cmdBuffer[0] = srcEdpAddr;
- cmdBuffer[1] = string[0];
- for(i=0; i",edpCommand->Command,edpCommand->Command);
- retval = edpSendCommand(destEdpAddr, cmdLength, edpCommand);
- // handle result values
- if(retval == EDP_COMMAND_OK)
- {
- // command sent successfully
- rprintfProgStrM("Send Success!\r\n");
- }
- else if(retval == EDP_COMMAND_NODEV)
- {
- // device did not exist
- rprintfProgStrM("Send Failed->NO DEVICE!\r\n");
- rprintf("No EDP device could be contacted at address 0x%x.\r\n", destEdpAddr);
- rprintfProgStrM("The device may be busy or not responding.\r\n");
- rprintfProgStrM("Check target device and I2C bus cabling.\r\n");
- // return immediately
- return;
- }
- else
- {
- // other error
- rprintfProgStrM("Send Failed->Unspecified Error!\r\n");
- // return immediately
- return;
- }
-
- // get the reply, if any, from the command
- retval = edpGetCommandReply(&response, &edpReply);
- // handle result values
- if(retval == EDP_REPLY_BADCHKSUM)
- {
- rprintf("**** Reply has bad checksum ****\r\n");
- }
- // display the reply
- edpDisplayReply(response, edpReply);
-}
diff --git a/build/shared/lib/avrlib/rsl/edpdebug.h b/build/shared/lib/avrlib/rsl/edpdebug.h
deleted file mode 100755
index a9a43a7aa..000000000
--- a/build/shared/lib/avrlib/rsl/edpdebug.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*! \file edpdebug.h \brief Emerald Data Protocol Debug Functions. */
-//*****************************************************************************
-//
-// File Name : 'edpdebug.h'
-// Title : Emerald Data Protocol Debug Functions
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.09.20
-// Revised : 2003.09.20
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef EDPDEBUG_H
-#define EDPDEBUG_H
-
-#include "edp.h"
-
-// functions
-u08 edpComposeCommand(u08 srcEdpAddr, u08* cmdBuffer);
-void edpRunCommand(u08 destEdpAddr, u08 cmdLength, u08* cmdBuffer);
-
-// display functions
-void edpDisplayCommand(u08 length, EdpCommand* edpCommand);
-void edpDisplayReply(u08 response, EdpReply* edpReply);
-//void edpDisplayReplyOld(u08 response, u08 replyLength, u08* replyData);
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/edpdefs.h b/build/shared/lib/avrlib/rsl/edpdefs.h
deleted file mode 100755
index 69e9364c9..000000000
--- a/build/shared/lib/avrlib/rsl/edpdefs.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*! \file edpdefs.h \brief Emerald Data Protocol Defines and Constants. */
-//*****************************************************************************
-//
-// File Name : 'edpdefs.h'
-// Title : Emerald Data Protocol Defines and Constants
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 09/08/2003
-// Revised : 09/08/2003
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef EDPDEFS_H
-#define EDPDEFS_H
-
-// **** Constant Definitions *****
-// ---- Message Size, etc ----
-// Standard defines for various message format parameters
-#define I2C_MAX_COMMAND_LENGTH 127 // [param1]...[param127] (does not include Command, From
- // or Chk) Note that this an absolute maximum,
- // subsystems/nodes are free to set lower maximum lengths
- // For versions pre rev5, this was fixed at 5.
-#define I2C_MAX_DATA_PACKET_LENGTH 127 // Raw Data: [data1]...[data126][Chk] (includes Chk for
-
-
-// ---- Communication OK (value all uppercase ('A'-'Z')
-#define EDP_RESP_ACK 'A' // indicates the command (to_send) was sent but has no return value.
-#define EDP_RESP_DATA_REPLY 'R' // command valid and has return, examine reply and length for details
-
-// ---- Communication Error (values all lowercase ('a'-'z'))
-#define EDP_RESP_UNKWN_CMD 'u' // given command is unrecognized by the subsystem at that address
-#define EDP_RESP_CMD_CHK_ERROR 'c' // checksum error sending command
-#define EDP_RESP_DATA_CHK_ERROR 'd' // checksum error receiving data
-#define EDP_RESP_SEQUENCE_ERROR 's' // read/write out of order
-#define EDP_RESP_READ_BEFORE_WRITE 'b' // requested read before writting associated Command
-#define EDP_RESP_TOO_LONG 'l' // The command sent exceeds the maximum command length for node
-#define EDP_RESP_TOO_FEW_PARAMS 'p' // The command sent has too few parameters
-#define EDP_RESP_INCORRECT_PARAM 'i' // Parameters are incorrect (but there are the right number)
-#define EDP_RESP_BUSY 'b' // The subsystem is still alive, but too busy to reply (AVOID USING)
-#define EDP_RESP_NOT_ALLOWED 'n' // The command is recognized, but not allowed in the current
- // operating mode. Try another command, or try again later
-#define EDP_RESP_OTHER_ERROR 'e' // unspecified EDP/I2C error
-
-// ---- Check Sum ----
-/* The Checksum that is used is a rolling 8-bit sum from the [From] to the last parameter byte of a command
- packet and from the [Length] to the last data byte of a Data packet. This sum is then 1-complemented
- (~, not) and passed as [Chk]. This prevents a series of 0x00 replys from passing the correct check sum.
- Because of the inversion, a packet with all zeros should have a checksum of 0xFF.
-
- The other nice feature of this checksum, is that no matter what the data is, if you add the checksum
- ([Chk]) to the final sum, you should get 0xFF.
-
- To make it even cleaner, you can start the rolling checksum at 0x01 such that when you add in all of the
- data bytes and the [Chk] byte, you get 0x00. This effectively makes the whole operation a twos complement
-*/
-#define EDP_CHECKSUM_INIT 0x01
-
-// -------- Reserved I2C commands ---------
-// Define a short list of reserved commands. Subsystems can choose whether or
-// not to implement these commands, but if they are implemented, they must
-// function as described below.
-
-//Reserved Commands
-#define EDP_CMD_SET_TIME ':' //0x3A Set the subsystem time, realtime.h format
-#define EDP_CMD_RESERVED_1 ';' //0x3B Reserved for future command
-#define EDP_CMD_ROM_WRITE '<' //0x3C Write to program ROM (uploadable code)
-#define EDP_CMD_RESERVED_2 '=' //0x3D Reserved for future command
-#define EDP_CMD_MEM_READ '>' //0x3E Read from program ROM (check program)
-#define EDP_CMD_HELP '?' //0x3F Return human readable help string(s)
-#define EDP_CMD_STATUS '@' //0x40 Get subsystem status
-
-
-#define I2C_DATA_CONTINUE_MASK 0x80 // If MSB of length is set, then the data continues beyond
- // this data packet
-
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/erp.c b/build/shared/lib/avrlib/rsl/erp.c
deleted file mode 100755
index 0bbb8abc0..000000000
--- a/build/shared/lib/avrlib/rsl/erp.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/*! \file erp.c \brief Emerald Radio Protocol System. */
-//*****************************************************************************
-//
-// File Name : 'erp.c'
-// Title : Emerald Radio Protocol System
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.09.10
-// Revised : 2003.09.10
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-//----- Include Files ---------------------------------------------------------
-#include "global.h" // include our global settings
-#include "debug.h" // include debug function library
-#include "rprintf.h" // include printf function library
-
-#include "erp.h"
-#include "edpdebug.h"
-
-// globals
-
-// functions
-void erpDisplayHeader(ErpPacket* erpPacket)
-{
- // show ERP packet header
- rprintf("ERP Header: Callsign=");
- rprintfStrLen(erpPacket->CallSign,0,CALLSIGN_FIELD_LEN);
- rprintf(", Trg=0x%x, Src=0x%x, Seq#=%d, Type=",
- erpPacket->ToAddress,
- erpPacket->FromAddress,
- erpPacket->SequenceNum);
- // try to decode packet type
- switch(erpPacket->Type)
- {
- case ERP_ECHO: rprintf("ECHO"); break;
- case ERP_ECHOREPLY: rprintf("ECHOREPLY"); break;
- case ERP_TEST: rprintf("TEST"); break;
- case ERP_EDPCOMMAND: rprintf("EDPCOMMAND"); break;
- case ERP_EDPREPLY: rprintf("EDPREPLY"); break;
- case ERP_EDPREPLYNODEV: rprintf("EDPREPLYNODEV"); break;
- default: rprintf("0x%x", erpPacket->Type); break;
- }
- rprintfCRLF();
-}
-
-void erpDisplayPacket(ErpPacket* erpPacket, u08 pktLength)
-{
- u08 i;
- u08 flag;
-
- // show ERP packet header
- erpDisplayHeader(erpPacket);
-
- // dump complete raw packet data
- if(pktLength)
- {
- // check if all characters are printable
- flag = TRUE;
- for(i=0; iEdpDestAddr);
- // print embedded EDP command
- edpDisplayCommand(length-1, &erpEdpCommand->EdpCommand);
-}
-
-void erpDisplayEdpReply(u08 length, ErpEdpReply* erpEdpReply)
-{
- // print embedded EDP reply
- edpDisplayReply(erpEdpReply->EdpResponse, &erpEdpReply->EdpReply);
-}
-
-
-/*
-void ErpPacketCreate(u08 targetI2cAddr, u08 pktType, u08 datalength, u08* data)
-{
- // make packet structure in TxPacket memory
- struct ErpPacket* erpPacket
- = (struct ErpPacket*)TxPacket;
-
- // prepare Emerald packet header
- memcpy(erpPacket->CallSign, MYCALLSIGN, CALLSIGN_FIELD_LEN);
- erpPacket->ToAddress = targetI2cAddr;
- erpPacket->FromAddress = LocalI2cAddr;
- erpPacket->SequenceNum = SequenceNum++;
- erpPacket->Type = pktType;
- // copy data
- for(i=0; iData[i] = *data++;
- }
-}
-
-void ErpPacketTx(void)
-{
- // STX/ETX header
- u08 stxetxStatus = 0x5A;
- u08 stxetxType = 0xA5;
- rprintf("Sending Packet: Status: 0x%x Type: 0x%x\r\n", stxetxStatus, stxetxType);
- radioSend(stxetxStatus, stxetxType, EMRADIOHEADER_LEN+(len/2), packet);
-}
-*/
diff --git a/build/shared/lib/avrlib/rsl/erp.h b/build/shared/lib/avrlib/rsl/erp.h
deleted file mode 100755
index 5e80d6ad1..000000000
--- a/build/shared/lib/avrlib/rsl/erp.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*! \file erp.h \brief Emerald Radio Protocol System. */
-//*****************************************************************************
-//
-// File Name : 'erp.h'
-// Title : Emerald Radio Protocol System
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.09.10
-// Revised : 2003.09.10
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef ERP_H
-#define ERP_H
-
-#include "edp.h"
-
-// defines and typedefs
-// Packet Types (tentative)
-#define ERP_ECHO 0x01
-#define ERP_ECHOREPLY 0x02
-#define ERP_TEST 0x03
-#define ERP_EDPCOMMAND 0x10
-#define ERP_EDPREPLY 0x11
-#define ERP_EDPREPLYNODEV 0x12
-
-#define CALLSIGN_FIELD_LEN 6
-
-// structures and typedefs
-typedef struct
-{
- u08 CallSign[6];
- u08 ToAddress;
- u08 FromAddress;
- u08 SequenceNum;
- u08 Type;
- u08 Data[];
-} ErpPacket;
-#define ERP_HEADER_LEN 10
-
-typedef struct
-{
- u08 EdpDestAddr;
- EdpCommand EdpCommand;
-} ErpEdpCommand;
-
-typedef struct
-{
- u08 EdpResponse;
- EdpReply EdpReply;
-} ErpEdpReply;
-
-
-// functions
-// ERP display
-void erpDisplayHeader(ErpPacket* erpPacket);
-void erpDisplayPacket(ErpPacket* erpPacket, u08 pktLength);
-void erpDisplayEdpCommand(u08 length, ErpEdpCommand* erpEdpCommand);
-void erpDisplayEdpReply(u08 length, ErpEdpReply* erpEdpReply);
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/input.c b/build/shared/lib/avrlib/rsl/input.c
deleted file mode 100755
index 7f0a38e7f..000000000
--- a/build/shared/lib/avrlib/rsl/input.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*! \file input.c \brief User-Input Functions. */
-//*****************************************************************************
-//
-// File Name : 'input.c'
-// Title : User-Input Functions
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.09.11
-// Revised : 2003.09.11
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-//----- Include Files ---------------------------------------------------------
-#include "global.h" // include our global settings
-#ifdef __AVR_ATmega128__
-#include "uart2.h"
-#else
-#include "uart.h"
-#endif
-#include "rprintf.h" // include printf function library
-
-#include "input.h"
-
-// globals
-
-// functions
-u08 inputString(u08 termChar, u08 termLen, u08* data)
-{
- u08 s=0;
- u08 length=0;
-
- while(length < termLen)
- {
- // get input
- #ifdef __AVR_ATmega128__
- while(!uartReceiveByte(1,&s));
- #else
- while(!uartReceiveByte(&s));
- #endif
-
- // handle special characters
- if(s == 0x08) // backspace
- {
- if(length > 0)
- {
- // echo backspace-space-backspace
- rprintfChar(0x08);
- rprintfChar(' ');
- rprintfChar(0x08);
- length--;
- }
- }
- else if(s == termChar) // termination character
- {
- // save null-termination
- data[length] = 0;
- break;
- }
- else
- {
- // echo character
- rprintfChar(s);
- // save character
- data[length++] = s;
- }
- }
- return length;
-}
-
-u08 asciiHexToByte(u08* string)
-{
- // convert 2-byte hex string to byte
- return (asciiHexToNibble(string[0])<<4) + asciiHexToNibble(string[1]);
-}
-
-u08 asciiHexToNibble(u08 character)
-{
- // convert 1-byte hex ascii character to nibble
- if((character >= 0x30) && (character <= 0x39))
- return character-0x30;
- else if((character >= 'A') && (character <= 'F'))
- return character-'A'+10;
- else if((character >= 'a') && (character <= 'f'))
- return character-'a'+10;
- else return 0;
-}
diff --git a/build/shared/lib/avrlib/rsl/input.h b/build/shared/lib/avrlib/rsl/input.h
deleted file mode 100755
index 2774022e7..000000000
--- a/build/shared/lib/avrlib/rsl/input.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*! \file input.h \brief User-Input Functions. */
-//*****************************************************************************
-//
-// File Name : 'input.h'
-// Title : User-Input Functions
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 2003.09.11
-// Revised : 2003.09.11
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef INPUT_H
-#define INPUT_H
-
-// defines and typedefs
-
-// functions
-u08 inputString(u08 termChar, u08 termLen, u08* data);
-u08 asciiHexToByte(u08* string);
-u08 asciiHexToNibble(u08 character);
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/mitelgps.c b/build/shared/lib/avrlib/rsl/mitelgps.c
deleted file mode 100755
index 1e8f95c5e..000000000
--- a/build/shared/lib/avrlib/rsl/mitelgps.c
+++ /dev/null
@@ -1,288 +0,0 @@
-/*! \file .c \brief Mitel GPS STX/ETX driver function library. */
-//*****************************************************************************
-//
-// File Name : 'mitelgps.c'
-// Title : Mitel GPS STX/ETX driver function library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 2003.04.11
-// Revised : 2003.08.26
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
- #include
- #include
- #include
- #include
-#endif
-
-#include "global.h"
-#include "buffer.h"
-#include "rprintf.h"
-#include "uart2.h"
-#include "gps.h"
-
-#include "mitelgps.h"
-
-// Program ROM constants
-
-// Global variables
-// external GPS information structure/repository (in gps.h/gps.c)
-extern GpsInfoType GpsInfo;
-// packet processing buffer
-u08 MitelGpsPacket[MITELGPS_BUFFERSIZE];
-// debug flag
-u08 debug;
-#define MITELGPS_DEBUG_PKTPARSE 0x01
-#define MITELGPS_DEBUG_EXTRACT 0x02
-// function pointer to single byte output routine
-static void (*TxByteFunc)(unsigned char c);
-
-void mitelgpsInit(void (*txbytefunc)(unsigned char c))
-{
- // set transmit function
- // (this function will be used for all SendPacket commands)
- TxByteFunc = txbytefunc;
- // set debug status
- debug = 0;
-}
-
-void mitelgpsSendPacket(u08* data, u08 dataLength)
-{
- u08 i;
- u08 dataIdx = 0;
- u08 checksum = 0;
-
- // start of packet
- MitelGpsPacket[dataIdx++] = STX;
- // add packet type and packet data
- for(i=0; idatalength > 1)
- {
- // look for a start of Mitel GPS STX/ETX packet
- if(bufferGetAtIndex(rxBuffer,0) == STX)
- {
- // found start
- startFlag = TRUE;
- // done looking for start
- break;
- }
- else
- // not STX, dump character from buffer
- bufferGetFromFront(rxBuffer);
- }
-
- // if we detected a start, look for end of packet
- if(startFlag)
- {
- for(i=1; i<(rxBuffer->datalength); i++)
- {
- // check for end of Mitel GPS STX/ETX packet
- if(bufferGetAtIndex(rxBuffer,i) == ETX)
- {
- // have a packet end
- // dump initial STX
- bufferGetFromFront(rxBuffer);
- // copy data to MitelGpsPacket
- for(j=0; j<(i-1); j++)
- {
- MitelGpsPacket[j] = bufferGetFromFront(rxBuffer);
- checksum ^= MitelGpsPacket[j];
- }
- // null-terminate copied string
- MitelGpsPacket[j] = 0;
- // dump ending ETX
- bufferGetFromFront(rxBuffer);
-
- // verify checksum
- // undo checksum summing of the checksum itself
- checksum ^= MitelGpsPacket[j-2];
- checksum ^= MitelGpsPacket[j-1];
- if( checksum == convertAsciiHexToInt(&MitelGpsPacket[j-2], 2) )
- {
- // found a good packet
- if(debug & MITELGPS_DEBUG_PKTPARSE)
- {
- rprintf("Rx Mitel GPS packet type: %c%c%c len: %d\r\n",
- MitelGpsPacket[0], MitelGpsPacket[1], MitelGpsPacket[2], j);
- rprintfStr(MitelGpsPacket);
- rprintfCRLF();
- }
- // done with this processing session
- foundpacket = TRUE;
- break;
- }
- else
- {
- if(debug & MITELGPS_DEBUG_PKTPARSE)
- {
- rprintf("Rx Mitel GPS packet type: %c%c%c len: %d Bad Checksum Rcvd: 0x%c%c Calc: 0x%x\r\n",
- MitelGpsPacket[0], MitelGpsPacket[1], MitelGpsPacket[2], j, MitelGpsPacket[j-2], MitelGpsPacket[j-1], checksum);
- }
- }
- }
- }
- }
-
- // handle and direct the received packet
- if(foundpacket)
- {
- // switch on the packet type
- packetType = convertAsciiHexToInt(&MitelGpsPacket[1], 2);
- switch( packetType )
- {
- case MITELTYPE_NAVDATAGND: mitelgpsProcessNAVDATAGND(MitelGpsPacket); break;
- case MITELTYPE_CHNLSTATGND: mitelgpsProcessCHNLSTATGND(MitelGpsPacket); break;
- case MITELTYPE_NAVDATA: mitelgpsProcessNAVDATA(MitelGpsPacket); break;
- case MITELTYPE_RAWDATA: mitelgpsProcessRAWDATA(MitelGpsPacket); break;
- case MITELTYPE_CHNLSTAT: mitelgpsProcessCHNLSTAT(MitelGpsPacket); break;
- case MITELTYPE_RELNAVECEF: break;
- case MITELTYPE_RELNAVRTN: break;
- default:
- if(debug & MITELGPS_DEBUG_PKTPARSE)
- rprintf("Unhandled Mitel GPS packet type: 0x%x\r\n", packetType);
- break;
- }
- }
-
- return foundpacket;
-}
-
-void mitelgpsProcessNAVDATAGND(u08* packet)
-{
- // process "F00" report packets - Navigation Data (Ground)
- char* endptr;
-
- if(debug & MITELGPS_DEBUG_EXTRACT)
- {
- rprintf("MITELGPS: ");
- rprintfStr(packet);
- rprintfCRLF();
- }
-
- // start parsing just after "F00"
- // get latitude [sdd.dddddd]
- GpsInfo.PosLLA.lat.f = strtod(&packet[3], &endptr);
- // get longitude [sddd.dddddd]
- GpsInfo.PosLLA.lon.f = strtod(&packet[3+10], &endptr);
- // get altitude [sxxxxxx.x]
- GpsInfo.PosLLA.alt.f = strtod(&packet[3+10+11], &endptr);
- // get speed [sxxx.xx]
- GpsInfo.VelHS.speed.f = strtod(&packet[3+10+11+9], &endptr);
- // get heading [ddd]
- GpsInfo.VelHS.heading.f = strtod(&packet[3+10+11+9+7], &endptr);
-
- // get # of SVs tracked [xx]
- GpsInfo.numSVs = atoi(&packet[3+10+11+9+7+5+7+5+5+5]);
-}
-
-void mitelgpsProcessCHNLSTATGND(u08* packet)
-{
- // process "F03" report packets - Channel Status (Ground)
-}
-
-void mitelgpsProcessNAVDATA(u08* packet)
-{
- // process "F40" report packets - Navigation Data
- char* endptr;
-
- // start parsing just after "F40"
- // get gps week number [xxxx]=4
- GpsInfo.WeekNum = atoi(&packet[3]);
- // get gps time of week [xxxxxx.xxxxx]=12
- GpsInfo.TimeOfWeek.f = strtod(&packet[3+4], &endptr);
- // gps-utc time difference? [xx]=2
- // get ECEF X [sxxxxxxxx.xx]=12
- GpsInfo.PosECEF.x.f = strtod(&packet[3+4+12+2], &endptr);
- // get ECEF Y [sxxxxxxxx.xx]=12
- GpsInfo.PosECEF.y.f = strtod(&packet[3+4+12+2+12], &endptr);
- // get ECEF Z [sxxxxxxxx.xx]=12
- GpsInfo.PosECEF.z.f = strtod(&packet[3+4+12+2+12+12], &endptr);
- // get ECEF vX [sxxxxxxxx.xx]=12
- GpsInfo.VelECEF.x.f = strtod(&packet[3+4+12+2+12+12+12], &endptr);
- // get ECEF vY [sxxxxxxxx.xx]=12
- GpsInfo.VelECEF.y.f = strtod(&packet[3+4+12+2+12+12+12+12], &endptr);
- // get ECEF vZ [sxxxxxxxx.xx]=12
- GpsInfo.VelECEF.z.f = strtod(&packet[3+4+12+2+12+12+12+12+12], &endptr);
-}
-
-void mitelgpsProcessRAWDATA(u08* packet)
-{
- // process "F42" report packets - Pseudorange, carrier phase, doppler
-}
-
-void mitelgpsProcessCHNLSTAT(u08* packet)
-{
- // process "F43" report packets - Channel Status
-}
-
-// data conversions
-u32 convertAsciiHexToInt(u08* string, u08 numdigits)
-{
- u08 i;
- u32 num = 0;
-
- for(i=0; i= 'a')
- num |= string[i]-'a'+10;
- else if(string[i] >= 'A')
- num |= string[i]-'A'+10;
- else
- num |= string[i]-'0';
- }
- return num;
-}
-
-void convertIntToAsciiHex(u32 num, u08* string, u08 numdigits)
-{
- u08 i;
-
- for(i=0; i>4;
- }
-}
diff --git a/build/shared/lib/avrlib/rsl/mitelgps.h b/build/shared/lib/avrlib/rsl/mitelgps.h
deleted file mode 100755
index b46a77ef3..000000000
--- a/build/shared/lib/avrlib/rsl/mitelgps.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*! \file mitelgps.c \brief Mitel GPS STX/ETX driver function library. */
-//*****************************************************************************
-//
-// File Name : 'mitelgps.h'
-// Title : Mitel GPS STX/ETX driver function library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 2003.04.11
-// Revised : 2003.06.08
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef MITELGPS_H
-#define MITELGPS_H
-
-#include "global.h"
-
-// constants/macros/typdefs
-// packet buffer size (must be able to contain biggest packet)
-#define MITELGPS_BUFFERSIZE 0x0400
-
-// packet delimiters
-#define STX 0x02
-#define ETX 0x03
-
-// report packet types
-#define MITELTYPE_NAVDATAGND 0x00
-#define MITELTYPE_CHNLSTATGND 0x03
-#define MITELTYPE_NAVDATA 0x40
-#define MITELTYPE_RAWDATA 0x42
-#define MITELTYPE_CHNLSTAT 0x43
-#define MITELTYPE_RELNAVECEF 0x45
-#define MITELTYPE_RELNAVRTN 0x46
-
-// functions
-void mitelgpsInit(void (*txbytefunc)(unsigned char c));
-void mitelgpsSendPacket(u08* data, u08 dataLength);
-u08 mitelgpsProcess(cBuffer* rxBuffer);
-
-// packet processing functions
-void mitelgpsProcessNAVDATAGND(u08* packet);
-void mitelgpsProcessCHNLSTATGND(u08* packet);
-void mitelgpsProcessNAVDATA(u08* packet);
-void mitelgpsProcessRAWDATA(u08* packet);
-void mitelgpsProcessCHNLSTAT(u08* packet);
-
-// data conversions (these functions should move somewhere else)
-u32 convertAsciiHexToInt(u08* string, u08 numdigits);
-void convertIntToAsciiHex(u32 num, u08* string, u08 numdigits);
-
-
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/radiolinx.c b/build/shared/lib/avrlib/rsl/radiolinx.c
deleted file mode 100755
index cc1f92958..000000000
--- a/build/shared/lib/avrlib/rsl/radiolinx.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*! \file radiolinx.c \brief Linx Radio Driver. */
-//*****************************************************************************
-//
-// File Name : 'radiolinx.c'
-// Title : Linx Radio Driver
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 09/01/2003
-// Revised : 09/03/2003
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-//----- Include Files ---------------------------------------------------------
-#include // include I/O definitions (port names, pin names, etc)
-#include // include "signal" names (interrupt names)
-#include // include interrupt support
-
-#include "global.h" // include our global settings
-#include "buffer.h" // include buffer support
-#include "uartsw.h" // include software UART driver
-#include "stxetx.h" // include STX/ETX protocol library
-
-#include "radiolinx.h"
-
-// global variables
-
-// functions
-void radioInit(void)
-{
- // Initialize radio interface
- // Since this radio creates a special serial interface,
- // we initialize it here.
- uartswInit();
- // set baud rate of comm
- uartswSetBaudRate(4800);
- // initialize stxetx to use the software UART for sending data
- stxetxInit(uartswSendByte);
-}
-
-void radioSend(u08 status, u08 type, u08 datalength, u08* dataptr)
-{
- stxetxSend(status, type, datalength, dataptr);
-}
-
-cBuffer* radioGetRxBuffer(void)
-{
- return uartswGetRxBuffer();
-}
diff --git a/build/shared/lib/avrlib/rsl/radiolinx.h b/build/shared/lib/avrlib/rsl/radiolinx.h
deleted file mode 100755
index db2813736..000000000
--- a/build/shared/lib/avrlib/rsl/radiolinx.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*! \file radiolinx.h \brief Linx Radio Driver. */
-//*****************************************************************************
-//
-// File Name : 'radiolinx.h'
-// Title : Linx Radio Driver
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 09/01/2003
-// Revised : 09/03/2003
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef RADIOLINX_H
-#define RADIOLINX_H
-
-// functions
-void radioInit(void);
-void radioSend(u08 status, u08 type, u08 datalength, u08* dataptr);
-cBuffer* radioGetRxBuffer(void);
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/radiot96.c b/build/shared/lib/avrlib/rsl/radiot96.c
deleted file mode 100755
index 9131ef69f..000000000
--- a/build/shared/lib/avrlib/rsl/radiot96.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*! \file radiot96.c \brief DataRadio T96-SR Radio Driver. */
-//*****************************************************************************
-//
-// File Name : 'radiot96.c'
-// Title : DataRadio T96-SR Radio Driver
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 09/01/2003
-// Revised : 09/03/2003
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-//----- Include Files ---------------------------------------------------------
-#include // include I/O definitions (port names, pin names, etc)
-#include // include "signal" names (interrupt names)
-#include // include interrupt support
-
-#include "global.h" // include our global settings
-#include "buffer.h" // include buffer support
-#include "timer128.h" // include timer function library
-#include "uart2.h" // include software UART driver
-#include "stxetx.h" // include STX/ETX protocol library
-#include "radiot96.h"
-
-// global variables
-
-// functions
-void radioInit(void)
-{
- // Initialize radio interface
- // set baud rate of comm
- uartSetBaudRate(COMM_UART, 19200);
- // initialize stxetx to use the UART for sending data
- #if COMM_UART == 0
- stxetxInit(uart0SendByte);
- #else
- stxetxInit(uart1SendByte);
- #endif
- // prepare PTT
- cbi(RADIO_PTT_PORT, RADIO_PTT_PIN);
- sbi(RADIO_PTT_DDR, RADIO_PTT_PIN);
-}
-
-void radioPTT(u08 pttFlag)
-{
- if(pttFlag)
- sbi(RADIO_PTT_PORT, RADIO_PTT_PIN);
- else
- cbi(RADIO_PTT_PORT, RADIO_PTT_PIN);
-}
-
-void radioSend(u08 status, u08 type, u08 datalength, u08* dataptr)
-{
- radioPTT(TRUE);
- timerPause(RADIO_PPT_DELAYMS);
- stxetxSend(status, type, datalength, dataptr);
- radioPTT(FALSE);
-}
-
-cBuffer* radioGetRxBuffer(void)
-{
- return uartGetRxBuffer(COMM_UART);
-}
diff --git a/build/shared/lib/avrlib/rsl/radiot96.h b/build/shared/lib/avrlib/rsl/radiot96.h
deleted file mode 100755
index 642d6b2b2..000000000
--- a/build/shared/lib/avrlib/rsl/radiot96.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*! \file radiot96.h \brief DataRadio T96-SR Radio Driver. */
-//*****************************************************************************
-//
-// File Name : 'radiot96.h'
-// Title : DataRadio T96-SR Radio Driver
-// Author : Pascal Stang - Copyright (C) 2003
-// Created : 09/01/2003
-// Revised : 09/03/2003
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef RADIOT96_H
-#define RADIOT96_H
-
-// Radio PTT
-#define RADIO_PTT_DDR DDRD
-#define RADIO_PTT_PORT PORTD
-#define RADIO_PTT_PIN PD7
-
-#define RADIO_PPT_DELAYMS 100
-
-#define COMM_UART 1
-
-// functions
-void radioInit(void);
-void radioSend(u08 status, u08 type, u08 datalength, u08* dataptr);
-cBuffer* radioGetRxBuffer(void);
-
-#endif
diff --git a/build/shared/lib/avrlib/rsl/satmb.c b/build/shared/lib/avrlib/rsl/satmb.c
deleted file mode 100755
index a9a21864d..000000000
--- a/build/shared/lib/avrlib/rsl/satmb.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/*! \file satmb.c \brief Satellite Motherboard Driver Functions. */
-//*****************************************************************************
-//
-// File Name : 'satmb.c'
-// Title : Satellite Motherboard Driver Functions
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.10.13
-// Revised : 2004.10.13
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-//----- Include Files ---------------------------------------------------------
-#include // include I/O definitions (port names, pin names, etc)
-#include // include "signal" names (interrupt names)
-#include // include interrupt support
-
-#include "global.h" // include our global settings
-#include "dallas.h"
-#include "ds2450.h"
-#include "satmb.h"
-#include "dallasids.h"
-
-// globals
-
-// functions
-void satmbInit(void)
-{
- // preset serial port power to on
- satmbSetSerialPortPower(1);
-}
-
-void satmbSetSerialPortPower(u08 on)
-{
- // set I/O control line to output
- sbi(SATMB_SER_PWR_DDR, SATMB_SER_PWR_PIN);
- // set serial port power state
- if(on)
- sbi(SATMB_SER_PWR_PORT, SATMB_SER_PWR_PIN);
- else
- cbi(SATMB_SER_PWR_PORT, SATMB_SER_PWR_PIN);
-}
-
-void satmbSerialRtsCtsInit(void)
-{
- // initialize RTS/CTS lines for operation
- // RTS is input, set pullup
- cbi(SATMB_SER_RTS_DDR, SATMB_SER_RTS_PIN);
- sbi(SATMB_SER_RTS_PORT, SATMB_SER_RTS_PIN);
- // CTS is output, init low
- sbi(SATMB_SER_CTS_DDR, SATMB_SER_CTS_PIN);
- cbi(SATMB_SER_CTS_PORT, SATMB_SER_CTS_PIN);
-}
-
-u08 satmbSerialRtsCheck(void)
-{
- if(inb(SATMB_SER_RTS_PORTIN) & (1<S, 16, DS2450_RANGE_5V);
- // read current-level A/D
- ds2450StartAndResult(&targetSubsysId->S, 'A', &value);
- // calculate milliamp value
- // ma = 1000*(((value/65536)*5.12V)/(50*R))
- // for R=0.47/2 ohms
- // return result
- return value/150;
-}
-
-u16 satmbV2GetCurrent(DallasSubsysId* targetSubsysId)
-{
- u16 value;
- // setup A/D for 5V 16-bit conversion
- ds2450SetupAll(&targetSubsysId->S, 16, DS2450_RANGE_5V);
- // read current-level A/D
- ds2450StartAndResult(&targetSubsysId->S, 'C', &value);
- // calculate milliamp value
- // ma = 1000*(((value/65536)*5.12V)/(50*R))
- // for R=0.1/2 ohms
- // return result
- return value/32;
-}
-
-u08 satmbV1GetOverCurrent(DallasSubsysId* targetSubsysId)
-{
- u16 value;
- // setup A/D for 5V 16-bit conversion
- ds2450SetupAll(&targetSubsysId->S, 16, DS2450_RANGE_5V);
- // read overcurrent state A/D
- ds2450StartAndResult(&targetSubsysId->S, 'B', &value);
- // return result
- return (value>0x8000);
-}
-
-u08 satmbV2GetOverCurrent(DallasSubsysId* targetSubsysId)
-{
- u16 value;
- // setup A/D for 5V 16-bit conversion
- ds2450SetupAll(&targetSubsysId->S, 16, DS2450_RANGE_5V);
- // read overcurrent state A/D
- ds2450StartAndResult(&targetSubsysId->S, 'D', &value);
- // return result
- return (value>0x8000);
-}
-
-void satmbV1SetPowerState(DallasSubsysId* targetSubsysId, u08 state)
-{
- satmbSetPowerState(&targetSubsysId->V1, state);
-}
-
-void satmbV2SetPowerState(DallasSubsysId* targetSubsysId, u08 state)
-{
- satmbSetPowerState(&targetSubsysId->V2, state);
-}
-
-void satmbSetPowerState(dallas_rom_id_T* targetRomId, u08 state)
-{
- if(state)
- {
- // reset overcurrent flag
- ds2450DigitalOut(targetRomId, 'B', DIGOUT_LOW);
- ds2450DigitalOut(targetRomId, 'B', DIGOUT_OC);
- // assert enable
- ds2450DigitalOut(targetRomId, 'A', DIGOUT_LOW);
- }
- // pulse clock line
- ds2450DigitalOut(targetRomId, 'C', DIGOUT_OC);
- ds2450DigitalOut(targetRomId, 'C', DIGOUT_LOW);
- ds2450DigitalOut(targetRomId, 'C', DIGOUT_OC);
- // release enable
- ds2450DigitalOut(targetRomId, 'A', DIGOUT_OC);
-}
diff --git a/build/shared/lib/avrlib/rsl/satmb.h b/build/shared/lib/avrlib/rsl/satmb.h
deleted file mode 100755
index c5f12de0c..000000000
--- a/build/shared/lib/avrlib/rsl/satmb.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*! \file satmb.h \brief Satellite Motherboard Driver Functions. */
-//*****************************************************************************
-//
-// File Name : 'satmb.h'
-// Title : Satellite Motherboard Driver Functions
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.10.13
-// Revised : 2004.10.13
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef SATMB_H
-#define SATMB_H
-
-#include "dallas.h"
-#include "dallasids.h"
-
-
-// defines and typedefs
-
-// SAT-MB serial port control
-// CTS is an output signal
-#define SATMB_SER_CTS_PORT PORTB
-#define SATMB_SER_CTS_DDR DDRB
-#define SATMB_SER_CTS_PORTIN PINB
-#define SATMB_SER_CTS_PIN PB5
-// RTS is an input signal
-#define SATMB_SER_RTS_PORT PORTB
-#define SATMB_SER_RTS_DDR DDRB
-#define SATMB_SER_RTS_PORTIN PINB
-#define SATMB_SER_RTS_PIN PB6
-// Serial Port Power Control (set low to turn off)
-#define SATMB_SER_PWR_PORT PORTD
-#define SATMB_SER_PWR_DDR DDRD
-#define SATMB_SER_PWR_PORTIN PIND
-#define SATMB_SER_PWR_PIN PD5
-
-// SAT-MB Linx Radio Transceiver
-// Non-UART RX line (receive)
-#define SATMB_LINX_IO_RX_PORT PORTD
-#define SATMB_LINX_IO_RX_DDR DDRD
-#define SATMB_LINX_IO_RX_PORTIN PIND
-#define SATMB_LINX_IO_RX_PIN PD4
-// Non-UART TX line (transmit)
-#define SATMB_LINX_IO_TX_PORT PORTB
-#define SATMB_LINX_IO_TX_DDR DDRB
-#define SATMB_LINX_IO_TX_PORTIN PINB
-#define SATMB_LINX_IO_TX_PIN PB7
-// Linx Radio Power Control (set low to turn off)
-#define SATMB_LINX_PWR_PORT PORTD
-#define SATMB_LINX_PWR_DDR DDRD
-#define SATMB_LINX_PWR_PORTIN PIND
-#define SATMB_LINX_PWR_PIN PD5
-// Radio Receive Signal Strength Indicator (RSSI)
-// this is an analog output
-#define SATMB_LINX_RSSI_PORT PORTF
-#define SATMB_LINX_RSSI_DDR DDRF
-#define SATMB_LINX_RSSI_PORTIN PINF
-#define SATMB_LINX_RSSI_PIN PF7
-
-// SAT-MB Direct Dallas Bus Driver
-// Dallas Line Pin
-#define SATMB_DALLAS_LINE_PORT PORTE
-#define SATMB_DALLAS_LINE_DDR DDRE
-#define SATMB_DALLAS_LINE_PORTIN PINE
-#define SATMB_DALLAS_LINE_PIN PE7
-// Dallas OC-Tx Pin
-#define SATMB_DALLAS_TX_PORT PORTE
-#define SATMB_DALLAS_TX_DDR DDRE
-#define SATMB_DALLAS_TX_PORTIN PINE
-#define SATMB_DALLAS_TX_PIN PE3
-// Dallas Strong-Pullup Pin
-#define SATMB_DALLAS_SPU_PORT PORTE
-#define SATMB_DALLAS_SPU_DDR DDRE
-#define SATMB_DALLAS_SPU_PORTIN PINE
-#define SATMB_DALLAS_SPU_PIN PE4
-
-// functions
-
-//! Initializes SAT-MB hardware
-void satmbInit(void);
-
-//! Controls power to the SAT-MB serial port
-// TRUE = on
-// FALSE = off
-void satmbSetSerialPortPower(u08 on);
-
-//! Initializes the SAT-MB serial port RTS/CTS lines
-void satmbSerialRtsCtsInit(void);
-
-//! Returns the current state of the SAT-MB serial port RTS line
-u08 satmbSerialRtsCheck(void);
-
-//! Sets the current state of the SAT-MB serial port CTS line
-void satmbSerialCtsSet(u08 state);
-
-// Power control commands (dallas bus)
-u16 satmbV1GetCurrent(DallasSubsysId* targetSubsysId);
-u16 satmbV2GetCurrent(DallasSubsysId* targetSubsysId);
-u08 satmbV1GetOverCurrent(DallasSubsysId* targetSubsysId);
-u08 satmbV2GetOverCurrent(DallasSubsysId* targetSubsysId);
-void satmbV1SetPowerState(DallasSubsysId* targetSubsysId, u08 state);
-void satmbV2SetPower(DallasSubsysId* targetSubsysId, u08 state);
-
-void satmbSetPowerState(dallas_rom_id_T* targetRomId, u08 state);
-
-#endif
diff --git a/build/shared/lib/avrlib/rtc.c b/build/shared/lib/avrlib/rtc.c
deleted file mode 100755
index e39c985c6..000000000
--- a/build/shared/lib/avrlib/rtc.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*! \file rtc.c \brief Real-time clock function library. */
-//*****************************************************************************
-//
-// File Name : 'rtc.c'
-// Title : Real-time clock function library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 5/10/2002
-// Revised : 9/30/2002
-// Version : 0.6
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
- #include
- #include
- #include
- #include
-#endif
-
-#include "global.h"
-// include timer support
-#ifdef __AVR_ATmega128__
- #include "timer128.h"
-#else
- #include "timer.h"
-#endif
-// include rtc header
-#include "rtc.h"
-
-// Program ROM constants
-static char __attribute__ ((progmem)) MonthDayTable[] = {31,28,31,30,31,30,31,31,30,31,30,31};
-
-// Global variables
-// time registers
-RtcTimeType RtcTime;
-
-void rtcInit(void)
-{
- // set up timer for RTC operation
- // initialize real-time registers
- RtcTime.totaltics = 0;
- RtcTime.tics = 0;
- RtcTime.seconds = 0;
- RtcTime.minutes = 0;
- RtcTime.hours = 0;
- RtcTime.day = 1;
- RtcTime.month = 1;
- RtcTime.year = 2000;
-
- // select the correct RTC timer based on bit defines
- #ifdef AS2
- // use timer2 for most AVRs
- // initialize timer 2
- timer2Init();
- // count with 32.768KHz/8
- timer2SetPrescaler(TIMER_CLK_DIV8);
- // switch to asynchronous input (32KHz crystal)
- sbi(ASSR, AS2);
- // attach service to real-time clock interrupt
- // rtcService() will be called at ((32768/8)/256) = 16Hz
- timerAttach(TIMER2OVERFLOW_INT, rtcService);
- #else
- #ifdef AS0
- // use timer0 for ATmega103, ATmega128
- // initialize timer 0
- timer0Init();
- // count with 32.768KHz/8
- timer0SetPrescaler(TIMER_CLK_DIV8);
- // switch to asynchronous input (32KHz crystal)
- sbi(ASSR, AS0);
- // attach service to real-time clock interrupt
- // rtcService() will be called at ((32768/8)/256) = 16Hz
- timerAttach(TIMER0OVERFLOW_INT, rtcService);
- #endif
- #endif
-}
-
-void rtcService(void)
-{
- // update real-time clock registers
- RtcTime.totaltics++;
- RtcTime.tics++;
- // check for overflows
- if(RtcTime.tics == 16) // tics
- {
- RtcTime.tics = 0;
- RtcTime.seconds++; // increment seconds
- if(RtcTime.seconds > 59) // check seconds overflow
- {
- RtcTime.seconds -= 60;
- RtcTime.minutes++; // increment minutes
- if(RtcTime.minutes > 59) // check minutes overflow
- {
- RtcTime.minutes -= 60;
- RtcTime.hours++; // increment hours
- if(RtcTime.hours > 23) // check hours overflow
- {
- RtcTime.hours -= 24;
- RtcTime.day++; // increment days
- // check days overflow
- if(RtcTime.day == pgm_read_byte(&MonthDayTable[RtcTime.month-1]))
- {
- RtcTime.day = 1;
- RtcTime.month++; // increment months
- if(RtcTime.month == 13) // check months overflow
- {
- RtcTime.month = 1;
- RtcTime.year++; // increment years
- }
- }
- }
- }
- }
- }
-}
-
-RtcTimeType* rtcGetTime(void)
-{
- // return the real-time clock data
- return &RtcTime;
-}
-
diff --git a/build/shared/lib/avrlib/rtc.h b/build/shared/lib/avrlib/rtc.h
deleted file mode 100755
index 2441c2d33..000000000
--- a/build/shared/lib/avrlib/rtc.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*! \file rtc.h \brief real-time clock function library. */
-//*****************************************************************************
-//
-// File Name : 'rtc.h'
-// Title : real-time clock function library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 5/10/2002
-// Revised : 7/12/2002
-// Version : 0.5
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef RTC_H
-#define RTC_H
-
-#include "global.h"
-
-// constants/macros/typdefs
-typedef struct struct_RtcTime
-{
- // hardware
- u08 tics;
- u16 totaltics;
- // time of day
- u08 hours;
- u08 minutes;
- u08 seconds;
- // date
- u08 day;
- u08 month;
- u16 year;
-} RtcTimeType;
-
-
-// functions
-void rtcInit(void);
-void rtcService(void);
-RtcTimeType* rtcGetTime(void);
-
-#endif
diff --git a/build/shared/lib/avrlib/servo.c b/build/shared/lib/avrlib/servo.c
deleted file mode 100755
index ff0e2a3f1..000000000
--- a/build/shared/lib/avrlib/servo.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/*! \file servo.c \brief Interrupt-driven RC Servo function library. */
-//*****************************************************************************
-//
-// File Name : 'servo.c'
-// Title : Interrupt-driven RC Servo function library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 7/31/2002
-// Revised : 8/02/2002
-// Version : 1.0
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
- #include
-#endif
-
-#include "global.h"
-#include "servo.h"
-
-// Program ROM constants
-
-// Global variables
-// servo channel registers
-u16 ServoPosTics;
-u16 ServoPeriodTics;
-u08 ServoChannel;
-ServoChannelType ServoChannels[SERVO_NUM_CHANNELS];
-
-// functions
-
-//! initializes software PWM system
-void servoInit(void)
-{
- u08 channel;
- // disble the timer1 output compare A interrupt
- cbi(TIMSK, OCIE1A);
- // set the prescaler for timer1
- timer1SetPrescaler(TIMER_CLK_DIV256);
- // attach the software PWM service routine to timer1 output compare A
- timerAttach(TIMER1OUTCOMPAREA_INT, servoService);
- // enable and clear channels
- for(channel=0; channel>8)); // write high byte
- outb(OCR1AL, (OCValue & 0x00FF)); // write low byte
- // enable the timer1 output compare A interrupt
- sbi(TIMSK, OCIE1A);
-}
-
-//! turns off software PWM system
-void servoOff(void)
-{
- // disable the timer1 output compare A interrupt
- cbi(TIMSK, OCIE1A);
- // detach the service routine
- timerDetach(TIMER1OUTCOMPAREA_INT);
-}
-
-//! set port and I/O pin for channel
-void servoSetChannelIO(u08 channel, u08 port, u08 pin)
-{
- ServoChannels[channel].port = port;
- ServoChannels[channel].pin = (1<<(pin&0x07));
-}
-
-//! set servo position on channel
-void servoSetPosition(u08 channel, u08 position)
-{
- // input should be between 0 and SERVO_POSITION_MAX
- u16 pos_scaled;
- // calculate scaled position
- pos_scaled = ((u16)position*(SERVO_MAX-SERVO_MIN)/SERVO_POSITION_MAX)+SERVO_MIN;
- // set position
- servoSetPositionRaw(channel, pos_scaled);
-}
-
-//! get servo position on channel
-u08 servoGetPosition(u08 channel)
-{
- return (u08)( ((servoGetPositionRaw(channel)-SERVO_MIN)*SERVO_POSITION_MAX)/(SERVO_MAX-SERVO_MIN) );
-}
-
-//! set servo position on channel (raw unscaled format)
-void servoSetPositionRaw(u08 channel, u16 position)
-{
- // bind to limits
- position = MAX(position, SERVO_MIN);
- position = MIN(position, SERVO_MAX);
- // set position
- ServoChannels[channel].duty = position;
-}
-
-//! get servo position on channel (raw unscaled format)
-u16 servoGetPositionRaw(u08 channel)
-{
- return ServoChannels[channel].duty;
-}
-
-void servoService(void)
-{
- u16 nextTics;
-
- if(ServoChannel < SERVO_NUM_CHANNELS)
- {
- // turn off current channel
- outb(_SFR_IO8(ServoChannels[ServoChannel].port), inb(_SFR_IO8(ServoChannels[ServoChannel].port)) & ~(ServoChannels[ServoChannel].pin));
- }
-
- // next channel
- ServoChannel++;
-
- if(ServoChannel != SERVO_NUM_CHANNELS)
- {
- // loop to channel 0 if needed
- if(ServoChannel > SERVO_NUM_CHANNELS) ServoChannel = 0;
- // turn on new channel
- outb(_SFR_IO8(ServoChannels[ServoChannel].port), inb(_SFR_IO8(ServoChannels[ServoChannel].port)) | (ServoChannels[ServoChannel].pin));
- // schedule turn off time
- nextTics = ServoChannels[ServoChannel].duty;
- }
- else //(Channel == SERVO_NUM_CHANNELS)
- {
- // ***we could save time by precalculating this
- // schedule end-of-period
- nextTics = ServoPeriodTics-ServoPosTics;
- }
-
- // schedule next interrupt
- u16 OCValue;
- // read in current value of output compare register OCR1A
- OCValue = inb(OCR1AL); // read low byte of OCR1A
- OCValue += inb(OCR1AH)<<8; // read high byte of OCR1A
- // increment OCR1A value by nextTics
- OCValue += nextTics;
-// OCR1A+=nextTics;
- // set future output compare time to this new value
- outb(OCR1AH, (OCValue>>8)); // write high byte
- outb(OCR1AL, (OCValue & 0x00FF)); // write low byte
- // set our new tic position
- ServoPosTics += nextTics;
- if(ServoPosTics >= ServoPeriodTics) ServoPosTics = 0;
-}
diff --git a/build/shared/lib/avrlib/servo.h b/build/shared/lib/avrlib/servo.h
deleted file mode 100755
index bf72fee52..000000000
--- a/build/shared/lib/avrlib/servo.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*! \file servo.h \brief Interrupt-driven RC Servo function library. */
-//*****************************************************************************
-//
-// File Name : 'servo.h'
-// Title : Interrupt-driven RC Servo function library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 7/31/2002
-// Revised : 8/02/2002
-// Version : 1.0
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: you need the latest version (3.2+) of the AVR-GCC compiler to use this
-// function library. Download it from http://www.avrfreaks.net/AVRGCC
-//
-// Description : This code allows you to drive up to 8 RC servos from any
-// combination of ports and pins on the AVR processor. Using interrupts,
-// this code continuously sends control signals to the servo to maintain
-// position even while your code is doing other work.
-//
-// The servoInit and servoOff effectively turn on and turn off servo
-// control. When you run ServoInit, it automatically assigns each
-// "channel" of servo control to be output on the SERVO_DEFAULT_PORT.
-// One "channel" of servo control can control one servo and must be
-// assigned single I/O pin for output.
-//
-// If you're using all eight channels (SERVO_NUM_CHANNELS = 8), then
-// then by default the code will use SERVO_DEFAULT_PORT pins 0-7.
-// If you're only using four channels, then pins 0-3 will be used by
-// default.
-//
-// The command servoSetChannelIO(channel, port, pin) allows you to
-// reassign the output of any channel to any port and I/O pin you
-// choose. For exampe, if you have an RC servo connected to PORTC, pin 6,
-// and you wish to use channel 2 to control it, use:
-//
-// servoSerChannelIO( 2, _SFR_IO_ADDR(PORTC), 6)
-//
-// (NOTE: you must include the "_SRF_IO_ADDR()" part around your port)
-//
-// The servoSetPostion and servoGetPosition commands allow you to command
-// a given servo to your desired position. The position you request must
-// lie between the SERVO_MIN and SERVO_MAX limit you defined.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef SERVO_H
-#define SERVO_H
-
-#include "global.h"
-#include "timer.h"
-
-// include configuration
-#include "servoconf.h"
-
-typedef struct struct_ServoChannel
-{
- // hardware I/O port and pin for this channel
- u08 port;
- u08 pin;
- // PWM duty setting which corresponds to servo position
- u16 duty;
-} ServoChannelType;
-
-// functions
-
-// initializes servo system
-// You must run this to begin servo control
-void servoInit(void);
-
-// turns off servo system
-// This stops controlling the servos and
-// returns control of the SERVOPORT to your code
-void servoOff(void);
-
-// set the port and I/O pin you wish to use for a given channel
-// If you do not assign a port and I/O pin for a channel (ie. you don't
-// use this command) then all output will be done through the
-// SERVO_DEFAULT_PORT. See above definition of SERVO_DEFAULT_PORT.
-void servoSetChannelIO(u08 channel, u08 port, u08 pin);
-
-// set and get servo position on a given channel
-// servoSetPosition() commands the servo on to the position you
-// desire. The position input must lie between 0 and POSITION_MAX and
-// will be automatically scaled to raw positions between SERVO_MIN and
-// SERVO_MAX
-// servoGetPosition() returns the most recently set postition of the
-// servo on . The return value will be scaled 0->POSITION_MAX
-void servoSetPosition(u08 channel, u08 position);
-u08 servoGetPosition(u08 channel);
-
-// set and get raw servo position on a given channel
-// Works like non-raw commands but position is not scaled. Position must
-// be between SERVO_MIN and SERVO_MAX
-void servoSetPositionRaw(u08 channel, u16 position);
-u16 servoGetPositionRaw(u08 channel);
-
-// servo interrupt service routine
-void servoService(void);
-
-#endif
diff --git a/build/shared/lib/avrlib/spi.c b/build/shared/lib/avrlib/spi.c
deleted file mode 100755
index 5837ae2e4..000000000
--- a/build/shared/lib/avrlib/spi.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*! \file spi.c \brief SPI interface driver. */
-//*****************************************************************************
-//
-// File Name : 'spi.c'
-// Title : SPI interface driver
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 11/22/2000
-// Revised : 06/06/2002
-// Version : 0.6
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "spi.h"
-
-// Define the SPI_USEINT key if you want SPI bus operation to be
-// interrupt-driven. The primary reason for not using SPI in
-// interrupt-driven mode is if the SPI send/transfer commands
-// will be used from within some other interrupt service routine
-// or if interrupts might be globally turned off due to of other
-// aspects of your program
-//
-// Comment-out or uncomment this line as necessary
-#define SPI_USEINT
-
-// global variables
-volatile u08 spiTransferComplete;
-
-// SPI interrupt service handler
-#ifdef SPI_USEINT
-SIGNAL(SIG_SPI)
-{
- spiTransferComplete = TRUE;
-}
-#endif
-
-// access routines
-void spiInit()
-{
-#ifdef __AVR_ATmega128__
- // setup SPI I/O pins
- sbi(PORTB, 1); // set SCK hi
- sbi(DDRB, 1); // set SCK as output
- cbi(DDRB, 3); // set MISO as input
- sbi(DDRB, 2); // set MOSI as output
- sbi(DDRB, 0); // SS must be output for Master mode to work
-#else
- // setup SPI I/O pins
- sbi(PORTB, 7); // set SCK hi
- sbi(DDRB, 7); // set SCK as output
- cbi(DDRB, 6); // set MISO as input
- sbi(DDRB, 5); // set MOSI as output
- sbi(DDRB, 4); // SS must be output for Master mode to work
-#endif
-
- // setup SPI interface :
- // master mode
- sbi(SPCR, MSTR);
- // clock = f/4
-// cbi(SPCR, SPR0);
-// cbi(SPCR, SPR1);
- // clock = f/16
- cbi(SPCR, SPR0);
- sbi(SPCR, SPR1);
- // select clock phase positive-going in middle of data
- cbi(SPCR, CPOL);
- // Data order MSB first
- cbi(SPCR,DORD);
- // enable SPI
- sbi(SPCR, SPE);
-
-
- // some other possible configs
- //outp((1<>8) & 0x00FF))<<8;
- // send LS byte of given data
- rxData |= (spiTransferByte(data & 0x00FF));
-
- // return the received data
- return rxData;
-}
diff --git a/build/shared/lib/avrlib/spi.h b/build/shared/lib/avrlib/spi.h
deleted file mode 100755
index 7dcbf6a7e..000000000
--- a/build/shared/lib/avrlib/spi.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*! \file spi.h \brief SPI interface driver. */
-//*****************************************************************************
-//
-// File Name : 'spi.h'
-// Title : SPI interface driver
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 11/22/2000
-// Revised : 06/06/2002
-// Version : 0.6
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef SPI_H
-#define SPI_H
-
-#include "global.h"
-
-// function prototypes
-
-// SPI interface initializer
-void spiInit(void);
-
-// spiSendByte(u08 data) waits until the SPI interface is ready
-// and then sends a single byte over the SPI port. This command
-// does not receive anything.
-void spiSendByte(u08 data);
-
-// spiTransferByte(u08 data) waits until the SPI interface is ready
-// and then sends a single byte over the SPI port. The function also
-// returns the byte that was received during transmission.
-u08 spiTransferByte(u08 data);
-
-// spiTransferWord(u08 data) works just like spiTransferByte but
-// operates on a whole word (16-bits of data).
-u16 spiTransferWord(u16 data);
-
-#endif
diff --git a/build/shared/lib/avrlib/spieeprom.c b/build/shared/lib/avrlib/spieeprom.c
deleted file mode 100755
index 5d6a885b5..000000000
--- a/build/shared/lib/avrlib/spieeprom.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*! \file spieeprom.c \brief Interface for standard SPI EEPROM memories. */
-//*****************************************************************************
-//
-// File Name : 'spieeprom.c'
-// Title : Interface for standard SPI EEPROM memories
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.10.07
-// Revised : 2004.10.07
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "spi.h"
-#include "spieeprom.h"
-
-// functions
-void spieepromInit(void)
-{
- // although there is no code here
- // don't forget to initialize the SPI interface itself
-// sbi(DDRB, 0);
-}
-
-u08 spieepromReadByte(u32 memAddr)
-{
- u08 data;
-// cbi(PORTB,0);
- // send command
- spiTransferByte(SPIEEPROM_CMD_READ);
- // send address
- spiTransferByte(memAddr>>8);
- spiTransferByte(memAddr&0x00FF);
- // read contents of memory address
- data = spiTransferByte(0xFF);
- // return data
- return data;
-// sbi(PORTB,0);
-}
-
-void spieepromWriteByte(u32 memAddr, u08 data)
-{
- // wait for any previous write to complete
- while(spieepromReadStatus() & SPIEEPROM_STATUS_WIP);
-
-// cbi(PORTB,0);
- // send command
- spiTransferByte(SPIEEPROM_CMD_WRITE);
- // send address
- spiTransferByte(memAddr>>8);
- spiTransferByte(memAddr&0x00FF);
- // send data to be written
- spiTransferByte(data);
-// sbi(PORTB,0);
-}
-
-void spieepromWriteEnable(void)
-{
-// cbi(PORTB,0);
- // send command
- spiTransferByte(SPIEEPROM_CMD_WREN);
-// sbi(PORTB,0);
-}
-
-void spieepromWriteDisable(void)
-{
-// cbi(PORTB,0);
- // send command
- spiTransferByte(SPIEEPROM_CMD_WRDI);
-// sbi(PORTB,0);
-}
-
-u08 spieepromReadStatus(void)
-{
- u08 status;
-// cbi(PORTB,0);
- // send command
- spiTransferByte(SPIEEPROM_CMD_RDSR);
- // get status register value
- status = spiTransferByte(0xFF);
-// sbi(PORTB,0);
- return status;
-}
diff --git a/build/shared/lib/avrlib/spieeprom.h b/build/shared/lib/avrlib/spieeprom.h
deleted file mode 100755
index 2766f4676..000000000
--- a/build/shared/lib/avrlib/spieeprom.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*! \file spieeprom.h \brief Interface for standard SPI EEPROM memories. */
-//*****************************************************************************
-//
-// File Name : 'spieeprom.h'
-// Title : Interface for standard SPI EEPROM memories
-// Author : Pascal Stang - Copyright (C) 2004
-// Created : 2004.10.07
-// Revised : 2004.10.07
-// Version : 0.1
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef SPIEEPROM_H
-#define SPIEEPROM_H
-
-#include "global.h"
-
-// defines and constants
-// commands
-#define SPIEEPROM_CMD_READ 0x03 //< Read byte(s)
-#define SPIEEPROM_CMD_WRITE 0x02 //< Write byte(s)
-#define SPIEEPROM_CMD_WREN 0x06 //< Write Enable
-#define SPIEEPROM_CMD_WRDI 0x04 //< Write Disable
-#define SPIEEPROM_CMD_RDSR 0x05 //< Read Status Register
-#define SPIEEPROM_CMD_WRSR 0x01 //< Write Status Register
-
-// status register bit defines
-#define SPIEEPROM_STATUS_WIP 0x01 //< Write in progress
-#define SPIEEPROM_STATUS_WEL 0x01 //< Write enable
-#define SPIEEPROM_STATUS_BP0 0x01 //< Block Proection 0
-#define SPIEEPROM_STATUS_BP1 0x01 //< Block Proection 1
-#define SPIEEPROM_STATUS_WPEN 0x01 //< Write Protect Enable
-
-// functions
-
-//! Initialize SPI EEPROM interface
-void spieepromInit(void);
-
-//! In the SPI EEPROM read a byte from memory location [memAddr]
-u08 spieepromReadByte(u32 memAddr);
-
-//! In the SPI EEPROM write a byte [data] to the memory location [memAddr]
-void spieepromWriteByte(u32 memAddr, u08 data);
-
-void spieepromWriteEnable(void);
-void spieepromWriteDisable(void);
-u08 spieepromReadStatus(void);
-
-#endif
diff --git a/build/shared/lib/avrlib/sramsw.c b/build/shared/lib/avrlib/sramsw.c
deleted file mode 100755
index 6c1239f62..000000000
--- a/build/shared/lib/avrlib/sramsw.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*! \file sramsw.c \brief Software-driven SRAM memory bus access functions. */
-//*****************************************************************************
-//
-// File Name : 'sramsw.c'
-// Title : Software-driven SRAM memory bus access functions
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 11/11/2002
-// Revised : 11/13/2002
-// Version : 1.0
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "global.h"
-#include "sramsw.h"
-
-// global variables
-
-// functions
-void sramswInit(void)
-{
- // initialize port state
- outb(SRAM_ADL, 0xFF); // addr/data port set to 0xFF (pull-ups enabled)
- outb(SRAM_AH, 0x00); // high addr port set to 0x00
- // initialize port directions
- outb(SRAM_ADL_DDR, 0x00); // addr/data port set to input
- outb(SRAM_AH_DDR, 0xFF); // high addr port set to output
- // initialize control line states
- sbi(SRAM_CTRL, SRAM_WR); // de-assert write (active low)
- sbi(SRAM_CTRL, SRAM_RD); // de-assert read (active low)
- cbi(SRAM_CTRL, SRAM_ALE); // de-assert ALE (active high)
- // set control line direction
- sbi(SRAM_CTRL_DDR, SRAM_WR);
- sbi(SRAM_CTRL_DDR, SRAM_RD);
- sbi(SRAM_CTRL_DDR, SRAM_ALE);
- // set page lines direction
- outb(SRAM_PAGE_DDR, inb(SRAM_PAGE_DDR) | SRAM_PAGE_MASK );
- // initialize page
- sramswSetPage(0);
-}
-
-void sramswOff(void)
-{
-}
-
-void sramswWrite(u32 addr, u08 data)
-{
- // set page
- sramswSetPage( (addr & 0x00FF0000)>>16 );
- // set high-order address
- outb(SRAM_AH, (addr & 0x0000FF00)>>8 );
- // set low-order address
- outb(SRAM_ADL, addr & 0x000000FF);
- // apply low-order address to latch
- outb(SRAM_ADL_DDR, 0xFF);
- // clock latch to save low-order address
- sbi(SRAM_CTRL, SRAM_ALE); // assert ALE (active high)
- asm volatile ("nop");
- cbi(SRAM_CTRL, SRAM_ALE); // de-assert ALE (active high)
-
- // apply data to memory
- outb(SRAM_ADL, data);
- // clock write line to store data
- cbi(SRAM_CTRL, SRAM_WR); // assert write (active low)
- asm volatile ("nop");
- sbi(SRAM_CTRL, SRAM_WR); // de-assert write (active low)
-}
-
-u08 sramswRead(u32 addr)
-{
- u08 data;
-
- // set page
- sramswSetPage( (addr & 0x00FF0000)>>16 );
- // set high-order address
- outb(SRAM_AH, (addr & 0x0000FF00)>>8 );
- // set low-order address
- outb(SRAM_ADL, addr & 0x000000FF);
- // apply low-order address to latch
- outb(SRAM_ADL_DDR, 0xFF);
- // clock latch to save low-order address
- sbi(SRAM_CTRL, SRAM_ALE); // assert ALE (active high)
- asm volatile ("nop");
- cbi(SRAM_CTRL, SRAM_ALE); // de-assert ALE (active high)
-
- // switch data bus to input
- outb(SRAM_ADL_DDR, 0x00);
- // clear pullups
- outb(SRAM_ADL, 0x00);
- // request data from memory
- cbi(SRAM_CTRL, SRAM_RD); // assert read (active low)
- // retrieve data
- asm volatile ("nop");
- data = inb(SRAM_ADL_IN);
- // release read line
- sbi(SRAM_CTRL, SRAM_RD); // de-assert read (active low)
- // switch data bus to output
- outb(SRAM_ADL_DDR, 0xFF);
-
- return data;
-}
-
-void sramswSetPage(u08 page)
-{
- outb(SRAM_PAGE, (page & SRAM_PAGE_MASK));
-}
diff --git a/build/shared/lib/avrlib/sramsw.h b/build/shared/lib/avrlib/sramsw.h
deleted file mode 100755
index a1be36986..000000000
--- a/build/shared/lib/avrlib/sramsw.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*! \file sramsw.h \brief Software-driven SRAM memory bus access functions. */
-//*****************************************************************************
-//
-// File Name : 'sramsw.h'
-// Title : Software-driven SRAM memory bus access functions
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 11/11/2002
-// Revised : 11/13/2002
-// Version : 1.0
-// Target MCU : Atmel AVR series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef SRAMSW_H
-#define SRAMSW_H
-
-#include "global.h"
-// include project-dependent configurations
-// sramswconf.h allows the user to choose which ports
-// and pins are used in the memory bus
-#include "sramswconf.h"
-
-// function prototypes
-
-//! Initialize the memory bus
-void sramswInit(void);
-//! Write data using the memory bus
-void sramswWrite(u32 addr, u08 data);
-//! Read data using the memory bus
-u08 sramswRead(u32 addr);
-//! Set memory page
-void sramswSetPage(u08 page);
-
-#endif
diff --git a/build/shared/lib/avrlib/sta013.c b/build/shared/lib/avrlib/sta013.c
deleted file mode 100755
index d56191bfb..000000000
--- a/build/shared/lib/avrlib/sta013.c
+++ /dev/null
@@ -1,701 +0,0 @@
-/*! \file sta013.c \brief STMicroelectronics STA013 MP3 player driver. */
-//*****************************************************************************
-//
-// File Name : 'sta013.c'
-// Title : STMicroelectronics STA013 MP3 player driver
-// Author : Pascal Stang
-// Created : 10/22/2000
-// Revised : 7/11/2003
-// Version : 0.3
-// Target MCU : ATmega103 (should work for Atmel AVR Series)
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-
-#include "global.h"
-#include "i2csw.h"
-#include "timer.h"
-//#include "procyon.h"
-
-#include "sta013.h"
-
-// bitrate and sampling frequency mappings
-//static int __attribute__ ((progmem)) MP3_Bitrates[] =
-// { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0,
-// 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0};
-static unsigned char __attribute__ ((progmem)) MP3_Bitrates[] =
- { 0, 4, 8, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 72, 80, 0,
- 0, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 0};
-
-static unsigned char __attribute__ ((progmem)) MP3_SamplingFrequencies[] =
- { 11, 12, 8, 0, // MPEG 2.5 rates
- 0, 0, 0, 0, // reserved rates
- 22, 24, 16, 0, // MPEG 2 rates
- 44, 48, 32, 0 // MPEG 1 rates
- };
-
-// STA013 firmware update and configuration data
-static unsigned char __attribute__ ((progmem)) STA013_UpdateData[] =
- {
-0x3a, 0x01, 0x2a, 0x04, 0x28, 0x00, 0x29, 0x00, 0x20, 0x00,
-0x21, 0x00, 0x22, 0x00, 0x23, 0x00, 0x24, 0x00, 0x25, 0x00,
-0x26, 0x00, 0x27, 0x00, 0x28, 0x01, 0x28, 0x02, 0x21, 0x8f,
-0x28, 0x03, 0x21, 0x00, 0x28, 0x04, 0x28, 0x05, 0x28, 0x06,
-0x28, 0x07, 0x28, 0x08, 0x28, 0x09, 0x28, 0x0a, 0x28, 0x0b,
-0x28, 0x0c, 0x20, 0x80, 0x21, 0x90, 0x28, 0x0d, 0x20, 0x00,
-0x21, 0x00, 0x28, 0x0e, 0x20, 0x81, 0x21, 0x91, 0x28, 0x0f,
-0x20, 0x00, 0x21, 0x92, 0x28, 0x10, 0x21, 0x00, 0x28, 0x11,
-0x21, 0x93, 0x28, 0x12, 0x21, 0x00, 0x28, 0x13, 0x28, 0x14,
-0x28, 0x15, 0x20, 0x82, 0x28, 0x16, 0x20, 0x00, 0x28, 0x17,
-0x28, 0x18, 0x28, 0x19, 0x21, 0x94, 0x28, 0x1a, 0x21, 0x95,
-0x28, 0x1b, 0x21, 0x96, 0x28, 0x1c, 0x21, 0x00, 0x28, 0x1d,
-0x20, 0x83, 0x28, 0x1e, 0x20, 0x00, 0x28, 0x1f, 0x21, 0x97,
-0x28, 0x20, 0x21, 0x00, 0x28, 0x21, 0x28, 0x22, 0x28, 0x23,
-0x28, 0x24, 0x28, 0x25, 0x28, 0x26, 0x28, 0x27, 0x28, 0x28,
-0x28, 0x29, 0x28, 0x2a, 0x20, 0x84, 0x28, 0x2b, 0x20, 0x00,
-0x28, 0x2c, 0x28, 0x2d, 0x28, 0x2e, 0x28, 0x2f, 0x28, 0x30,
-0x28, 0x31, 0x28, 0x32, 0x20, 0x85, 0x28, 0x33, 0x20, 0x00,
-0x28, 0x34, 0x28, 0x35, 0x28, 0x36, 0x28, 0x37, 0x21, 0x98,
-0x28, 0x38, 0x21, 0x00, 0x28, 0x39, 0x28, 0x3a, 0x28, 0x3b,
-0x28, 0x3c, 0x28, 0x3d, 0x28, 0x3e, 0x28, 0x3f, 0x28, 0x40,
-0x28, 0x41, 0x28, 0x42, 0x28, 0x43, 0x28, 0x44, 0x28, 0x45,
-0x28, 0x46, 0x28, 0x47, 0x28, 0x48, 0x28, 0x49, 0x28, 0x4a,
-0x28, 0x4b, 0x28, 0x4c, 0x28, 0x4d, 0x28, 0x4e, 0x28, 0x4f,
-0x28, 0x50, 0x28, 0x51, 0x28, 0x52, 0x28, 0x53, 0x28, 0x54,
-0x28, 0x55, 0x28, 0x56, 0x28, 0x57, 0x28, 0x58, 0x28, 0x59,
-0x28, 0x5a, 0x28, 0x5b, 0x28, 0x5c, 0x28, 0x5d, 0x28, 0x5e,
-0x28, 0x5f, 0x28, 0x60, 0x28, 0x61, 0x28, 0x62, 0x21, 0x99,
-0x28, 0x63, 0x21, 0x00, 0x28, 0x64, 0x28, 0x65, 0x28, 0x66,
-0x28, 0x67, 0x28, 0x68, 0x28, 0x69, 0x28, 0x6a, 0x28, 0x6b,
-0x28, 0x6c, 0x28, 0x6d, 0x28, 0x6e, 0x28, 0x6f, 0x28, 0x70,
-0x28, 0x71, 0x28, 0x72, 0x28, 0x73, 0x28, 0x74, 0x28, 0x75,
-0x28, 0x76, 0x28, 0x77, 0x28, 0x78, 0x28, 0x79, 0x28, 0x7a,
-0x28, 0x7b, 0x28, 0x7c, 0x28, 0x7d, 0x28, 0x7e, 0x28, 0x7f,
-0x28, 0x80, 0x28, 0x81, 0x28, 0x82, 0x28, 0x83, 0x28, 0x84,
-0x28, 0x85, 0x28, 0x86, 0x28, 0x87, 0x28, 0x88, 0x28, 0x89,
-0x28, 0x8a, 0x28, 0x8b, 0x28, 0x8c, 0x28, 0x8d, 0x28, 0x8e,
-0x28, 0x8f, 0x28, 0x90, 0x28, 0x91, 0x20, 0x86, 0x28, 0x92,
-0x20, 0x87, 0x28, 0x93, 0x20, 0x00, 0x28, 0x94, 0x28, 0x95,
-0x28, 0x96, 0x28, 0x97, 0x28, 0x98, 0x28, 0x99, 0x28, 0x9a,
-0x28, 0x9b, 0x28, 0x9c, 0x28, 0x9d, 0x28, 0x9e, 0x28, 0x9f,
-0x21, 0x9a, 0x28, 0xa0, 0x21, 0x00, 0x28, 0xa1, 0x28, 0xa2,
-0x28, 0xa3, 0x28, 0xa4, 0x28, 0xa5, 0x28, 0xa6, 0x28, 0xa7,
-0x28, 0xa8, 0x28, 0xa9, 0x28, 0xaa, 0x28, 0xab, 0x28, 0xac,
-0x28, 0xad, 0x28, 0xae, 0x28, 0xaf, 0x28, 0xb0, 0x28, 0xb1,
-0x28, 0xb2, 0x28, 0xb3, 0x28, 0xb4, 0x28, 0xb5, 0x28, 0xb6,
-0x28, 0xb7, 0x28, 0xb8, 0x28, 0xb9, 0x20, 0x88, 0x28, 0xba,
-0x20, 0x00, 0x28, 0xbb, 0x20, 0x89, 0x28, 0xbc, 0x20, 0x00,
-0x28, 0xbd, 0x28, 0xbe, 0x28, 0xbf, 0x28, 0xc0, 0x28, 0xc1,
-0x28, 0xc2, 0x28, 0xc3, 0x21, 0x9b, 0x28, 0xc4, 0x21, 0x00,
-0x28, 0xc5, 0x28, 0xc6, 0x28, 0xc7, 0x28, 0xc8, 0x28, 0xc9,
-0x28, 0xca, 0x28, 0xcb, 0x28, 0xcc, 0x28, 0xcd, 0x28, 0xce,
-0x28, 0xcf, 0x28, 0xd0, 0x28, 0xd1, 0x28, 0xd2, 0x28, 0xd3,
-0x28, 0xd4, 0x28, 0xd5, 0x28, 0xd6, 0x28, 0xd7, 0x28, 0xd8,
-0x28, 0xd9, 0x28, 0xda, 0x28, 0xdb, 0x28, 0xdc, 0x28, 0xdd,
-0x28, 0xde, 0x28, 0xdf, 0x28, 0xe0, 0x28, 0xe1, 0x20, 0x8a,
-0x28, 0xe2, 0x20, 0x8b, 0x28, 0xe3, 0x20, 0x00, 0x28, 0xe4,
-0x28, 0xe5, 0x28, 0xe6, 0x28, 0xe7, 0x28, 0xe8, 0x28, 0xe9,
-0x28, 0xea, 0x28, 0xeb, 0x28, 0xec, 0x28, 0xed, 0x28, 0xee,
-0x28, 0xef, 0x28, 0xf0, 0x28, 0xf1, 0x28, 0xf2, 0x28, 0xf3,
-0x28, 0xf4, 0x28, 0xf5, 0x28, 0xf6, 0x28, 0xf7, 0x28, 0xf8,
-0x20, 0x8c, 0x28, 0xf9, 0x20, 0x00, 0x21, 0x9c, 0x28, 0xfa,
-0x21, 0x9d, 0x28, 0xfb, 0x20, 0x8d, 0x21, 0x9e, 0x28, 0xfc,
-0x20, 0x8e, 0x21, 0x9f, 0x28, 0xfd, 0x20, 0x00, 0x21, 0x00,
-0x28, 0xfe, 0x28, 0xff, 0x2a, 0x01, 0x28, 0x00, 0x22, 0x01,
-0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x26, 0xa4, 0x27, 0x07,
-0x28, 0x01, 0x21, 0xc7, 0x22, 0x00, 0x23, 0x80, 0x26, 0xc4,
-0x27, 0x0c, 0x28, 0x02, 0x20, 0x09, 0x21, 0x1c, 0x22, 0x04,
-0x26, 0xaa, 0x27, 0x0a, 0x28, 0x03, 0x20, 0x00, 0x21, 0x00,
-0x22, 0x00, 0x23, 0xa6, 0x26, 0xa0, 0x27, 0x07, 0x28, 0x04,
-0x28, 0x05, 0x20, 0x05, 0x23, 0x84, 0x26, 0xb4, 0x27, 0x09,
-0x28, 0x06, 0x20, 0x00, 0x22, 0x03, 0x23, 0x00, 0x24, 0x81,
-0x25, 0xc0, 0x26, 0xab, 0x27, 0x0a, 0x28, 0x07, 0x21, 0xae,
-0x22, 0x00, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x26, 0xa4,
-0x27, 0x00, 0x28, 0x08, 0x21, 0x48, 0x22, 0x01, 0x23, 0x80,
-0x26, 0xc4, 0x27, 0x0c, 0x28, 0x09, 0x20, 0x09, 0x21, 0x04,
-0x22, 0x04, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0x0a, 0x20, 0x00,
-0x21, 0x00, 0x22, 0x00, 0x23, 0xa8, 0x26, 0xa4, 0x27, 0x07,
-0x28, 0x0b, 0x28, 0x0c, 0x21, 0x40, 0x22, 0x20, 0x23, 0x80,
-0x26, 0xc4, 0x27, 0x0c, 0x28, 0x0d, 0x22, 0x24, 0x26, 0xc6,
-0x28, 0x0e, 0x21, 0x9e, 0x22, 0x00, 0x26, 0xc8, 0x28, 0x0f,
-0x20, 0x09, 0x21, 0x02, 0x22, 0x14, 0x26, 0xaa, 0x27, 0x0a,
-0x28, 0x10, 0x20, 0x05, 0x21, 0x00, 0x22, 0x00, 0x23, 0x84,
-0x26, 0xb4, 0x27, 0x09, 0x28, 0x11, 0x20, 0x00, 0x21, 0x01,
-0x23, 0x00, 0x24, 0x01, 0x25, 0xc0, 0x26, 0xab, 0x27, 0x0a,
-0x28, 0x12, 0x21, 0xc3, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07,
-0x26, 0x20, 0x27, 0x00, 0x28, 0x13, 0x20, 0x03, 0x21, 0xc2,
-0x23, 0x83, 0x26, 0x26, 0x27, 0x0d, 0x28, 0x14, 0x21, 0xb3,
-0x22, 0x08, 0x28, 0x15, 0x20, 0x00, 0x21, 0xc6, 0x22, 0x00,
-0x23, 0x95, 0x26, 0x00, 0x27, 0x08, 0x28, 0x16, 0x21, 0x00,
-0x23, 0x00, 0x24, 0x96, 0x25, 0x03, 0x26, 0xaa, 0x27, 0x0a,
-0x28, 0x17, 0x20, 0x42, 0x21, 0xb6, 0x23, 0x80, 0x24, 0x89,
-0x25, 0x07, 0x28, 0x18, 0x20, 0x00, 0x21, 0x00, 0x23, 0x94,
-0x26, 0x0e, 0x28, 0x19, 0x20, 0x0f, 0x23, 0x84, 0x26, 0xb4,
-0x27, 0x09, 0x28, 0x1a, 0x20, 0x00, 0x23, 0x93, 0x26, 0xa8,
-0x27, 0x03, 0x28, 0x1b, 0x26, 0x28, 0x27, 0x00, 0x28, 0x1c,
-0x21, 0x01, 0x23, 0x00, 0x24, 0x01, 0x25, 0xc0, 0x26, 0xab,
-0x27, 0x0a, 0x28, 0x1d, 0x21, 0xc5, 0x23, 0x95, 0x24, 0x89,
-0x25, 0x07, 0x26, 0x20, 0x27, 0x00, 0x28, 0x1e, 0x21, 0x00,
-0x23, 0x94, 0x26, 0x00, 0x27, 0x0a, 0x28, 0x1f, 0x26, 0x0e,
-0x28, 0x20, 0x20, 0x03, 0x21, 0x79, 0x22, 0x01, 0x23, 0x83,
-0x26, 0x26, 0x27, 0x0d, 0x28, 0x21, 0x21, 0x32, 0x28, 0x22,
-0x20, 0x00, 0x21, 0x04, 0x22, 0x00, 0x23, 0x80, 0x24, 0x00,
-0x25, 0xfc, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0x23, 0x21, 0x00,
-0x23, 0x00, 0x25, 0x00, 0x28, 0x24, 0x21, 0xa3, 0x22, 0x0d,
-0x23, 0x80, 0x24, 0x9e, 0x25, 0x3b, 0x28, 0x25, 0x20, 0x42,
-0x21, 0x57, 0x22, 0x01, 0x24, 0x89, 0x25, 0x07, 0x28, 0x26,
-0x20, 0x00, 0x21, 0x43, 0x22, 0x0d, 0x24, 0x00, 0x25, 0x38,
-0x28, 0x27, 0x21, 0x08, 0x22, 0x98, 0x23, 0x95, 0x24, 0x89,
-0x25, 0x07, 0x26, 0x24, 0x27, 0x00, 0x28, 0x28, 0x20, 0x42,
-0x21, 0x93, 0x22, 0x01, 0x23, 0x80, 0x26, 0xaa, 0x27, 0x0a,
-0x28, 0x29, 0x20, 0x03, 0x21, 0x7e, 0x22, 0x04, 0x23, 0x83,
-0x26, 0x26, 0x27, 0x0d, 0x28, 0x2a, 0x20, 0x00, 0x21, 0xb0,
-0x22, 0x00, 0x23, 0x95, 0x26, 0xa0, 0x27, 0x07, 0x28, 0x2b,
-0x21, 0x00, 0x23, 0x00, 0x24, 0x0c, 0x25, 0x04, 0x26, 0xaa,
-0x27, 0x0a, 0x28, 0x2c, 0x21, 0x02, 0x23, 0x80, 0x24, 0x86,
-0x25, 0xc3, 0x26, 0xab, 0x28, 0x2d, 0x20, 0x42, 0x21, 0x97,
-0x22, 0x01, 0x24, 0x89, 0x25, 0x07, 0x26, 0xaa, 0x28, 0x2e,
-0x20, 0x00, 0x21, 0x00, 0x22, 0x00, 0x24, 0x1f, 0x25, 0x04,
-0x28, 0x2f, 0x21, 0xb2, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07,
-0x26, 0x20, 0x27, 0x04, 0x28, 0x30, 0x20, 0x42, 0x21, 0x8b,
-0x22, 0x04, 0x23, 0x80, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0x31,
-0x20, 0x00, 0x21, 0xb1, 0x22, 0x00, 0x23, 0x95, 0x26, 0xa0,
-0x27, 0x07, 0x28, 0x32, 0x20, 0x03, 0x21, 0x75, 0x22, 0x04,
-0x23, 0x83, 0x26, 0x26, 0x27, 0x0d, 0x28, 0x33, 0x20, 0x05,
-0x21, 0x00, 0x22, 0x00, 0x23, 0x84, 0x26, 0xb4, 0x27, 0x09,
-0x28, 0x34, 0x20, 0x00, 0x21, 0x60, 0x23, 0x00, 0x24, 0x01,
-0x25, 0xc0, 0x26, 0xab, 0x27, 0x0a, 0x28, 0x35, 0x21, 0x08,
-0x22, 0x98, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x26, 0x24,
-0x27, 0x00, 0x28, 0x36, 0x21, 0xbc, 0x22, 0x00, 0x28, 0x37,
-0x21, 0xa3, 0x22, 0x0d, 0x23, 0x00, 0x24, 0x01, 0x25, 0xc0,
-0x26, 0xab, 0x27, 0x0a, 0x28, 0x38, 0x21, 0x60, 0x22, 0x00,
-0x23, 0x80, 0x24, 0x00, 0x25, 0x38, 0x26, 0xaa, 0x28, 0x39,
-0x21, 0x06, 0x22, 0x98, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07,
-0x26, 0x24, 0x27, 0x00, 0x28, 0x3a, 0x21, 0xbe, 0x22, 0x00,
-0x28, 0x3b, 0x20, 0x05, 0x21, 0x00, 0x23, 0x84, 0x26, 0xb4,
-0x27, 0x09, 0x28, 0x3c, 0x20, 0x00, 0x21, 0x60, 0x23, 0x00,
-0x24, 0x01, 0x25, 0xc0, 0x26, 0xab, 0x27, 0x0a, 0x28, 0x3d,
-0x21, 0x42, 0x22, 0x01, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07,
-0x26, 0x24, 0x27, 0x00, 0x28, 0x3e, 0x21, 0x0c, 0x22, 0x98,
-0x26, 0xa4, 0x27, 0x07, 0x28, 0x3f, 0x21, 0x08, 0x28, 0x40,
-0x21, 0x60, 0x22, 0x00, 0x23, 0x00, 0x24, 0x01, 0x25, 0xc0,
-0x26, 0xab, 0x27, 0x0a, 0x28, 0x41, 0x21, 0x0c, 0x22, 0x98,
-0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x26, 0x24, 0x27, 0x00,
-0x28, 0x42, 0x20, 0x05, 0x21, 0x00, 0x22, 0x00, 0x23, 0x84,
-0x26, 0xb4, 0x27, 0x09, 0x28, 0x43, 0x20, 0x00, 0x23, 0x80,
-0x24, 0x00, 0x25, 0x10, 0x26, 0xab, 0x27, 0x0a, 0x28, 0x44,
-0x21, 0x22, 0x22, 0x01, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07,
-0x26, 0x24, 0x27, 0x00, 0x28, 0x45, 0x21, 0x00, 0x22, 0x00,
-0x23, 0x00, 0x24, 0x04, 0x25, 0x12, 0x26, 0xaa, 0x27, 0x0a,
-0x28, 0x46, 0x20, 0x03, 0x21, 0xd4, 0x22, 0x05, 0x23, 0x83,
-0x24, 0x89, 0x25, 0x07, 0x26, 0x26, 0x27, 0x0d, 0x28, 0x47,
-0x20, 0x00, 0x21, 0x60, 0x22, 0x00, 0x23, 0x00, 0x24, 0x01,
-0x25, 0xc0, 0x26, 0xab, 0x27, 0x0a, 0x28, 0x48, 0x21, 0xb3,
-0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x26, 0x00, 0x27, 0x08,
-0x28, 0x49, 0x21, 0x00, 0x23, 0x00, 0x24, 0x09, 0x25, 0x00,
-0x26, 0xaa, 0x27, 0x0a, 0x28, 0x4a, 0x21, 0x02, 0x23, 0x80,
-0x24, 0x86, 0x25, 0x3b, 0x28, 0x4b, 0x20, 0x42, 0x21, 0xdd,
-0x22, 0x05, 0x24, 0x89, 0x25, 0x07, 0x28, 0x4c, 0x20, 0x00,
-0x21, 0x00, 0x22, 0x00, 0x24, 0x1f, 0x25, 0x00, 0x28, 0x4d,
-0x21, 0xb3, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x26, 0x20,
-0x27, 0x00, 0x28, 0x4e, 0x21, 0x00, 0x23, 0x00, 0x24, 0x97,
-0x25, 0x03, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0x4f, 0x20, 0x42,
-0x21, 0xe2, 0x22, 0x05, 0x23, 0x80, 0x24, 0x89, 0x25, 0x07,
-0x28, 0x50, 0x20, 0x00, 0x21, 0x10, 0x22, 0x00, 0x23, 0x00,
-0x24, 0x80, 0x25, 0xcc, 0x26, 0xab, 0x28, 0x51, 0x21, 0x00,
-0x22, 0x40, 0x23, 0xb4, 0x24, 0x89, 0x25, 0x07, 0x26, 0xaa,
-0x27, 0x04, 0x28, 0x52, 0x22, 0x00, 0x23, 0xb0, 0x26, 0x92,
-0x27, 0x09, 0x28, 0x53, 0x21, 0x14, 0x22, 0x01, 0x23, 0x95,
-0x26, 0x00, 0x27, 0x08, 0x28, 0x54, 0x21, 0x48, 0x23, 0xa4,
-0x26, 0x2a, 0x27, 0x00, 0x28, 0x55, 0x21, 0x00, 0x22, 0x00,
-0x23, 0x00, 0x24, 0x09, 0x25, 0x00, 0x26, 0xaa, 0x27, 0x0a,
-0x28, 0x56, 0x21, 0x08, 0x23, 0x80, 0x24, 0x86, 0x25, 0x3b,
-0x28, 0x57, 0x20, 0x42, 0x21, 0x11, 0x22, 0x07, 0x24, 0x89,
-0x25, 0x07, 0x28, 0x58, 0x20, 0x00, 0x21, 0x00, 0x22, 0x00,
-0x24, 0x1f, 0x25, 0x00, 0x28, 0x59, 0x21, 0x14, 0x22, 0x01,
-0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x26, 0x20, 0x27, 0x00,
-0x28, 0x5a, 0x21, 0x16, 0x26, 0x02, 0x27, 0x09, 0x28, 0x5b,
-0x21, 0x00, 0x22, 0x00, 0x23, 0x00, 0x24, 0x80, 0x25, 0x48,
-0x26, 0xaa, 0x27, 0x0a, 0x28, 0x5c, 0x23, 0xa0, 0x24, 0x89,
-0x25, 0x07, 0x26, 0x14, 0x27, 0x09, 0x28, 0x5d, 0x24, 0x80,
-0x25, 0x50, 0x26, 0xa4, 0x27, 0x04, 0x28, 0x5e, 0x21, 0x16,
-0x22, 0x01, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x27, 0x00,
-0x28, 0x5f, 0x21, 0x04, 0x22, 0x00, 0x23, 0x00, 0x24, 0x9c,
-0x25, 0x78, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0x60, 0x21, 0x43,
-0x22, 0x0d, 0x24, 0x01, 0x25, 0xc4, 0x26, 0xab, 0x28, 0x61,
-0x21, 0x03, 0x22, 0x00, 0x24, 0x15, 0x28, 0x62, 0x21, 0x00,
-0x24, 0x00, 0x25, 0x00, 0x26, 0xaa, 0x28, 0x63, 0x21, 0x5e,
-0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x26, 0x10, 0x27, 0x09,
-0x28, 0x64, 0x21, 0x03, 0x23, 0x00, 0x24, 0x15, 0x25, 0xc4,
-0x26, 0xab, 0x27, 0x0a, 0x28, 0x65, 0x21, 0x00, 0x23, 0x80,
-0x24, 0x00, 0x25, 0x06, 0x26, 0xaa, 0x28, 0x66, 0x24, 0x8f,
-0x25, 0xe3, 0x26, 0xab, 0x28, 0x67, 0x20, 0x42, 0x21, 0xcd,
-0x22, 0x07, 0x24, 0x89, 0x25, 0x07, 0x26, 0xaa, 0x28, 0x68,
-0x20, 0x00, 0x21, 0x60, 0x22, 0x00, 0x23, 0x00, 0x24, 0x01,
-0x25, 0xc0, 0x26, 0xab, 0x28, 0x69, 0x21, 0x00, 0x23, 0x80,
-0x24, 0x8f, 0x25, 0x03, 0x26, 0xaa, 0x28, 0x6a, 0x20, 0x42,
-0x21, 0xdd, 0x22, 0x07, 0x24, 0x89, 0x25, 0x07, 0x28, 0x6b,
-0x20, 0x00, 0x21, 0x43, 0x22, 0x0d, 0x23, 0x00, 0x24, 0x01,
-0x25, 0xc0, 0x26, 0xab, 0x28, 0x6c, 0x21, 0x00, 0x22, 0x00,
-0x24, 0x00, 0x25, 0x04, 0x26, 0xaa, 0x28, 0x6d, 0x20, 0x03,
-0x21, 0x7f, 0x22, 0x01, 0x23, 0x83, 0x24, 0x89, 0x25, 0x07,
-0x26, 0x26, 0x27, 0x0d, 0x28, 0x6e, 0x21, 0x62, 0x28, 0x6f,
-0x20, 0x05, 0x21, 0x00, 0x22, 0x00, 0x23, 0x84, 0x26, 0xb4,
-0x27, 0x09, 0x28, 0x70, 0x20, 0x00, 0x21, 0x06, 0x23, 0x95,
-0x26, 0x00, 0x27, 0x08, 0x28, 0x71, 0x21, 0x01, 0x23, 0x00,
-0x24, 0x97, 0x25, 0x3b, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0x72,
-0x20, 0x42, 0x21, 0x0e, 0x22, 0x08, 0x23, 0x80, 0x24, 0x89,
-0x25, 0x07, 0x28, 0x73, 0x20, 0x03, 0x21, 0x3c, 0x22, 0x0b,
-0x23, 0x83, 0x26, 0x26, 0x27, 0x0d, 0x28, 0x74, 0x20, 0x00,
-0x21, 0x03, 0x22, 0x00, 0x23, 0x95, 0x26, 0x02, 0x27, 0x08,
-0x28, 0x75, 0x21, 0x27, 0x23, 0x00, 0x24, 0x81, 0x25, 0xc4,
-0x26, 0xab, 0x27, 0x0a, 0x28, 0x76, 0x21, 0x00, 0x23, 0x80,
-0x24, 0x09, 0x25, 0x48, 0x26, 0xaa, 0x28, 0x77, 0x21, 0x58,
-0x22, 0x34, 0x23, 0xa3, 0x24, 0x89, 0x25, 0x07, 0x26, 0x2a,
-0x27, 0x00, 0x28, 0x78, 0x21, 0x00, 0x22, 0x00, 0x23, 0xa0,
-0x26, 0x00, 0x27, 0x09, 0x28, 0x79, 0x21, 0x07, 0x23, 0x80,
-0x24, 0x03, 0x25, 0x39, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0x7a,
-0x21, 0x04, 0x23, 0x00, 0x24, 0x1c, 0x25, 0x38, 0x28, 0x7b,
-0x21, 0x07, 0x23, 0x80, 0x24, 0x83, 0x25, 0x39, 0x28, 0x7c,
-0x21, 0x03, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x26, 0x02,
-0x27, 0x08, 0x28, 0x7d, 0x21, 0x27, 0x23, 0x00, 0x24, 0x81,
-0x25, 0xc4, 0x26, 0xab, 0x27, 0x0a, 0x28, 0x7e, 0x21, 0x00,
-0x23, 0x80, 0x24, 0x09, 0x25, 0x48, 0x26, 0xaa, 0x28, 0x7f,
-0x21, 0x58, 0x22, 0x34, 0x23, 0xa3, 0x24, 0x89, 0x25, 0x07,
-0x26, 0x2a, 0x27, 0x00, 0x28, 0x80, 0x21, 0x06, 0x22, 0x00,
-0x23, 0x00, 0x24, 0x81, 0x25, 0xc0, 0x26, 0x93, 0x27, 0x01,
-0x28, 0x81, 0x21, 0x00, 0x23, 0x80, 0x24, 0x89, 0x25, 0x48,
-0x26, 0xaa, 0x27, 0x0a, 0x28, 0x82, 0x20, 0x02, 0x21, 0x66,
-0x22, 0x08, 0x23, 0x00, 0x24, 0x00, 0x25, 0x66, 0x28, 0x83,
-0x20, 0x00, 0x21, 0x00, 0x22, 0x00, 0x23, 0x80, 0x24, 0x1f,
-0x25, 0x02, 0x28, 0x84, 0x21, 0x06, 0x24, 0x89, 0x25, 0x07,
-0x26, 0xdc, 0x27, 0x0c, 0x28, 0x85, 0x21, 0x00, 0x23, 0xaa,
-0x26, 0xaa, 0x27, 0x0a, 0x28, 0x86, 0x23, 0xb6, 0x26, 0x00,
-0x27, 0x08, 0x28, 0x87, 0x23, 0x80, 0x24, 0x86, 0x25, 0x3b,
-0x26, 0xaa, 0x27, 0x0a, 0x28, 0x88, 0x21, 0x05, 0x24, 0x89,
-0x25, 0x07, 0x26, 0xdc, 0x27, 0x0c, 0x28, 0x89, 0x21, 0x00,
-0x23, 0xaa, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0x8a, 0x23, 0xb6,
-0x26, 0x00, 0x27, 0x08, 0x28, 0x8b, 0x23, 0x80, 0x24, 0x86,
-0x25, 0x3b, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0x8c, 0x20, 0x42,
-0x21, 0x7b, 0x22, 0x08, 0x24, 0x89, 0x25, 0x07, 0x28, 0x8d,
-0x20, 0x00, 0x21, 0x00, 0x22, 0x00, 0x23, 0x00, 0x24, 0x01,
-0x25, 0x82, 0x28, 0x8e, 0x21, 0x05, 0x24, 0x81, 0x25, 0xc2,
-0x26, 0xab, 0x28, 0x8f, 0x20, 0x03, 0x21, 0x93, 0x22, 0x08,
-0x23, 0x83, 0x24, 0x89, 0x25, 0x07, 0x26, 0x26, 0x27, 0x0d,
-0x28, 0x90, 0x20, 0x00, 0x21, 0x05, 0x22, 0x00, 0x23, 0x00,
-0x24, 0x81, 0x25, 0xc0, 0x26, 0x13, 0x27, 0x01, 0x28, 0x91,
-0x21, 0x00, 0x23, 0x80, 0x24, 0x89, 0x25, 0x48, 0x26, 0xaa,
-0x27, 0x0a, 0x28, 0x92, 0x20, 0x02, 0x21, 0x7e, 0x22, 0x08,
-0x23, 0x00, 0x24, 0x00, 0x25, 0x66, 0x28, 0x93, 0x20, 0x00,
-0x21, 0x00, 0x22, 0x00, 0x23, 0x80, 0x24, 0x1f, 0x25, 0x02,
-0x28, 0x94, 0x21, 0x05, 0x24, 0x89, 0x25, 0x07, 0x26, 0xdc,
-0x27, 0x0c, 0x28, 0x95, 0x21, 0x00, 0x23, 0xaa, 0x26, 0xaa,
-0x27, 0x0a, 0x28, 0x96, 0x23, 0xb6, 0x26, 0x00, 0x27, 0x08,
-0x28, 0x97, 0x23, 0x80, 0x24, 0x86, 0x25, 0x3b, 0x26, 0xaa,
-0x27, 0x0a, 0x28, 0x98, 0x21, 0x05, 0x24, 0x89, 0x25, 0x07,
-0x26, 0xdc, 0x27, 0x0c, 0x28, 0x99, 0x21, 0x00, 0x23, 0xaa,
-0x26, 0xaa, 0x27, 0x0a, 0x28, 0x9a, 0x23, 0x80, 0x24, 0x1f,
-0x25, 0x02, 0x28, 0x9b, 0x21, 0x01, 0x23, 0x00, 0x24, 0x81,
-0x25, 0xc2, 0x26, 0xab, 0x28, 0x9c, 0x20, 0x03, 0x21, 0x93,
-0x22, 0x08, 0x23, 0x83, 0x24, 0x89, 0x25, 0x07, 0x26, 0x26,
-0x27, 0x0d, 0x28, 0x9d, 0x20, 0x00, 0x21, 0x04, 0x22, 0x00,
-0x23, 0x95, 0x26, 0x12, 0x27, 0x08, 0x28, 0x9e, 0x21, 0x60,
-0x23, 0xc4, 0x26, 0xaa, 0x27, 0x04, 0x28, 0x9f, 0x21, 0x00,
-0x23, 0xc0, 0x26, 0x00, 0x27, 0x09, 0x28, 0xa0, 0x20, 0x42,
-0x21, 0xcb, 0x22, 0x08, 0x23, 0x80, 0x26, 0xaa, 0x27, 0x0a,
-0x28, 0xa1, 0x20, 0x70, 0x21, 0x54, 0x22, 0xb8, 0x23, 0x95,
-0x26, 0x12, 0x27, 0x08, 0x28, 0xa2, 0x20, 0x02, 0x21, 0xcc,
-0x22, 0x08, 0x23, 0x80, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0xa3,
-0x20, 0x03, 0x21, 0xca, 0x22, 0x0f, 0x23, 0x83, 0x26, 0x26,
-0x27, 0x0d, 0x28, 0xa4, 0x20, 0x00, 0x21, 0x00, 0x22, 0x00,
-0x23, 0x00, 0x24, 0x8c, 0x25, 0x0c, 0x26, 0xaa, 0x27, 0x0a,
-0x28, 0xa5, 0x21, 0x04, 0x24, 0x82, 0x25, 0x78, 0x28, 0xa6,
-0x21, 0x00, 0x23, 0x80, 0x24, 0x89, 0x25, 0x48, 0x26, 0x12,
-0x27, 0x04, 0x28, 0xa7, 0x20, 0x03, 0x21, 0xde, 0x22, 0x0f,
-0x23, 0x83, 0x25, 0x07, 0x26, 0x26, 0x27, 0x0d, 0x28, 0xa8,
-0x20, 0x00, 0x21, 0x01, 0x22, 0x00, 0x23, 0x00, 0x24, 0x9c,
-0x25, 0x78, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0xa9, 0x21, 0x00,
-0x23, 0x80, 0x24, 0x81, 0x25, 0x40, 0x28, 0xaa, 0x20, 0x03,
-0x21, 0xcf, 0x22, 0x0f, 0x23, 0x83, 0x24, 0x89, 0x25, 0x07,
-0x26, 0x26, 0x27, 0x0d, 0x28, 0xab, 0x20, 0x70, 0x21, 0x08,
-0x22, 0xb8, 0x23, 0x95, 0x26, 0xa0, 0x27, 0x04, 0x28, 0xac,
-0x20, 0x03, 0x21, 0xd4, 0x22, 0x0f, 0x23, 0x83, 0x26, 0x26,
-0x27, 0x0d, 0x28, 0xad, 0x21, 0x27, 0x22, 0x0b, 0x28, 0xae,
-0x20, 0x70, 0x21, 0x63, 0x22, 0xb8, 0x23, 0x95, 0x26, 0x12,
-0x27, 0x08, 0x28, 0xaf, 0x20, 0x00, 0x21, 0x01, 0x22, 0x00,
-0x23, 0x80, 0x24, 0x86, 0x25, 0xcb, 0x26, 0xab, 0x27, 0x0a,
-0x28, 0xb0, 0x20, 0x42, 0x21, 0xdd, 0x22, 0x08, 0x24, 0x89,
-0x25, 0x07, 0x26, 0xaa, 0x28, 0xb1, 0x20, 0x00, 0x21, 0x18,
-0x22, 0x80, 0x23, 0x95, 0x26, 0xa4, 0x27, 0x00, 0x28, 0xb2,
-0x20, 0x03, 0x21, 0xd9, 0x22, 0x0f, 0x23, 0x83, 0x26, 0x26,
-0x27, 0x0d, 0x28, 0xb3, 0x20, 0x70, 0x21, 0x0a, 0x22, 0xb8,
-0x23, 0x95, 0x26, 0xa0, 0x27, 0x00, 0x28, 0xb4, 0x20, 0x02,
-0x21, 0xe0, 0x22, 0x08, 0x23, 0x80, 0x26, 0xaa, 0x27, 0x0a,
-0x28, 0xb5, 0x20, 0x70, 0x21, 0x0a, 0x22, 0xb8, 0x23, 0x95,
-0x26, 0xa0, 0x27, 0x00, 0x28, 0xb6, 0x21, 0x54, 0x26, 0x02,
-0x27, 0x08, 0x28, 0xb7, 0x20, 0x00, 0x21, 0x18, 0x22, 0x80,
-0x26, 0xa4, 0x27, 0x00, 0x28, 0xb8, 0x21, 0x00, 0x22, 0x00,
-0x23, 0x80, 0x24, 0x80, 0x25, 0x48, 0x26, 0xaa, 0x27, 0x0a,
-0x28, 0xb9, 0x20, 0x70, 0x21, 0x5e, 0x22, 0xb8, 0x23, 0x95,
-0x24, 0x89, 0x25, 0x07, 0x26, 0x12, 0x27, 0x08, 0x28, 0xba,
-0x20, 0x00, 0x21, 0x00, 0x22, 0x00, 0x23, 0x80, 0x24, 0x09,
-0x25, 0x4b, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0xbb, 0x20, 0x70,
-0x21, 0x5f, 0x22, 0xb8, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07,
-0x26, 0x10, 0x27, 0x08, 0x28, 0xbc, 0x20, 0x00, 0x21, 0x00,
-0x22, 0x00, 0x23, 0x00, 0x24, 0x1c, 0x25, 0x83, 0x26, 0xab,
-0x27, 0x0a, 0x28, 0xbd, 0x20, 0x03, 0x21, 0x32, 0x22, 0x09,
-0x23, 0x83, 0x24, 0x89, 0x25, 0x07, 0x26, 0x26, 0x27, 0x0d,
-0x28, 0xbe, 0x20, 0x00, 0x21, 0x00, 0x22, 0x00, 0x23, 0x00,
-0x24, 0x82, 0x25, 0x8c, 0x26, 0xab, 0x27, 0x0a, 0x28, 0xbf,
-0x20, 0x03, 0x21, 0x25, 0x22, 0x09, 0x23, 0x83, 0x24, 0x89,
-0x25, 0x07, 0x26, 0x26, 0x27, 0x0d, 0x28, 0xc0, 0x20, 0x42,
-0x21, 0xbc, 0x23, 0x80, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0xc1,
-0x20, 0x00, 0x21, 0x01, 0x22, 0x00, 0x23, 0x00, 0x24, 0x01,
-0x25, 0xc0, 0x26, 0xab, 0x28, 0xc2, 0x20, 0x70, 0x21, 0x0f,
-0x22, 0xb8, 0x23, 0x95, 0x24, 0x89, 0x25, 0x07, 0x26, 0x20,
-0x27, 0x00, 0x28, 0xc3, 0x20, 0x03, 0x21, 0xe3, 0x22, 0x0f,
-0x23, 0x83, 0x26, 0x26, 0x27, 0x0d, 0x28, 0xc4, 0x20, 0x05,
-0x21, 0x00, 0x22, 0x00, 0x23, 0x84, 0x26, 0xb4, 0x27, 0x09,
-0x28, 0xc5, 0x20, 0x00, 0x21, 0x03, 0x23, 0x95, 0x26, 0x14,
-0x27, 0x08, 0x28, 0xc6, 0x21, 0xa6, 0x23, 0xa4, 0x26, 0x2a,
-0x27, 0x05, 0x28, 0xc7, 0x21, 0x00, 0x23, 0xa0, 0x26, 0x44,
-0x27, 0x09, 0x28, 0xc8, 0x21, 0x18, 0x22, 0x6d, 0x23, 0x80,
-0x24, 0x9e, 0x25, 0x7b, 0x26, 0xaa, 0x27, 0x0a, 0x28, 0xc9,
-0x20, 0x42, 0x21, 0x13, 0x22, 0x0b, 0x24, 0x89, 0x25, 0x07,
-0x28, 0xca, 0x20, 0x00, 0x21, 0xae, 0x22, 0x00, 0x23, 0x95,
-0x26, 0x24, 0x27, 0x00, 0x28, 0xcb, 0x21, 0x00, 0x22, 0x03,
-0x23, 0x80, 0x24, 0x87, 0x25, 0x7b, 0x26, 0xaa, 0x27, 0x0a,
-0x28, 0xcc, 0x20, 0x42, 0x21, 0x16, 0x22, 0x0b, 0x24, 0x89,
-0x25, 0x07, 0x28, 0xcd, 0x20, 0x00, 0x21, 0xae, 0x22, 0x00,
-0x23, 0x95, 0x26, 0x24, 0x27, 0x00, 0x28, 0xce, 0x20, 0x05,
-0x21, 0x00, 0x23, 0x84, 0x26, 0xb4, 0x27, 0x09, 0x28, 0xcf,
-0x20, 0x03, 0x21, 0x0d, 0x22, 0x0b, 0x23, 0x83, 0x26, 0x26,
-0x27, 0x0d, 0x28, 0xd0, 0x20, 0x00, 0x21, 0x00, 0x22, 0x00,
-0x23, 0x00, 0x24, 0x80, 0x26, 0x02, 0x27, 0x00, 0x28, 0xd1,
-0x23, 0x80, 0x24, 0x09, 0x25, 0x48, 0x26, 0x1e, 0x28, 0xd2,
-0x21, 0x58, 0x22, 0x34, 0x23, 0x33, 0x24, 0x80, 0x25, 0x07,
-0x26, 0x2a, 0x28, 0xd3, 0x21, 0x00, 0x22, 0x00, 0x23, 0x00,
-0x26, 0x80, 0x27, 0x10, 0x28, 0xd4, 0x21, 0x10, 0x23, 0x63,
-0x26, 0x2a, 0x27, 0x00, 0x28, 0xd5, 0x21, 0x00, 0x23, 0x60,
-0x26, 0xa8, 0x27, 0x12, 0x28, 0xd6, 0x21, 0xaf, 0x22, 0x4c,
-0x23, 0x00, 0x26, 0xc8, 0x27, 0x0c, 0x28, 0xd7, 0x21, 0x00,
-0x22, 0x00, 0x26, 0x80, 0x27, 0x05, 0x28, 0xd8, 0x23, 0x80,
-0x24, 0x86, 0x25, 0x3b, 0x26, 0x1e, 0x27, 0x00, 0x28, 0xd9,
-0x20, 0x42, 0x21, 0x1c, 0x22, 0x0e, 0x23, 0x00, 0x24, 0x80,
-0x25, 0x07, 0x28, 0xda, 0x20, 0x00, 0x21, 0x35, 0x22, 0x29,
-0x26, 0xc4, 0x27, 0x0c, 0x28, 0xdb, 0x20, 0x02, 0x21, 0x1d,
-0x22, 0x0e, 0x26, 0x1e, 0x27, 0x00, 0x28, 0xdc, 0x20, 0x00,
-0x21, 0x7f, 0x22, 0x34, 0x26, 0xc4, 0x27, 0x0c, 0x28, 0xdd,
-0x21, 0x00, 0x22, 0x00, 0x23, 0x90, 0x24, 0x9f, 0x25, 0x04,
-0x26, 0x10, 0x27, 0x0a, 0x28, 0xde, 0x23, 0x00, 0x24, 0x84,
-0x25, 0x00, 0x26, 0x80, 0x27, 0x10, 0x28, 0xdf, 0x21, 0x06,
-0x23, 0x63, 0x24, 0x80, 0x25, 0x07, 0x26, 0x2a, 0x27, 0x00,
-0x28, 0xe0, 0x21, 0x00, 0x23, 0x80, 0x24, 0x89, 0x26, 0xaa,
-0x27, 0x0a, 0x28, 0xe1, 0x20, 0x05, 0x23, 0x84, 0x26, 0xb4,
-0x27, 0x09, 0x28, 0xe2, 0x20, 0x70, 0x21, 0x61, 0x22, 0xb8,
-0x23, 0x95, 0x26, 0x12, 0x27, 0x08, 0x28, 0xe3, 0x20, 0x00,
-0x21, 0x01, 0x22, 0x00, 0x23, 0x80, 0x24, 0x86, 0x25, 0xc3,
-0x26, 0xab, 0x27, 0x0a, 0x28, 0xe4, 0x20, 0x42, 0x21, 0xce,
-0x22, 0x0f, 0x24, 0x89, 0x25, 0x07, 0x26, 0xaa, 0x28, 0xe5,
-0x20, 0x70, 0x21, 0x50, 0x22, 0xb8, 0x23, 0x95, 0x26, 0x12,
-0x27, 0x08, 0x28, 0xe6, 0x20, 0x05, 0x21, 0x00, 0x22, 0x00,
-0x23, 0x84, 0x26, 0xb4, 0x27, 0x09, 0x28, 0xe7, 0x20, 0x70,
-0x21, 0x64, 0x22, 0xb8, 0x23, 0x95, 0x26, 0x12, 0x27, 0x08,
-0x28, 0xe8, 0x20, 0x00, 0x21, 0x01, 0x22, 0x00, 0x23, 0x80,
-0x24, 0x86, 0x25, 0xc3, 0x26, 0xab, 0x27, 0x0a, 0x28, 0xe9,
-0x20, 0x42, 0x21, 0xd3, 0x22, 0x0f, 0x24, 0x89, 0x25, 0x07,
-0x26, 0xaa, 0x28, 0xea, 0x20, 0x70, 0x21, 0x51, 0x22, 0xb8,
-0x23, 0x95, 0x26, 0x12, 0x27, 0x08, 0x28, 0xeb, 0x20, 0x05,
-0x21, 0x00, 0x22, 0x00, 0x23, 0x84, 0x26, 0xb4, 0x27, 0x09,
-0x28, 0xec, 0x20, 0x70, 0x21, 0x65, 0x22, 0xb8, 0x23, 0x95,
-0x26, 0x12, 0x27, 0x08, 0x28, 0xed, 0x20, 0x00, 0x21, 0x01,
-0x22, 0x00, 0x23, 0x80, 0x24, 0x86, 0x25, 0xc3, 0x26, 0xab,
-0x27, 0x0a, 0x28, 0xee, 0x20, 0x42, 0x21, 0xd8, 0x22, 0x0f,
-0x24, 0x89, 0x25, 0x07, 0x26, 0xaa, 0x28, 0xef, 0x20, 0x70,
-0x21, 0x52, 0x22, 0xb8, 0x23, 0x95, 0x26, 0x12, 0x27, 0x08,
-0x28, 0xf0, 0x20, 0x05, 0x21, 0x00, 0x22, 0x00, 0x23, 0x84,
-0x26, 0xb4, 0x27, 0x09, 0x28, 0xf1, 0x20, 0x70, 0x21, 0x61,
-0x22, 0xb8, 0x23, 0x95, 0x26, 0x02, 0x27, 0x08, 0x28, 0xf2,
-0x20, 0x00, 0x21, 0x01, 0x22, 0x00, 0x23, 0x80, 0x24, 0x86,
-0x25, 0xc3, 0x26, 0xab, 0x27, 0x0a, 0x28, 0xf3, 0x20, 0x42,
-0x21, 0xdd, 0x22, 0x0f, 0x24, 0x89, 0x25, 0x07, 0x26, 0xaa,
-0x28, 0xf4, 0x20, 0x70, 0x21, 0x50, 0x22, 0xb8, 0x23, 0x95,
-0x26, 0x02, 0x27, 0x08, 0x28, 0xf5, 0x20, 0x05, 0x21, 0x00,
-0x22, 0x00, 0x23, 0x84, 0x26, 0xb4, 0x27, 0x09, 0x28, 0xf6,
-0x20, 0x00, 0x21, 0x01, 0x23, 0x80, 0x24, 0x86, 0x25, 0xcb,
-0x26, 0xab, 0x27, 0x0a, 0x28, 0xf7, 0x20, 0x42, 0x21, 0xe1,
-0x22, 0x0f, 0x24, 0x89, 0x25, 0x07, 0x26, 0xaa, 0x28, 0xf8,
-0x20, 0x00, 0x21, 0x02, 0x22, 0x00, 0x23, 0x00, 0x24, 0x81,
-0x25, 0xc4, 0x26, 0xab, 0x28, 0xf9, 0x21, 0x00, 0x23, 0x80,
-0x24, 0x89, 0x25, 0x48, 0x26, 0xaa, 0x28, 0xfa, 0x20, 0x05,
-0x23, 0x84, 0x25, 0x07, 0x26, 0xb4, 0x27, 0x09, 0x28, 0xfb,
-0x20, 0x70, 0x21, 0x4e, 0x22, 0xb8, 0x23, 0x95, 0x26, 0x10,
-0x27, 0x08, 0x28, 0xfc, 0x20, 0x00, 0x21, 0x00, 0x22, 0x00,
-0x23, 0x80, 0x24, 0x86, 0x25, 0xc3, 0x26, 0xab, 0x27, 0x0a,
-0x28, 0xfd, 0x20, 0x42, 0x21, 0xe7, 0x22, 0x0f, 0x24, 0x89,
-0x25, 0x07, 0x26, 0xaa, 0x28, 0xfe, 0x20, 0x00, 0x21, 0xbb,
-0x22, 0x00, 0x23, 0x95, 0x26, 0x20, 0x27, 0x00, 0x28, 0xff,
-0x20, 0x05, 0x21, 0x00, 0x23, 0x84, 0x26, 0xb4, 0x27, 0x09,
-0x2a, 0x08, 0x10, 0x01, 0x3a, 0x00, 0x64, 0x3a, 0x65, 0xbb,
-0x08, 0x3a, 0x09, 0xbb, 0x50, 0x10, 0x52, 0x67, 0x51, 0x77,
-0x05, 0xa1, 0x18, 0x04, 0xff, 0xff
- };
-
-void sta013HWReset(void)
-{
- sbi(DDRD, 2); // set reset pin to output
- sbi(PORTD, 2); // clock RESET low
- cbi(PORTD, 2);
- timerPause(10);
- sbi(PORTD, 2);
-
- // give the sta013 a little time to come out of reset
- timerPause(50);
-}
-
-u08 sta013ReadReg(u08 reg)
-{
- u08 data;
- i2cReceive(STA_I2C_DEV, reg, 1, &data);
- return data;
-}
-
-void sta013WriteReg(u08 reg, u08 data)
-{
- i2cSend(STA_I2C_DEV, reg, 1, &data);
-}
-
-void sta013DownloadUpdate(void)
-{
- u16 i;
- u08 reg, data;
-
- i=0;
- // get first reg/data pair
- reg = pgm_read_byte(STA013_UpdateData + i++);
- data = pgm_read_byte(STA013_UpdateData + i++);
- // loop until end of update
- while( (reg != 0xff) )
- {
- sta013WriteReg(reg, data);
- reg = pgm_read_byte(STA013_UpdateData + i++);
- data = pgm_read_byte(STA013_UpdateData + i++);
- }
-}
-
-
-u08 sta013Init(void)
-{
- // reset STA013 device
- sta013HWReset();
-
- // identify STA013 device
- if(sta013ReadReg(STA_REG_IDENT) != STA_IDENT)
- {
- return FALSE;
- }
-
- // do firmware configuration and update
- sta013DownloadUpdate();
- // start decoder
- sta013StartDecoder();
-
- return TRUE;
-}
-
-
-void sta013StartDecoder(void)
-{
- // Soft reset
- sta013WriteReg(STA_REG_SOFT_RESET, 0x01);
- sta013WriteReg(STA_REG_SOFT_RESET, 0x00);
-
- // Mute and configure DAC output
- sta013WriteReg(STA_REG_MUTE, 0x01);
- sta013WriteReg(STA_REG_PCMDIVIDER, 0x01); // 32-bit mode, O_FAC = 256
- sta013WriteReg(STA_REG_PCMCONF, 0x31); // 18-bit mode & more
-
- // Configure PLL for MP3 rates
- sta013WriteReg(STA_REG_PLLFRAC_441_H, 0x67);
- sta013WriteReg(STA_REG_PLLFRAC_441_L, 0x77);
- sta013WriteReg(STA_REG_PLLFRAC_H, 0xbb);
- sta013WriteReg(STA_REG_PLLFRAC_L, 0x3a);
- sta013WriteReg(STA_REG_MFSDF_441, 0x10);
- sta013WriteReg(STA_REG_MFSDF, 0x0F);
-
- // Configure interface polarities, etc
- sta013WriteReg(STA_REG_PLLCTL_2, 0x0C);
- sta013WriteReg(STA_REG_PLLCTL_3, 0x00);
- sta013WriteReg(STA_REG_PLLCTL_1, 0xA1);
- sta013WriteReg(STA_REG_SCLK_POL, 0x00); // data sampled on rising edge
- sta013WriteReg(STA_REG_REQ_POL, 0x01); // REQ line active high
- sta013WriteReg(STA_REG_DATA_REQ_ENABLE, 0x04);
- sta013WriteReg(STA_REG_PLLCTL_1, 0xA1);
-
- // Set audio tone controls
- sta013SetTone(0, 0, 0, 0);
-
- // Unmute and start running
- sta013WriteReg(STA_REG_RUN, 0x01);
- sta013WriteReg(STA_REG_PLAY, 0x01);
- sta013WriteReg(STA_REG_MUTE, 0x00);
-}
-
-
-void sta013StopDecoder(void)
-{
- // mute output
- sta013WriteReg(STA_REG_MUTE, 0x01);
- // soft reset
- sta013WriteReg(STA_REG_SOFT_RESET, 0x01);
- sta013WriteReg(STA_REG_SOFT_RESET, 0x00);
-}
-
-
-void sta013PauseDecoder(void)
-{
- // enable mute
- sta013WriteReg(STA_REG_MUTE, 0x01);
- // stop the decoder
- sta013WriteReg(STA_REG_PLAY, 0x00);
-}
-
-
-void sta013ResumeDecoder(void)
-{
- // run the decoder
- sta013WriteReg(STA_REG_PLAY, 0x01);
- // disable mute
- sta013WriteReg(STA_REG_MUTE, 0x00);
-}
-
-void sta013GetMP3Info(u16 *bitrate, u08 *sampFreq, u08 *mode)
-{
- u08 headL, headM, headH;
- u08 mpegID, bitrateIndex, sampFreqIndex;
-
- // get the MP3 header info
- headH = sta013ReadReg(STA_REG_HEAD_H);
- headM = sta013ReadReg(STA_REG_HEAD_M);
- headL = sta013ReadReg(STA_REG_HEAD_L);
-
- // IDex:ID is in head[20:19]
- // 00 - MPEG2.5
- // 01 - reserved
- // 10 - MPEG2
- // 11 - MPEG1
- mpegID = (headH & 0x18)>>3;
-
- // sampling frequency is in head[11:10]
- sampFreqIndex = ((headM & 0x0C)>>2) | (mpegID<<2);
-
- // bitrate index is in head[15:12]
- bitrateIndex = ((headM & 0xF0)>>4) | ((mpegID & 0x01)<<4);
- //bitrateIndex = ((headM & 0xF0)>>4) | (1<<4);
-
- // mode is in head[7:6]
- // 00 - stereo
- // 01 - joint stereo
- // 10 - dual channel
- // 11 - single channel (mono)
- *mode = (headL & 0xC0)>>6;
-
- *bitrate = 2 * pgm_read_byte( MP3_Bitrates + bitrateIndex );
- *sampFreq = pgm_read_byte( MP3_SamplingFrequencies + sampFreqIndex );
-
-/*
- header = (unsigned long)sta013ReadReg(STA_REG_HEAD_H) << 16 |
- (unsigned long)sta013ReadReg(STA_REG_HEAD_M) << 8 |
- (unsigned long)sta013ReadReg(STA_REG_HEAD_L);
-
-// hdr->word = l;
-// hdr->emphasis = l & 0x03;
-// hdr->isOriginal = (l >> 2) & 0x01;
-// hdr->isCopyrighted = (l >> 3) & 0x01;
-// hdr->modeExtension = (l >> 4) & 0x03;
-// hdr->mode = (l >> 6) & 0x03;
-// hdr->private = (l >> 8) & 0x01;
-// hdr->padding = (l >> 9) & 0x01;
-// hdr->frequencyIndex = (l >> 10) & 0x03;
-// hdr->bitrateIndex = (l >> 12) & 0x0f;
-// hdr->protection = (l >> 16) & 0x01;
-// hdr->layer = (l >> 17) & 0x03;
-// hdr->ID = (l >> 19) & 0x01;
-// hdr->ID_ex = (l >> 20) & 0x01;
-*/
-}
-
-u16 sta013GetAverageBitrate(void)
-{
- return (2 * sta013ReadReg(STA_REG_AVERAGE_BITRATE));
-}
-
-void sta013SetVolume(u08 volume, s08 balance)
-{
- char attenL, attenR;
-
- // volume is expected as 0-100 value
- // Note:
- // #define MIN_VOLUME_ATTENUATION 0
- // #define MAX_VOLUME_ATTENUATION 96
-
- if( balance > 0)
- { // balance to the left, attenuate right
- attenL = (100 - volume);
- attenR = (100 - volume) - (balance);
- }
- else
- { // balance to the right, attenuate left
- attenL = (100 - volume) + (balance);
- attenR = (100 - volume);
- }
- // respect limits
- attenL = MIN(attenL,MAX_VOLUME_ATTENUATION);
- attenL = MAX(attenL,MIN_VOLUME_ATTENUATION);
- attenR = MIN(attenR,MAX_VOLUME_ATTENUATION);
- attenR = MAX(attenR,MIN_VOLUME_ATTENUATION);
-
- // set volume
- sta013WriteReg(STA_REG_DLA, attenL);
- sta013WriteReg(STA_REG_DLB, MAX_VOLUME_ATTENUATION);
- sta013WriteReg(STA_REG_DRA, attenR);
- sta013WriteReg(STA_REG_DRB, MAX_VOLUME_ATTENUATION);
-}
-
-
-void sta013SetTone(s08 bassEnh, u16 bassFreq, s08 trebleEnh, u16 trebleFreq)
-{
- // set bass enhancement
- sta013WriteReg(STA_REG_BASS_FREQUENCY_LOW, (bassFreq ) & 0xFF );
- sta013WriteReg(STA_REG_BASS_FREQUENCY_HIGH, (bassFreq>>8) & 0xFF );
- // respect limits
- bassEnh = MIN(bassEnh,MAX_BASS_ENHANCE);
- bassEnh = MAX(bassEnh,MIN_BASS_ENHANCE);
- sta013WriteReg(STA_REG_BASS_ENHANCE, bassEnh);
-
- // set treble enhancement
- sta013WriteReg(STA_REG_TREBLE_FREQUENCY_LOW, (trebleFreq ) & 0xFF );
- sta013WriteReg(STA_REG_TREBLE_FREQUENCY_HIGH, (trebleFreq>>8) & 0xFF );
- // respect limits
- trebleEnh = MIN(trebleEnh,MAX_TREBLE_ENHANCE);
- trebleEnh = MAX(trebleEnh,MIN_TREBLE_ENHANCE);
- sta013WriteReg(STA_REG_TREBLE_ENHANCE, trebleEnh);
-
- // set attentuation to avoid clipping
- sta013WriteReg( STA_REG_TONE_ATTEN, MAX(bassEnh,trebleEnh) );
-}
-
-u08 sta013Demand(void)
-{
- return bit_is_set(STA013_DEMAND_PORTIN,STA013_DEMAND_PIN);
-}
diff --git a/build/shared/lib/avrlib/sta013.h b/build/shared/lib/avrlib/sta013.h
deleted file mode 100755
index afd31b529..000000000
--- a/build/shared/lib/avrlib/sta013.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*! \file sta013.h \brief STMicroelectronics STA013 MP3 player driver. */
-//*****************************************************************************
-//
-// File Name : 'sta013.h'
-// Title : STMicroelectronics STA013 MP3 player driver
-// Author : Pascal Stang
-// Created : 10/22/2000
-// Revised : 12/04/2000
-// Version : 0.3
-// Target MCU : ATmega103 (should work for Atmel AVR Series)
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-
-#ifndef STA013_H
-#define STA013_H
-
-#include "global.h"
-
-// include project-dependent configuration
-#include "sta013conf.h"
-
-// STA013 I2C address
-#define STA_I2C_DEV 0x86
-#define STA_IDENT 0xAC
-
-// STA013 register (sub)address
-#define STA_REG_VERSION 0x00
-#define STA_REG_IDENT 0x01
-#define STA_REG_PLLCTL_1 0x05
-#define STA_REG_PLLCTL_2 0x06
-#define STA_REG_PLLCTL_3 0x07
-#define STA_REG_REQ_POL 0x0c
-#define STA_REG_SCLK_POL 0x0d
-#define STA_REG_ERROR_CODE 0x0f
-#define STA_REG_SOFT_RESET 0x10
-#define STA_REG_PLAY 0x13
-#define STA_REG_MUTE 0x14
-#define STA_REG_CMD_INTERRUPT 0x16
-#define STA_REG_DATA_REQ_ENABLE 0x18
-#define STA_REG_SYNCSTATUS 0x40
-#define STA_REG_ANCCOUNT_L 0x41
-#define STA_REG_ANCCOUNT_H 0x42
-#define STA_REG_HEAD_H 0x43
-#define STA_REG_HEAD_M 0x44
-#define STA_REG_HEAD_L 0x45
-#define STA_REG_DLA 0x46
-#define STA_REG_DLB 0x47
-#define STA_REG_DRA 0x48
-#define STA_REG_DRB 0x49
-#define STA_REG_MFSDF_441 0x50
-#define STA_REG_PLLFRAC_441_L 0x51
-#define STA_REG_PLLFRAC_441_H 0x52
-#define STA_REG_PCMDIVIDER 0x54
-#define STA_REG_PCMCONF 0x55
-#define STA_REG_PCMCROSS 0x56
-#define STA_REG_ANC_DATA_1 0x59
-#define STA_REG_ANC_DATA_2 0x5a
-#define STA_REG_ANC_DATA_3 0x5b
-#define STA_REG_ANC_DATA_4 0x5c
-#define STA_REG_ANC_DATA_5 0x5d
-#define STA_REG_MFSDF 0x61
-#define STA_REG_DAC_CLK_MODE 0x63
-#define STA_REG_PLLFRAC_L 0x64
-#define STA_REG_PLLFRAC_H 0x65
-#define STA_REG_FRAME_CNT_L 0x67
-#define STA_REG_FRAME_CNT_M 0x68
-#define STA_REG_FRAME_CNT_H 0x69
-#define STA_REG_AVERAGE_BITRATE 0x6a
-#define STA_REG_SOFTVERSION 0x71
-#define STA_REG_RUN 0x72
-#define STA_REG_TREBLE_FREQUENCY_LOW 0x77
-#define STA_REG_TREBLE_FREQUENCY_HIGH 0x78
-#define STA_REG_BASS_FREQUENCY_LOW 0x79
-#define STA_REG_BASS_FREQUENCY_HIGH 0x7a
-#define STA_REG_TREBLE_ENHANCE 0x7b
-#define STA_REG_BASS_ENHANCE 0x7c
-#define STA_REG_TONE_ATTEN 0x7d
-
-#define MIN_VOLUME_ATTENUATION 0
-#define MAX_VOLUME_ATTENUATION 96
-#define MIN_TONE_ATTENUATION 0
-#define MAX_TONE_ATTENUATION 96
-#define MIN_BASS_FREQUENCY 100
-#define MAX_BASS_FREQUENCY 500
-#define MIN_BASS_ENHANCE -12 // -18dB in 1.5 dB steps
-#define MAX_BASS_ENHANCE +12 // +18dB in 1.5 dB steps
-#define MIN_TREBLE_FREQUENCY 1000
-#define MAX_TREBLE_FREQUENCY 5000
-#define MIN_TREBLE_ENHANCE -12 // -18dB in 1.5 dB steps
-#define MAX_TREBLE_ENHANCE +12 // +18dB in 1.5 dB steps
-#define SOFTMUTE_VOLUME_CHANGE 20
-
-// global variables
-//u16 Sta013UpdateIndex;
-
-// prototypes
-void sta013HWReset(void);
-u08 sta013ReadReg(u08 reg);
-void sta013WriteReg(u08 reg, u08 data);
-void sta013DownloadUpdate(void);
-u08 sta013Init(void);
-
-void sta013StartDecoder(void);
-void sta013StopDecoder(void);
-void sta013PauseDecoder(void);
-void sta013ResumeDecoder(void);
-
-void sta013GetMP3Info(u16 *bitrate, u08 *sampFreq, u08 *mode);
-u16 sta013GetAverageBitrate(void);
-
-void sta013SetVolume(u08 volume, s08 balance);
-void sta013SetTone(s08 bassEnh, u16 bassFreq, s08 trebleEnh, u16 trebleFreq);
-
-
-u08 sta013Demand(void);
-
-#endif
diff --git a/build/shared/lib/avrlib/stxetx.c b/build/shared/lib/avrlib/stxetx.c
deleted file mode 100755
index 59789501c..000000000
--- a/build/shared/lib/avrlib/stxetx.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/*! \file stxetx.c \brief STX/ETX Packet Protocol Implementation Library. */
-//*****************************************************************************
-//
-// File Name : 'stxetx.c'
-// Title : STX/ETX Packet Protocol Implementation Library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 10/9/2002
-// Revised : 6/30/2003
-// Version : 0.1
-// Target MCU : any
-// Editor Tabs : 4
-//
-// Description : This library provides a set of functions needed to send and
-// receive STX/ETX packets. STX/ETX is a simple packet protocol that can
-// be wrapped around user data for one or more of the following reasons:
-//
-// 1. packetization is needed
-// - Using packets can be helpful if your data naturally forms
-// little "bunches" or if different types of data must be sent
-// over the same channel (a serial cable, for example). If your
-// data forms "bunches", you can send user data inside STX/ETX
-// packets with a predetermined structure, like an array of A/D
-// conversion results. If you need a way to tell the receiver
-// what kind of data you're sending, you can use the TYPE field
-// in the STX/ETX packet.
-// 2. error checking is needed
-// - STX/ETX packets will add a checksum to your data. This
-// allows the receiver to verify that data was received correctly
-// and is error-free. Packets which are corrupted in transmission
-// and fail the the checksum test are automatically discarded.
-// Error checking is especially useful when the data transmission
-// channel is unreliable or noisy (examples: radio, infrared, long
-// cables, etc)
-//
-// STX/ETX packets have the following structure:
-//
-// [STX][status][type][length][user data...][checksum][ETX]
-//
-// All fields are 1 byte except for user data which may be 0-255 bytes.
-// Uppercase fields are constant (STX=0x02, ETX=0x03), lowercase fields
-// vary. The length field is the number of bytes in the user data area.
-// The checksum is the 8-bit sum of all bytes between but not including
-// STX/ETX.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include "global.h"
-#include "stxetx.h"
-//#include "rprintf.h"
-
-// function pointer to data output routine
-static void (*stxetxDataOut)(unsigned char data);
-
-// received packet data buffer
-unsigned char stxetxRxPacket[STXETX_MAXRXPACKETSIZE];
-
-// functions
-
-
-// Initialize STX/ETX packet protocol library
-void stxetxInit(void (*dataout_func)(unsigned char data))
-{
- stxetxDataOut = dataout_func;
-}
-
-// Send/Create STX/ETX packet
-void stxetxSend(unsigned char status, unsigned char type, unsigned char datalength, unsigned char* dataptr)
-{
- unsigned char checksum = 0;
- unsigned short i;
-
- // write packet header
- stxetxDataOut(STX);
- stxetxDataOut(status);
- stxetxDataOut(type);
- stxetxDataOut(datalength);
- // update checksum
- checksum += status + type + datalength;
- // copy data into packet
- for(i = 0; i < datalength; i++)
- {
- stxetxDataOut(*dataptr);
- checksum += *dataptr;
- dataptr++;
- }
- // write packet trailer
- stxetxDataOut(checksum);
- stxetxDataOut(ETX);
-}
-
-// process buffer containing STX/ETX packets
-unsigned char stxetxProcess(cBuffer* rxBuffer)
-{
- unsigned char foundpacket = FALSE;
- unsigned short i;
- unsigned char length, checksum;
- //unsigned char type;
-
- // process the buffer
- // go through buffer looking for packets
- // the STX must be located at least STXETX_HEADERLENGTH+STXETX_TRAILERLENGTH from end
- // otherwise we must not have a complete packet
- while( rxBuffer->datalength >= ((u16)STXETX_HEADERLENGTH+(u16)STXETX_TRAILERLENGTH) )
- {
- // look for a potential start of packet
- if(bufferGetAtIndex(rxBuffer, 0) == STX)
- {
- // if this is a start, then get the length
- length = bufferGetAtIndex(rxBuffer, STXETX_LENGTHOFFSET);
-
- // now we must have at least STXETX_HEADERLENGTH+length+STXETX_TRAILERLENGTH in buffer to continue
- if(rxBuffer->datalength >= ((u16)STXETX_HEADERLENGTH+length+(u16)STXETX_TRAILERLENGTH))
- {
- // check to see if ETX is in the right position
- if(bufferGetAtIndex(rxBuffer, STXETX_HEADERLENGTH+length+STXETX_TRAILERLENGTH-1) == ETX)
- {
- // found potential packet
- // test checksum
- checksum = 0;
- // sum data between STX and ETX, not including checksum itself
- // (u16) casting needed to avoid unsigned/signed mismatch
- for(i = 0; i<((u16)STXETX_HEADERLENGTH+length+(u16)STXETX_TRAILERLENGTH-(u16)STXETX_NOETXSTXCHECKSUM); i++)
- {
- checksum += bufferGetAtIndex(rxBuffer, i+STXETX_STATUSOFFSET);
- }
- // compare checksums
- if(checksum == bufferGetAtIndex(rxBuffer, STXETX_CHECKSUMOFFSET+length))
- {
- //we have a packet!
- foundpacket = TRUE;
-
- // copy data to buffer
- // (don't copy STX, ETX, or CHECKSUM)
- for(i = 0; i < ((u16)STXETX_HEADERLENGTH+length-1); i++)
- {
- stxetxRxPacket[i] = bufferGetAtIndex(rxBuffer, i+1);
- }
-
- // debug
- //rprintf("STXETX Received packet type: 0x%x\n", bufferGetAtIndex(rxBuffer, STXETX_TYPEOFFSET));
-
- // dump this packet from the
- bufferDumpFromFront(rxBuffer, STXETX_HEADERLENGTH+length+STXETX_TRAILERLENGTH);
-
- // done with this processing session
- break;
- }
- else
- {
- // checksum bad
- //rprintf("STXETX Received packet with bad checksum\r\n");
- // for now, we dump these
- // dump this STX
- bufferGetFromFront(rxBuffer);
- }
- }
- else
- {
- // no ETX or ETX in wrong position
- // dump this STX
- bufferGetFromFront(rxBuffer);
- }
- }
- else
- {
- // not enough data in buffer to decode pending packet
- // wait until next time
- break;
- }
- }
- else
- {
- // this is not a start, dump it
- bufferGetFromFront(rxBuffer);
- }
- }
-
- // check if receive buffer is full with no packets decoding
- // (ie. deadlocked on garbage data or packet that exceeds buffer size)
- if(!bufferIsNotFull(rxBuffer))
- {
- // dump receive buffer contents to relieve deadlock
- bufferFlush(rxBuffer);
- }
-
- return foundpacket;
-}
-
-unsigned char stxetxGetRxPacketStatus(void)
-{
- // return the packet's status
- // (subtract 1 from the offset because the STX has already been discarded)
- return stxetxRxPacket[STXETX_STATUSOFFSET-1];
-}
-
-unsigned char stxetxGetRxPacketType(void)
-{
- // return the packet's type
- // (subtract 1 from the offset because the STX has already been discarded)
- return stxetxRxPacket[STXETX_TYPEOFFSET-1];
-}
-
-unsigned char stxetxGetRxPacketDatalength(void)
-{
- // return the packet's datalength
- // (subtract 1 from the offset because the STX has already been discarded)
- return stxetxRxPacket[STXETX_LENGTHOFFSET-1];
-}
-
-unsigned char* stxetxGetRxPacketData(void)
-{
- // return a pointer to the packet's data payload
- // (subtract 1 from the offset because the STX has already been discarded)
- return stxetxRxPacket+STXETX_DATAOFFSET-1;
-}
diff --git a/build/shared/lib/avrlib/stxetx.h b/build/shared/lib/avrlib/stxetx.h
deleted file mode 100755
index cb27337bc..000000000
--- a/build/shared/lib/avrlib/stxetx.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*! \file stxetx.h \brief STX/ETX Packet Protocol Implementation Library. */
-//*****************************************************************************
-//
-// File Name : 'stxetx.h'
-// Title : STX/ETX Packet Protocol Implementation Library
-// Author : Pascal Stang - Copyright (C) 2002-2003
-// Created : 10/9/2002
-// Revised : 02/10/2003
-// Version : 0.1
-// Target MCU : any
-// Editor Tabs : 4
-//
-// Description : This library provides a set of functions needed to send and
-// receive STX/ETX packets. STX/ETX is a simple packet protocol that can
-// be wrapped around user data for one or more of the following reasons:
-//
-// 1. packetization is needed
-// - Using packets can be helpful if your data naturally forms
-// little "bunches" or if different types of data must be sent
-// over the same channel (a serial cable, for example). If your
-// data forms "bunches", you can send user data inside STX/ETX
-// packets with a predetermined structure, like an array of A/D
-// conversion results. If you need a way to tell the receiver
-// what kind of data you're sending, you can use the TYPE field
-// in the STX/ETX packet.
-// 2. error checking is needed
-// - STX/ETX packets will add a checksum to your data. This
-// allows the receiver to verify that data was received correctly
-// and is error-free. Packets which are corrupted in transmission
-// and fail the the checksum test are automatically discarded.
-// Error checking is especially useful when the data transmission
-// channel is unreliable or noisy (examples: radio, infrared, long
-// cables, etc)
-//
-// STX/ETX packets have the following structure:
-//
-// [STX][status][type][length][user data...][checksum][ETX]
-//
-// All fields are 1 byte except for user data which may be 0-255 bytes.
-// Uppercase fields are constant (STX=0x02, ETX=0x03), lowercase fields
-// vary. The length field is the number of bytes in the user data area.
-// The checksum is the 8-bit sum of all bytes between but not including
-// STX/ETX.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef STXETX_H
-#define STXETX_H
-
-#include "buffer.h"
-
-// include project-dependent configuration options
-#include "stxetxconf.h"
-
-// constants
-// packet markers
-#define STX 0x02 // start transmission marker
-#define ETX 0x03 // end transmission marker
-// packet length parameters
-#define STXETX_HEADERLENGTH 4 // number of bytes required for packet header
-#define STXETX_TRAILERLENGTH 2 // number of bytes required for packet trailer
-// packet field offsets
-#define STXETX_STATUSOFFSET 1 // number of bytes from STX to STATUS
-#define STXETX_TYPEOFFSET 2 // number of bytes from STX to TYPE
-#define STXETX_LENGTHOFFSET 3 // number of bytes from STX to LENGTH
-#define STXETX_DATAOFFSET 4 // number of bytes from STX to the data
-#define STXETX_CHECKSUMOFFSET 4 // number of bytes from STX+[length] to CHECKSUM
-#define STXETX_NOETXSTXCHECKSUM 3 // number of bytes used by STX,ETX,CHECKSUM
-
-
-// function prototypes
-
-//! Initialize STX/ETX packet protocol library
-void stxetxInit(void (*dataout_func)(unsigned char data));
-
-//! Send/Create STX/ETX packet
-void stxetxSend(unsigned char status, unsigned char type, unsigned char datalength, unsigned char* dataptr);
-
-//! Process a buffer containing STX/ETX packets
-unsigned char stxetxProcess(cBuffer* rxBuffer);
-
-//! Returns the received packet's status
-unsigned char stxetxGetRxPacketStatus(void);
-
-//! Returns the received packet's type
-unsigned char stxetxGetRxPacketType(void);
-
-//! Returns the received packet's datalength
-unsigned char stxetxGetRxPacketDatalength(void);
-
-//! Returns pointer to the received packet's data
-unsigned char* stxetxGetRxPacketData(void);
-
-
-#endif
diff --git a/build/shared/lib/avrlib/timer.c b/build/shared/lib/avrlib/timer.c
deleted file mode 100755
index 3258f338c..000000000
--- a/build/shared/lib/avrlib/timer.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/*! \file timer.c \brief System Timer function library. */
-//*****************************************************************************
-//
-// File Name : 'timer.c'
-// Title : System Timer function library
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 11/22/2000
-// Revised : 07/09/2003
-// Version : 1.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
- #include
- #include
- #include
- #include
- #include
-#endif
-
-#include "global.h"
-#include "timer.h"
-
-#include "rprintf.h"
-
-// Program ROM constants
-// the prescale division values stored in order of timer control register index
-// STOP, CLK, CLK/8, CLK/64, CLK/256, CLK/1024
-unsigned short __attribute__ ((progmem)) TimerPrescaleFactor[] = {0,1,8,64,256,1024};
-// the prescale division values stored in order of timer control register index
-// STOP, CLK, CLK/8, CLK/32, CLK/64, CLK/128, CLK/256, CLK/1024
-unsigned short __attribute__ ((progmem)) TimerRTCPrescaleFactor[] = {0,1,8,32,64,128,256,1024};
-
-// Global variables
-// time registers
-volatile unsigned long TimerPauseReg;
-volatile unsigned long Timer0Reg0;
-volatile unsigned long Timer2Reg0;
-
-typedef void (*voidFuncPtr)(void);
-volatile static voidFuncPtr TimerIntFunc[TIMER_NUM_INTERRUPTS];
-
-// delay for a minimum of microseconds
-// the time resolution is dependent on the time the loop takes
-// e.g. with 4Mhz and 5 cycles per loop, the resolution is 1.25 us
-void delay_us(unsigned short time_us)
-{
- unsigned short delay_loops;
- register unsigned short i;
-
- delay_loops = (time_us+3)/5*CYCLES_PER_US; // +3 for rounding up (dirty)
-
- // one loop takes 5 cpu cycles
- for (i=0; i < delay_loops; i++) {};
-}
-/*
-void delay_ms(unsigned char time_ms)
-{
- unsigned short delay_count = F_CPU / 4000;
-
- unsigned short cnt;
- asm volatile ("\n"
- "L_dl1%=:\n\t"
- "mov %A0, %A2\n\t"
- "mov %B0, %B2\n"
- "L_dl2%=:\n\t"
- "sbiw %A0, 1\n\t"
- "brne L_dl2%=\n\t"
- "dec %1\n\t" "brne L_dl1%=\n\t":"=&w" (cnt)
- :"r"(time_ms), "r"((unsigned short) (delay_count))
- );
-}
-*/
-void timerInit(void)
-{
- u08 intNum;
- // detach all user functions from interrupts
- for(intNum=0; intNum number of milliseconds
- u08 timerThres;
- u32 ticRateHz;
- u32 pause;
-
- // capture current pause timer value
- timerThres = inb(TCNT0);
- // reset pause timer overflow count
- TimerPauseReg = 0;
- // calculate delay for [pause_ms] milliseconds
- // prescaler division = 1<<(pgm_read_byte(TimerPrescaleFactor+inb(TCCR0)))
- ticRateHz = F_CPU/timer0GetPrescaler();
- // precision management
- // prevent overflow and precision underflow
- // -could add more conditions to improve accuracy
- if( ((ticRateHz < 429497) && (pause_ms <= 10000)) )
- pause = (pause_ms*ticRateHz)/1000;
- else
- pause = pause_ms*(ticRateHz/1000);
-
- // loop until time expires
- while( ((TimerPauseReg<<8) | inb(TCNT0)) < (pause+timerThres) )
- {
- if( TimerPauseReg < (pause>>8));
- {
- // save power by idling the processor
- set_sleep_mode(SLEEP_MODE_IDLE);
- sleep_mode();
- }
- }
-
- /* old inaccurate code, for reference
-
- // calculate delay for [pause_ms] milliseconds
- u16 prescaleDiv = 1<<(pgm_read_byte(TimerPrescaleFactor+inb(TCCR0)));
- u32 pause = (pause_ms*(F_CPU/(prescaleDiv*256)))/1000;
-
- TimerPauseReg = 0;
- while(TimerPauseReg < pause);
-
- */
-}
-
-void timer0ClearOverflowCount(void)
-{
- // clear the timer overflow counter registers
- Timer0Reg0 = 0; // initialize time registers
-}
-
-long timer0GetOverflowCount(void)
-{
- // return the current timer overflow count
- // (this is since the last timer0ClearOverflowCount() command was called)
- return Timer0Reg0;
-}
-
-#ifdef TCNT2 // support timer2 only if it exists
-void timer2ClearOverflowCount(void)
-{
- // clear the timer overflow counter registers
- Timer2Reg0 = 0; // initialize time registers
-}
-
-long timer2GetOverflowCount(void)
-{
- // return the current timer overflow count
- // (this is since the last timer2ClearOverflowCount() command was called)
- return Timer2Reg0;
-}
-#endif
-
-void timer1PWMInit(u08 bitRes)
-{
- // configures timer1 for use with PWM output
- // on OC1A and OC1B pins
-
- // enable timer1 as 8,9,10bit PWM
- if(bitRes == 9)
- { // 9bit mode
- sbi(TCCR1A,PWM11);
- cbi(TCCR1A,PWM10);
- }
- else if( bitRes == 10 )
- { // 10bit mode
- sbi(TCCR1A,PWM11);
- sbi(TCCR1A,PWM10);
- }
- else
- { // default 8bit mode
- cbi(TCCR1A,PWM11);
- sbi(TCCR1A,PWM10);
- }
-
- // clear output compare value A
- outb(OCR1AH, 0);
- outb(OCR1AL, 0);
- // clear output compare value B
- outb(OCR1BH, 0);
- outb(OCR1BL, 0);
-}
-
-#ifdef WGM10
-// include support for arbitrary top-count PWM
-// on new AVR processors that support it
-void timer1PWMInitICR(u16 topcount)
-{
- // set PWM mode with ICR top-count
- cbi(TCCR1A,WGM10);
- sbi(TCCR1A,WGM11);
- sbi(TCCR1B,WGM12);
- sbi(TCCR1B,WGM13);
-
- // set top count value
- ICR1 = topcount;
-
- // clear output compare value A
- OCR1A = 0;
- // clear output compare value B
- OCR1B = 0;
-
-}
-#endif
-
-void timer1PWMOff(void)
-{
- // turn off timer1 PWM mode
- cbi(TCCR1A,PWM11);
- cbi(TCCR1A,PWM10);
- // set PWM1A/B (OutputCompare action) to none
- timer1PWMAOff();
- timer1PWMBOff();
-}
-
-void timer1PWMAOn(void)
-{
- // turn on channel A (OC1A) PWM output
- // set OC1A as non-inverted PWM
- sbi(TCCR1A,COM1A1);
- cbi(TCCR1A,COM1A0);
-}
-
-void timer1PWMBOn(void)
-{
- // turn on channel B (OC1B) PWM output
- // set OC1B as non-inverted PWM
- sbi(TCCR1A,COM1B1);
- cbi(TCCR1A,COM1B0);
-}
-
-void timer1PWMAOff(void)
-{
- // turn off channel A (OC1A) PWM output
- // set OC1A (OutputCompare action) to none
- cbi(TCCR1A,COM1A1);
- cbi(TCCR1A,COM1A0);
-}
-
-void timer1PWMBOff(void)
-{
- // turn off channel B (OC1B) PWM output
- // set OC1B (OutputCompare action) to none
- cbi(TCCR1A,COM1B1);
- cbi(TCCR1A,COM1B0);
-}
-
-void timer1PWMASet(u16 pwmDuty)
-{
- // set PWM (output compare) duty for channel A
- // this PWM output is generated on OC1A pin
- // NOTE: pwmDuty should be in the range 0-255 for 8bit PWM
- // pwmDuty should be in the range 0-511 for 9bit PWM
- // pwmDuty should be in the range 0-1023 for 10bit PWM
- //outp( (pwmDuty>>8), OCR1AH); // set the high 8bits of OCR1A
- //outp( (pwmDuty&0x00FF), OCR1AL); // set the low 8bits of OCR1A
- OCR1A = pwmDuty;
-}
-
-void timer1PWMBSet(u16 pwmDuty)
-{
- // set PWM (output compare) duty for channel B
- // this PWM output is generated on OC1B pin
- // NOTE: pwmDuty should be in the range 0-255 for 8bit PWM
- // pwmDuty should be in the range 0-511 for 9bit PWM
- // pwmDuty should be in the range 0-1023 for 10bit PWM
- //outp( (pwmDuty>>8), OCR1BH); // set the high 8bits of OCR1B
- //outp( (pwmDuty&0x00FF), OCR1BL); // set the low 8bits of OCR1B
- OCR1B = pwmDuty;
-}
-
-//! Interrupt handler for tcnt0 overflow interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW0)
-{
- Timer0Reg0++; // increment low-order counter
-
- // increment pause counter
- TimerPauseReg++;
-
- // if a user function is defined, execute it too
- if(TimerIntFunc[TIMER0OVERFLOW_INT])
- TimerIntFunc[TIMER0OVERFLOW_INT]();
-}
-
-//! Interrupt handler for tcnt1 overflow interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW1)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER1OVERFLOW_INT])
- TimerIntFunc[TIMER1OVERFLOW_INT]();
-}
-
-#ifdef TCNT2 // support timer2 only if it exists
-//! Interrupt handler for tcnt2 overflow interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW2)
-{
- Timer2Reg0++; // increment low-order counter
-
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER2OVERFLOW_INT])
- TimerIntFunc[TIMER2OVERFLOW_INT]();
-}
-#endif
-
-#ifdef OCR0
-// include support for Output Compare 0 for new AVR processors that support it
-//! Interrupt handler for OutputCompare0 match (OC0) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE0)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER0OUTCOMPARE_INT])
- TimerIntFunc[TIMER0OUTCOMPARE_INT]();
-}
-#endif
-
-//! Interrupt handler for CutputCompare1A match (OC1A) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1A)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER1OUTCOMPAREA_INT])
- TimerIntFunc[TIMER1OUTCOMPAREA_INT]();
-}
-
-//! Interrupt handler for OutputCompare1B match (OC1B) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1B)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER1OUTCOMPAREB_INT])
- TimerIntFunc[TIMER1OUTCOMPAREB_INT]();
-}
-
-//! Interrupt handler for InputCapture1 (IC1) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_INPUT_CAPTURE1)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER1INPUTCAPTURE_INT])
- TimerIntFunc[TIMER1INPUTCAPTURE_INT]();
-}
-
-//! Interrupt handler for OutputCompare2 match (OC2) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE2)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER2OUTCOMPARE_INT])
- TimerIntFunc[TIMER2OUTCOMPARE_INT]();
-}
diff --git a/build/shared/lib/avrlib/timer.h b/build/shared/lib/avrlib/timer.h
deleted file mode 100755
index ed5c59964..000000000
--- a/build/shared/lib/avrlib/timer.h
+++ /dev/null
@@ -1,278 +0,0 @@
-/*! \file timer.h \brief System Timer function library. */
-//*****************************************************************************
-//
-// File Name : 'timer.h'
-// Title : System Timer function library
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 11/22/2000
-// Revised : 02/10/2003
-// Version : 1.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//
-// Notes: The Atmel AVR Series Processors each contain at least one
-// hardware timer/counter. Many of the processors contain 2 or 3
-// timers. Generally speaking, a timer is a hardware counter inside
-// the processor which counts at a rate related to the main CPU clock
-// frequency. Because the counter value increasing (counting up) at
-// a precise rate, we can use it as a timer to create or measure
-// precise delays, schedule events, or generate signals of a certain
-// frequency or pulse-width.
-// As an example, the ATmega163 processor has 3 timer/counters.
-// Timer0, Timer1, and Timer2 are 8, 16, and 8 bits wide respectively.
-// This means that they overflow, or roll over back to zero, at a
-// count value of 256 for 8bits or 65536 for 16bits. A prescaler is
-// avaiable for each timer, and the prescaler allows you to pre-divide
-// the main CPU clock rate down to a slower speed before feeding it to
-// the counting input of a timer. For example, if the CPU clock
-// frequency is 3.69MHz, and Timer0's prescaler is set to divide-by-8,
-// then Timer0 will "tic" at 3690000/8 = 461250Hz. Because Timer0 is
-// an 8bit timer, it will count to 256 in just 256/461250Hz = 0.555ms.
-// In fact, when it hits 255, it will overflow and start again at
-// zero. In this case, Timer0 will overflow 461250/256 = 1801.76
-// times per second.
-// Timer0 can be used a number of ways simultaneously. First, the
-// value of the timer can be read by accessing the CPU register TCNT0.
-// We could, for example, figure out how long it takes to execute a
-// C command by recording the value of TCNT0 before and after
-// execution, then subtract (after-before) = time elapsed. Or we can
-// enable the overflow interrupt which goes off every time T0
-// overflows and count out longer delays (multiple overflows), or
-// execute a special periodic function at every overflow.
-// The other timers (Timer1 and Timer2) offer all the abilities of
-// Timer0 and many more features. Both T1 and T2 can operate as
-// general-purpose timers, but T1 has special hardware allowing it to
-// generate PWM signals, while T2 is specially designed to help count
-// out real time (like hours, minutes, seconds). See the
-// Timer/Counter section of the processor datasheet for more info.
-//
-//*****************************************************************************
-
-#ifndef TIMER_H
-#define TIMER_H
-
-#include "global.h"
-
-// constants/macros/typdefs
-
-// processor compatibility fixes
-#ifdef __AVR_ATmega323__
- // redefinition for the Mega323
- #define CTC1 CTC10
-#endif
-#ifndef PWM10
- // mega128 PWM bits
- #define PWM10 WGM10
- #define PWM11 WGM11
-#endif
-
-// Timer/clock prescaler values and timer overflow rates
-// tics = rate at which the timer counts up
-// 8bitoverflow = rate at which the timer overflows 8bits (or reaches 256)
-// 16bit [overflow] = rate at which the timer overflows 16bits (65536)
-//
-// overflows can be used to generate periodic interrupts
-//
-// for 8MHz crystal
-// 0 = STOP (Timer not counting)
-// 1 = CLOCK tics= 8MHz 8bitoverflow= 31250Hz 16bit= 122.070Hz
-// 2 = CLOCK/8 tics= 1MHz 8bitoverflow= 3906.25Hz 16bit= 15.259Hz
-// 3 = CLOCK/64 tics= 125kHz 8bitoverflow= 488.28Hz 16bit= 1.907Hz
-// 4 = CLOCK/256 tics= 31250Hz 8bitoverflow= 122.07Hz 16bit= 0.477Hz
-// 5 = CLOCK/1024 tics= 7812.5Hz 8bitoverflow= 30.52Hz 16bit= 0.119Hz
-// 6 = External Clock on T(x) pin (falling edge)
-// 7 = External Clock on T(x) pin (rising edge)
-
-// for 4MHz crystal
-// 0 = STOP (Timer not counting)
-// 1 = CLOCK tics= 4MHz 8bitoverflow= 15625Hz 16bit= 61.035Hz
-// 2 = CLOCK/8 tics= 500kHz 8bitoverflow= 1953.125Hz 16bit= 7.629Hz
-// 3 = CLOCK/64 tics= 62500Hz 8bitoverflow= 244.141Hz 16bit= 0.954Hz
-// 4 = CLOCK/256 tics= 15625Hz 8bitoverflow= 61.035Hz 16bit= 0.238Hz
-// 5 = CLOCK/1024 tics= 3906.25Hz 8bitoverflow= 15.259Hz 16bit= 0.060Hz
-// 6 = External Clock on T(x) pin (falling edge)
-// 7 = External Clock on T(x) pin (rising edge)
-
-// for 3.69MHz crystal
-// 0 = STOP (Timer not counting)
-// 1 = CLOCK tics= 3.69MHz 8bitoverflow= 14414Hz 16bit= 56.304Hz
-// 2 = CLOCK/8 tics= 461250Hz 8bitoverflow= 1801.758Hz 16bit= 7.038Hz
-// 3 = CLOCK/64 tics= 57625.25Hz 8bitoverflow= 225.220Hz 16bit= 0.880Hz
-// 4 = CLOCK/256 tics= 14414.063Hz 8bitoverflow= 56.305Hz 16bit= 0.220Hz
-// 5 = CLOCK/1024 tics= 3603.516Hz 8bitoverflow= 14.076Hz 16bit= 0.055Hz
-// 6 = External Clock on T(x) pin (falling edge)
-// 7 = External Clock on T(x) pin (rising edge)
-
-// for 32.768KHz crystal on timer 2 (use for real-time clock)
-// 0 = STOP
-// 1 = CLOCK tics= 32.768kHz 8bitoverflow= 128Hz
-// 2 = CLOCK/8 tics= 4096kHz 8bitoverflow= 16Hz
-// 3 = CLOCK/32 tics= 1024kHz 8bitoverflow= 4Hz
-// 4 = CLOCK/64 tics= 512Hz 8bitoverflow= 2Hz
-// 5 = CLOCK/128 tics= 256Hz 8bitoverflow= 1Hz
-// 6 = CLOCK/256 tics= 128Hz 8bitoverflow= 0.5Hz
-// 7 = CLOCK/1024 tics= 32Hz 8bitoverflow= 0.125Hz
-
-#define TIMER_CLK_STOP 0x00 ///< Timer Stopped
-#define TIMER_CLK_DIV1 0x01 ///< Timer clocked at F_CPU
-#define TIMER_CLK_DIV8 0x02 ///< Timer clocked at F_CPU/8
-#define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64
-#define TIMER_CLK_DIV256 0x04 ///< Timer clocked at F_CPU/256
-#define TIMER_CLK_DIV1024 0x05 ///< Timer clocked at F_CPU/1024
-#define TIMER_CLK_T_FALL 0x06 ///< Timer clocked at T falling edge
-#define TIMER_CLK_T_RISE 0x07 ///< Timer clocked at T rising edge
-#define TIMER_PRESCALE_MASK 0x07 ///< Timer Prescaler Bit-Mask
-
-#define TIMERRTC_CLK_STOP 0x00 ///< RTC Timer Stopped
-#define TIMERRTC_CLK_DIV1 0x01 ///< RTC Timer clocked at F_CPU
-#define TIMERRTC_CLK_DIV8 0x02 ///< RTC Timer clocked at F_CPU/8
-#define TIMERRTC_CLK_DIV32 0x03 ///< RTC Timer clocked at F_CPU/32
-#define TIMERRTC_CLK_DIV64 0x04 ///< RTC Timer clocked at F_CPU/64
-#define TIMERRTC_CLK_DIV128 0x05 ///< RTC Timer clocked at F_CPU/128
-#define TIMERRTC_CLK_DIV256 0x06 ///< RTC Timer clocked at F_CPU/256
-#define TIMERRTC_CLK_DIV1024 0x07 ///< RTC Timer clocked at F_CPU/1024
-#define TIMERRTC_PRESCALE_MASK 0x07 ///< RTC Timer Prescaler Bit-Mask
-
-// default prescale settings for the timers
-// these settings are applied when you call
-// timerInit or any of the timerInit
-#define TIMER0PRESCALE TIMER_CLK_DIV8 ///< timer 0 prescaler default
-#define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default
-#define TIMER2PRESCALE TIMERRTC_CLK_DIV64 ///< timer 2 prescaler default
-
-// interrupt macros for attaching user functions to timer interrupts
-// use these with timerAttach( intNum, function )
-#define TIMER0OVERFLOW_INT 0
-#define TIMER1OVERFLOW_INT 1
-#define TIMER1OUTCOMPAREA_INT 2
-#define TIMER1OUTCOMPAREB_INT 3
-#define TIMER1INPUTCAPTURE_INT 4
-#define TIMER2OVERFLOW_INT 5
-#define TIMER2OUTCOMPARE_INT 6
-#ifdef OCR0 // for processors that support output compare on Timer0
-#define TIMER0OUTCOMPARE_INT 7
-#define TIMER_NUM_INTERRUPTS 8
-#else
-#define TIMER_NUM_INTERRUPTS 7
-#endif
-
-// default type of interrupt handler to use for timers
-// *do not change unless you know what you're doing
-// Value may be SIGNAL or INTERRUPT
-#ifndef TIMER_INTERRUPT_HANDLER
-#define TIMER_INTERRUPT_HANDLER SIGNAL
-#endif
-
-// functions
-#define delay delay_us
-#define delay_ms timerPause
-void delay_us(unsigned short time_us);
-
-//! initializes timing system (all timers)
-// runs all timer init functions
-// sets all timers to default prescale values #defined in systimer.c
-void timerInit(void);
-
-// default initialization routines for each timer
-void timer0Init(void); ///< initialize timer0
-void timer1Init(void); ///< initialize timer1
-#ifdef TCNT2 // support timer2 only if it exists
-void timer2Init(void); ///< initialize timer2
-#endif
-
-// Clock prescaler set/get commands for each timer/counter
-// For setting the prescaler, you should use one of the #defines
-// above like TIMER_CLK_DIVx, where [x] is the division rate
-// you want.
-// When getting the current prescaler setting, the return value
-// will be the [x] division value currently set.
-void timer0SetPrescaler(u08 prescale); ///< set timer0 prescaler
-u16 timer0GetPrescaler(void); ///< get timer0 prescaler
-void timer1SetPrescaler(u08 prescale); ///< set timer1 prescaler
-u16 timer1GetPrescaler(void); ///< get timer0 prescaler
-#ifdef TCNT2 // support timer2 only if it exists
-void timer2SetPrescaler(u08 prescale); ///< set timer2 prescaler
-u16 timer2GetPrescaler(void); ///< get timer2 prescaler
-#endif
-
-
-// TimerAttach and Detach commands
-// These functions allow the attachment (or detachment) of any user function
-// to a timer interrupt. "Attaching" one of your own functions to a timer
-// interrupt means that it will be called whenever that interrupt happens.
-// Using attach is better than rewriting the actual INTERRUPT() function
-// because your code will still work and be compatible if the timer library
-// is updated. Also, using Attach allows your code and any predefined timer
-// code to work together and at the same time. (ie. "attaching" your own
-// function to the timer0 overflow doesn't prevent timerPause from working,
-// but rather allows you to share the interrupt.)
-//
-// timerAttach(TIMER1OVERFLOW_INT, myOverflowFunction);
-// timerDetach(TIMER1OVERFLOW_INT)
-//
-// timerAttach causes the myOverflowFunction() to be attached, and therefore
-// execute, whenever an overflow on timer1 occurs. timerDetach removes the
-// association and executes no user function when the interrupt occurs.
-// myOverflowFunction must be defined with no return value and no arguments:
-//
-// void myOverflowFunction(void) { ... }
-
-//! Attach a user function to a timer interrupt
-void timerAttach(u08 interruptNum, void (*userFunc)(void) );
-//! Detach a user function from a timer interrupt
-void timerDetach(u08 interruptNum);
-
-
-// timing commands
-//! timerPause pauses for the number of milliseconds specified in
-void timerPause(unsigned short pause_ms);
-
-// overflow counters
-void timer0ClearOverflowCount(void); ///< clear timer0's overflow counter
-long timer0GetOverflowCount(void); ///< read timer0's overflow counter
-#ifdef TCNT2 // support timer2 only if it exists
-void timer2ClearOverflowCount(void); ///< clear timer2's overflow counter
-long timer2GetOverflowCount(void); ///< read timer0's overflow counter
-#endif
-
-// PWM initialization and set commands for timer1
-// timer1PWMInit()
-// configures the timer1 hardware for PWM mode on pins OC1A and OC1B.
-// bitRes should be 8,9,or 10 for 8,9,or 10bit PWM resolution
-//
-// timer1PWMOff()
-// turns off all timer1 PWM output and set timer mode to normal state
-//
-// timer1PWMAOn() and timer1PWMBOn()
-// turn on output of PWM signals to OC1A or OC1B pins
-// NOTE: Until you define the OC1A and OC1B pins as outputs, and run
-// this "on" command, no PWM output will be output
-//
-// timer1PWMAOff() and timer1PWMBOff()
-// turn off output of PWM signals to OC1A or OC1B pins
-//
-// timer1PWMASet() and timer1PWMBSet()
-// sets the PWM duty cycle for each channel
-// NOTE: should be in the range 0-255 for 8bit PWM
-// should be in the range 0-511 for 9bit PWM
-// should be in the range 0-1023 for 10bit PWM
-// NOTE: the PWM frequency can be controlled in increments by setting the
-// prescaler for timer1
-
-void timer1PWMInit(u08 bitRes); ///< initialize and set timer1 mode to PWM
-void timer1PWMInitICR(u16 topcount);///< initialize and set timer1 mode to PWM with specific top count
-void timer1PWMOff(void); ///< turn off all timer1 PWM output and set timer mode to normal
-void timer1PWMAOn(void); ///< turn on timer1 Channel A (OC1A) PWM output
-void timer1PWMBOn(void); ///< turn on timer1 Channel B (OC1B) PWM output
-void timer1PWMAOff(void); ///< turn off timer1 Channel A (OC1A) PWM output
-void timer1PWMBOff(void); ///< turn off timer1 Channel B (OC1B) PWM output
-void timer1PWMASet(u16 pwmDuty); ///< set duty of timer1 Channel A (OC1A) PWM output
-void timer1PWMBSet(u16 pwmDuty); ///< set duty of timer1 Channel B (OC1B) PWM output
-
-// Pulse generation commands have been moved to the pulse.c library
-
-#endif
diff --git a/build/shared/lib/avrlib/timer.lst b/build/shared/lib/avrlib/timer.lst
deleted file mode 100755
index 4d8b76fd8..000000000
--- a/build/shared/lib/avrlib/timer.lst
+++ /dev/null
@@ -1,1709 +0,0 @@
- 1 .file "timer.c"
- 2 .arch atmega8
- 3 __SREG__ = 0x3f
- 4 __SP_H__ = 0x3e
- 5 __SP_L__ = 0x3d
- 6 __tmp_reg__ = 0
- 7 __zero_reg__ = 1
- 8 .global __do_copy_data
- 9 .global __do_clear_bss
- 12 .text
- 13 .Ltext0:
- 94 .global TimerRTCPrescaleFactor
- 95 .section .progmem.data,"a",@progbits
- 98 TimerRTCPrescaleFactor:
- 99 0000 0000 .word 0
- 100 0002 0100 .word 1
- 101 0004 0800 .word 8
- 102 0006 2000 .word 32
- 103 0008 4000 .word 64
- 104 000a 8000 .word 128
- 105 000c 0001 .word 256
- 106 000e 0004 .word 1024
- 107 .global TimerPrescaleFactor
- 110 TimerPrescaleFactor:
- 111 0010 0000 .word 0
- 112 0012 0100 .word 1
- 113 0014 0800 .word 8
- 114 0016 4000 .word 64
- 115 0018 0001 .word 256
- 116 001a 0004 .word 1024
- 117 .text
- 120 .global delay_us
- 122 delay_us:
- 1:../avrlib/timer.c **** /*! \file timer.c \brief System Timer function library. */
- 2:../avrlib/timer.c **** //*****************************************************************************
- 3:../avrlib/timer.c **** //
- 4:../avrlib/timer.c **** // File Name : 'timer.c'
- 5:../avrlib/timer.c **** // Title : System Timer function library
- 6:../avrlib/timer.c **** // Author : Pascal Stang - Copyright (C) 2000-2002
- 7:../avrlib/timer.c **** // Created : 11/22/2000
- 8:../avrlib/timer.c **** // Revised : 07/09/2003
- 9:../avrlib/timer.c **** // Version : 1.1
- 10:../avrlib/timer.c **** // Target MCU : Atmel AVR Series
- 11:../avrlib/timer.c **** // Editor Tabs : 4
- 12:../avrlib/timer.c **** //
- 13:../avrlib/timer.c **** // This code is distributed under the GNU Public License
- 14:../avrlib/timer.c **** // which can be found at http://www.gnu.org/licenses/gpl.txt
- 15:../avrlib/timer.c **** //
- 16:../avrlib/timer.c **** //*****************************************************************************
- 17:../avrlib/timer.c ****
- 18:../avrlib/timer.c **** #ifndef WIN32
- 19:../avrlib/timer.c **** #include
- 20:../avrlib/timer.c **** #include
- 21:../avrlib/timer.c **** #include
- 22:../avrlib/timer.c **** #include
- 23:../avrlib/timer.c **** #include
- 24:../avrlib/timer.c **** #endif
- 25:../avrlib/timer.c ****
- 26:../avrlib/timer.c **** #include "global.h"
- 27:../avrlib/timer.c **** #include "timer.h"
- 28:../avrlib/timer.c ****
- 29:../avrlib/timer.c **** #include "rprintf.h"
- 30:../avrlib/timer.c ****
- 31:../avrlib/timer.c **** // Program ROM constants
- 32:../avrlib/timer.c **** // the prescale division values stored in order of timer control register index
- 33:../avrlib/timer.c **** // STOP, CLK, CLK/8, CLK/64, CLK/256, CLK/1024
- 34:../avrlib/timer.c **** unsigned short __attribute__ ((progmem)) TimerPrescaleFactor[] = {0,1,8,64,256,1024};
- 35:../avrlib/timer.c **** // the prescale division values stored in order of timer control register index
- 36:../avrlib/timer.c **** // STOP, CLK, CLK/8, CLK/32, CLK/64, CLK/128, CLK/256, CLK/1024
- 37:../avrlib/timer.c **** unsigned short __attribute__ ((progmem)) TimerRTCPrescaleFactor[] = {0,1,8,32,64,128,256,1024};
- 38:../avrlib/timer.c ****
- 39:../avrlib/timer.c **** // Global variables
- 40:../avrlib/timer.c **** // time registers
- 41:../avrlib/timer.c **** volatile unsigned long TimerPauseReg;
- 42:../avrlib/timer.c **** volatile unsigned long Timer0Reg0;
- 43:../avrlib/timer.c **** volatile unsigned long Timer2Reg0;
- 44:../avrlib/timer.c ****
- 45:../avrlib/timer.c **** typedef void (*voidFuncPtr)(void);
- 46:../avrlib/timer.c **** volatile static voidFuncPtr TimerIntFunc[TIMER_NUM_INTERRUPTS];
- 47:../avrlib/timer.c ****
- 48:../avrlib/timer.c **** // delay for a minimum of microseconds
- 49:../avrlib/timer.c **** // the time resolution is dependent on the time the loop takes
- 50:../avrlib/timer.c **** // e.g. with 4Mhz and 5 cycles per loop, the resolution is 1.25 us
- 51:../avrlib/timer.c **** void delay_us(unsigned short time_us)
- 52:../avrlib/timer.c **** {
- 124 .LM1:
- 125 /* prologue: frame size=0 */
- 126 /* prologue end (size=0) */
- 53:../avrlib/timer.c **** unsigned short delay_loops;
- 54:../avrlib/timer.c **** register unsigned short i;
- 55:../avrlib/timer.c ****
- 56:../avrlib/timer.c **** delay_loops = (time_us+3)/5*CYCLES_PER_US; // +3 for rounding up (dirty)
- 128 .LM2:
- 129 0000 0396 adiw r24,3
- 130 0002 65E0 ldi r22,lo8(5)
- 131 0004 70E0 ldi r23,hi8(5)
- 132 0006 00D0 rcall __udivmodhi4
- 133 0008 CB01 movw r24,r22
- 134 000a AA27 clr r26
- 135 000c BB27 clr r27
- 136 000e 24E0 ldi r18,4
- 137 0010 880F 1: lsl r24
- 138 0012 991F rol r25
- 139 0014 AA1F rol r26
- 140 0016 BB1F rol r27
- 141 0018 2A95 dec r18
- 142 001a D1F7 brne 1b
- 143 .L8:
- 57:../avrlib/timer.c ****
- 58:../avrlib/timer.c **** // one loop takes 5 cpu cycles
- 59:../avrlib/timer.c **** for (i=0; i < delay_loops; i++) {};
- 145 .LM3:
- 146 001c 0097 sbiw r24,0
- 147 001e 11F0 breq .L7
- 148 0020 0197 sbiw r24,1
- 149 0022 FCCF rjmp .L8
- 150 .L7:
- 151 0024 0895 ret
- 152 /* epilogue: frame size=0 */
- 153 /* epilogue: noreturn */
- 154 /* epilogue end (size=0) */
- 155 /* function delay_us size 19 (19) */
- 161 .Lscope0:
- 165 .global timerDetach
- 167 timerDetach:
- 60:../avrlib/timer.c **** }
- 61:../avrlib/timer.c **** /*
- 62:../avrlib/timer.c **** void delay_ms(unsigned char time_ms)
- 63:../avrlib/timer.c **** {
- 64:../avrlib/timer.c **** unsigned short delay_count = F_CPU / 4000;
- 65:../avrlib/timer.c ****
- 66:../avrlib/timer.c **** unsigned short cnt;
- 67:../avrlib/timer.c **** asm volatile ("\n"
- 68:../avrlib/timer.c **** "L_dl1%=:\n\t"
- 69:../avrlib/timer.c **** "mov %A0, %A2\n\t"
- 70:../avrlib/timer.c **** "mov %B0, %B2\n"
- 71:../avrlib/timer.c **** "L_dl2%=:\n\t"
- 72:../avrlib/timer.c **** "sbiw %A0, 1\n\t"
- 73:../avrlib/timer.c **** "brne L_dl2%=\n\t"
- 74:../avrlib/timer.c **** "dec %1\n\t" "brne L_dl1%=\n\t":"=&w" (cnt)
- 75:../avrlib/timer.c **** :"r"(time_ms), "r"((unsigned short) (delay_count))
- 76:../avrlib/timer.c **** );
- 77:../avrlib/timer.c **** }
- 78:../avrlib/timer.c **** */
- 79:../avrlib/timer.c **** void timerInit(void)
- 80:../avrlib/timer.c **** {
- 81:../avrlib/timer.c **** u08 intNum;
- 82:../avrlib/timer.c **** // detach all user functions from interrupts
- 83:../avrlib/timer.c **** for(intNum=0; intNum number of milliseconds
- 210:../avrlib/timer.c **** u08 timerThres;
- 211:../avrlib/timer.c **** u32 ticRateHz;
- 212:../avrlib/timer.c **** u32 pause;
- 213:../avrlib/timer.c ****
- 214:../avrlib/timer.c **** // capture current pause timer value
- 215:../avrlib/timer.c **** timerThres = inb(TCNT0);
- 216:../avrlib/timer.c **** // reset pause timer overflow count
- 217:../avrlib/timer.c **** TimerPauseReg = 0;
- 218:../avrlib/timer.c **** // calculate delay for [pause_ms] milliseconds
- 219:../avrlib/timer.c **** // prescaler division = 1<<(pgm_read_byte(TimerPrescaleFactor+inb(TCCR0)))
- 220:../avrlib/timer.c **** ticRateHz = F_CPU/timer0GetPrescaler();
- 221:../avrlib/timer.c **** // precision management
- 222:../avrlib/timer.c **** // prevent overflow and precision underflow
- 223:../avrlib/timer.c **** // -could add more conditions to improve accuracy
- 224:../avrlib/timer.c **** if( ((ticRateHz < 429497) && (pause_ms <= 10000)) )
- 225:../avrlib/timer.c **** pause = (pause_ms*ticRateHz)/1000;
- 226:../avrlib/timer.c **** else
- 227:../avrlib/timer.c **** pause = pause_ms*(ticRateHz/1000);
- 228:../avrlib/timer.c ****
- 229:../avrlib/timer.c **** // loop until time expires
- 230:../avrlib/timer.c **** while( ((TimerPauseReg<<8) | inb(TCNT0)) < (pause+timerThres) )
- 231:../avrlib/timer.c **** {
- 232:../avrlib/timer.c **** if( TimerPauseReg < (pause>>8));
- 233:../avrlib/timer.c **** {
- 234:../avrlib/timer.c **** // save power by idling the processor
- 235:../avrlib/timer.c **** set_sleep_mode(SLEEP_MODE_IDLE);
- 236:../avrlib/timer.c **** sleep_mode();
- 237:../avrlib/timer.c **** }
- 238:../avrlib/timer.c **** }
- 239:../avrlib/timer.c ****
- 240:../avrlib/timer.c **** /* old inaccurate code, for reference
- 241:../avrlib/timer.c ****
- 242:../avrlib/timer.c **** // calculate delay for [pause_ms] milliseconds
- 243:../avrlib/timer.c **** u16 prescaleDiv = 1<<(pgm_read_byte(TimerPrescaleFactor+inb(TCCR0)));
- 244:../avrlib/timer.c **** u32 pause = (pause_ms*(F_CPU/(prescaleDiv*256)))/1000;
- 245:../avrlib/timer.c ****
- 246:../avrlib/timer.c **** TimerPauseReg = 0;
- 247:../avrlib/timer.c **** while(TimerPauseReg < pause);
- 248:../avrlib/timer.c ****
- 249:../avrlib/timer.c **** */
- 250:../avrlib/timer.c **** }
- 251:../avrlib/timer.c ****
- 252:../avrlib/timer.c **** void timer0ClearOverflowCount(void)
- 253:../avrlib/timer.c **** {
- 222 .LM9:
- 223 /* prologue: frame size=0 */
- 224 /* prologue end (size=0) */
- 254:../avrlib/timer.c **** // clear the timer overflow counter registers
- 255:../avrlib/timer.c **** Timer0Reg0 = 0; // initialize time registers
- 226 .LM10:
- 227 0048 1092 0000 sts Timer0Reg0,__zero_reg__
- 228 004c 1092 0000 sts (Timer0Reg0)+1,__zero_reg__
- 229 0050 1092 0000 sts (Timer0Reg0)+2,__zero_reg__
- 230 0054 1092 0000 sts (Timer0Reg0)+3,__zero_reg__
- 231 /* epilogue: frame size=0 */
- 232 0058 0895 ret
- 233 /* epilogue end (size=1) */
- 234 /* function timer0ClearOverflowCount size 9 (8) */
- 236 .Lscope3:
- 239 .global timer0Init
- 241 timer0Init:
- 243 .LM11:
- 244 /* prologue: frame size=0 */
- 245 /* prologue end (size=0) */
- 247 .LM12:
- 248 005a 82E0 ldi r24,lo8(2)
- 249 005c F0DF rcall timer0SetPrescaler
- 251 .LM13:
- 252 005e 12BE out 82-0x20,__zero_reg__
- 254 .LM14:
- 255 0060 89B7 in r24,89-0x20
- 256 0062 8160 ori r24,lo8(1)
- 257 0064 89BF out 89-0x20,r24
- 259 .LM15:
- 260 0066 F0DF rcall timer0ClearOverflowCount
- 261 /* epilogue: frame size=0 */
- 262 0068 0895 ret
- 263 /* epilogue end (size=1) */
- 264 /* function timer0Init size 8 (7) */
- 266 .Lscope4:
- 270 .global timer1SetPrescaler
- 272 timer1SetPrescaler:
- 274 .LM16:
- 275 /* prologue: frame size=0 */
- 276 /* prologue end (size=0) */
- 278 .LM17:
- 279 006a 9EB5 in r25,78-0x20
- 280 006c 987F andi r25,lo8(-8)
- 281 006e 982B or r25,r24
- 282 0070 9EBD out 78-0x20,r25
- 283 /* epilogue: frame size=0 */
- 284 0072 0895 ret
- 285 /* epilogue end (size=1) */
- 286 /* function timer1SetPrescaler size 5 (4) */
- 288 .Lscope5:
- 291 .global timer1Init
- 293 timer1Init:
- 295 .LM18:
- 296 /* prologue: frame size=0 */
- 297 /* prologue end (size=0) */
- 299 .LM19:
- 300 0074 83E0 ldi r24,lo8(3)
- 301 0076 F9DF rcall timer1SetPrescaler
- 303 .LM20:
- 304 0078 1DBC out 77-0x20,__zero_reg__
- 306 .LM21:
- 307 007a 1CBC out 76-0x20,__zero_reg__
- 309 .LM22:
- 310 007c 89B7 in r24,89-0x20
- 311 007e 8460 ori r24,lo8(4)
- 312 0080 89BF out 89-0x20,r24
- 313 /* epilogue: frame size=0 */
- 314 0082 0895 ret
- 315 /* epilogue end (size=1) */
- 316 /* function timer1Init size 8 (7) */
- 318 .Lscope6:
- 322 .global timer2SetPrescaler
- 324 timer2SetPrescaler:
- 326 .LM23:
- 327 /* prologue: frame size=0 */
- 328 /* prologue end (size=0) */
- 330 .LM24:
- 331 0084 95B5 in r25,69-0x20
- 332 0086 987F andi r25,lo8(-8)
- 333 0088 982B or r25,r24
- 334 008a 95BD out 69-0x20,r25
- 335 /* epilogue: frame size=0 */
- 336 008c 0895 ret
- 337 /* epilogue end (size=1) */
- 338 /* function timer2SetPrescaler size 5 (4) */
- 340 .Lscope7:
- 343 .global timer2ClearOverflowCount
- 345 timer2ClearOverflowCount:
- 256:../avrlib/timer.c **** }
- 257:../avrlib/timer.c ****
- 258:../avrlib/timer.c **** long timer0GetOverflowCount(void)
- 259:../avrlib/timer.c **** {
- 260:../avrlib/timer.c **** // return the current timer overflow count
- 261:../avrlib/timer.c **** // (this is since the last timer0ClearOverflowCount() command was called)
- 262:../avrlib/timer.c **** return Timer0Reg0;
- 263:../avrlib/timer.c **** }
- 264:../avrlib/timer.c ****
- 265:../avrlib/timer.c **** #ifdef TCNT2 // support timer2 only if it exists
- 266:../avrlib/timer.c **** void timer2ClearOverflowCount(void)
- 267:../avrlib/timer.c **** {
- 347 .LM25:
- 348 /* prologue: frame size=0 */
- 349 /* prologue end (size=0) */
- 268:../avrlib/timer.c **** // clear the timer overflow counter registers
- 269:../avrlib/timer.c **** Timer2Reg0 = 0; // initialize time registers
- 351 .LM26:
- 352 008e 1092 0000 sts Timer2Reg0,__zero_reg__
- 353 0092 1092 0000 sts (Timer2Reg0)+1,__zero_reg__
- 354 0096 1092 0000 sts (Timer2Reg0)+2,__zero_reg__
- 355 009a 1092 0000 sts (Timer2Reg0)+3,__zero_reg__
- 356 /* epilogue: frame size=0 */
- 357 009e 0895 ret
- 358 /* epilogue end (size=1) */
- 359 /* function timer2ClearOverflowCount size 9 (8) */
- 361 .Lscope8:
- 364 .global timer2Init
- 366 timer2Init:
- 368 .LM27:
- 369 /* prologue: frame size=0 */
- 370 /* prologue end (size=0) */
- 372 .LM28:
- 373 00a0 84E0 ldi r24,lo8(4)
- 374 00a2 F0DF rcall timer2SetPrescaler
- 376 .LM29:
- 377 00a4 14BC out 68-0x20,__zero_reg__
- 379 .LM30:
- 380 00a6 89B7 in r24,89-0x20
- 381 00a8 8064 ori r24,lo8(64)
- 382 00aa 89BF out 89-0x20,r24
- 384 .LM31:
- 385 00ac F0DF rcall timer2ClearOverflowCount
- 386 /* epilogue: frame size=0 */
- 387 00ae 0895 ret
- 388 /* epilogue end (size=1) */
- 389 /* function timer2Init size 8 (7) */
- 391 .Lscope9:
- 394 .global timerInit
- 396 timerInit:
- 398 .LM32:
- 399 /* prologue: frame size=0 */
- 400 00b0 CF93 push r28
- 401 /* prologue end (size=1) */
- 403 .LM33:
- 404 00b2 C0E0 ldi r28,lo8(0)
- 405 .L23:
- 407 .LM34:
- 408 00b4 8C2F mov r24,r28
- 409 00b6 B7DF rcall timerDetach
- 411 .LM35:
- 412 00b8 CF5F subi r28,lo8(-(1))
- 413 00ba C730 cpi r28,lo8(7)
- 414 00bc D8F3 brlo .L23
- 416 .LM36:
- 417 00be CDDF rcall timer0Init
- 419 .LM37:
- 420 00c0 D9DF rcall timer1Init
- 422 .LM38:
- 423 00c2 EEDF rcall timer2Init
- 425 .LM39:
- 426 /* #APP */
- 427 00c4 7894 sei
- 428 /* #NOAPP */
- 429 /* epilogue: frame size=0 */
- 430 00c6 CF91 pop r28
- 431 00c8 0895 ret
- 432 /* epilogue end (size=2) */
- 433 /* function timerInit size 14 (11) */
- 438 .Lscope10:
- 441 .global timer0GetPrescaler
- 443 timer0GetPrescaler:
- 445 .LM40:
- 446 /* prologue: frame size=0 */
- 447 /* prologue end (size=0) */
- 448 .LBB2:
- 450 .LM41:
- 451 00ca 83B7 in r24,83-0x20
- 452 00cc E82F mov r30,r24
- 453 00ce FF27 clr r31
- 454 00d0 E770 andi r30,lo8(7)
- 455 00d2 F070 andi r31,hi8(7)
- 456 00d4 EE0F add r30,r30
- 457 00d6 FF1F adc r31,r31
- 458 00d8 E050 subi r30,lo8(-(TimerPrescaleFactor))
- 459 00da F040 sbci r31,hi8(-(TimerPrescaleFactor))
- 460 .LBE2:
- 462 .LM42:
- 463 /* #APP */
- 464 00dc 8591 lpm r24, Z+
- 465 00de 9491 lpm r25, Z
- 466
- 467 /* #NOAPP */
- 468 /* epilogue: frame size=0 */
- 469 00e0 0895 ret
- 470 /* epilogue end (size=1) */
- 471 /* function timer0GetPrescaler size 16 (15) */
- 476 .Lscope11:
- 479 .global timer1GetPrescaler
- 481 timer1GetPrescaler:
- 483 .LM43:
- 484 /* prologue: frame size=0 */
- 485 /* prologue end (size=0) */
- 486 .LBB3:
- 488 .LM44:
- 489 00e2 8EB5 in r24,78-0x20
- 490 00e4 E82F mov r30,r24
- 491 00e6 FF27 clr r31
- 492 00e8 E770 andi r30,lo8(7)
- 493 00ea F070 andi r31,hi8(7)
- 494 00ec EE0F add r30,r30
- 495 00ee FF1F adc r31,r31
- 496 00f0 E050 subi r30,lo8(-(TimerPrescaleFactor))
- 497 00f2 F040 sbci r31,hi8(-(TimerPrescaleFactor))
- 498 .LBE3:
- 500 .LM45:
- 501 /* #APP */
- 502 00f4 8591 lpm r24, Z+
- 503 00f6 9491 lpm r25, Z
- 504
- 505 /* #NOAPP */
- 506 /* epilogue: frame size=0 */
- 507 00f8 0895 ret
- 508 /* epilogue end (size=1) */
- 509 /* function timer1GetPrescaler size 16 (15) */
- 514 .Lscope12:
- 517 .global timer2GetPrescaler
- 519 timer2GetPrescaler:
- 521 .LM46:
- 522 /* prologue: frame size=0 */
- 523 /* prologue end (size=0) */
- 524 .LBB4:
- 526 .LM47:
- 527 00fa 85B5 in r24,69-0x20
- 528 00fc E82F mov r30,r24
- 529 00fe FF27 clr r31
- 530 0100 E770 andi r30,lo8(7)
- 531 0102 F070 andi r31,hi8(7)
- 532 0104 EE0F add r30,r30
- 533 0106 FF1F adc r31,r31
- 534 0108 E050 subi r30,lo8(-(TimerRTCPrescaleFactor))
- 535 010a F040 sbci r31,hi8(-(TimerRTCPrescaleFactor))
- 536 .LBE4:
- 538 .LM48:
- 539 /* #APP */
- 540 010c 8591 lpm r24, Z+
- 541 010e 9491 lpm r25, Z
- 542
- 543 /* #NOAPP */
- 544 /* epilogue: frame size=0 */
- 545 0110 0895 ret
- 546 /* epilogue end (size=1) */
- 547 /* function timer2GetPrescaler size 16 (15) */
- 552 .Lscope13:
- 557 .global timerAttach
- 559 timerAttach:
- 561 .LM49:
- 562 /* prologue: frame size=0 */
- 563 /* prologue end (size=0) */
- 565 .LM50:
- 566 0112 8730 cpi r24,lo8(7)
- 567 0114 40F4 brsh .L29
- 569 .LM51:
- 570 0116 E82F mov r30,r24
- 571 0118 FF27 clr r31
- 572 011a EE0F add r30,r30
- 573 011c FF1F adc r31,r31
- 574 011e E050 subi r30,lo8(-(TimerIntFunc))
- 575 0120 F040 sbci r31,hi8(-(TimerIntFunc))
- 576 0122 6083 st Z,r22
- 577 0124 7183 std Z+1,r23
- 578 .L29:
- 579 0126 0895 ret
- 580 /* epilogue: frame size=0 */
- 581 0128 0895 ret
- 582 /* epilogue end (size=1) */
- 583 /* function timerAttach size 12 (11) */
- 585 .Lscope14:
- 589 .global timerPause
- 591 timerPause:
- 593 .LM52:
- 594 /* prologue: frame size=0 */
- 595 012a DF92 push r13
- 596 012c EF92 push r14
- 597 012e FF92 push r15
- 598 0130 0F93 push r16
- 599 0132 1F93 push r17
- 600 0134 CF93 push r28
- 601 0136 DF93 push r29
- 602 /* prologue end (size=7) */
- 603 0138 EC01 movw r28,r24
- 605 .LM53:
- 606 013a D2B6 in r13,82-0x20
- 608 .LM54:
- 609 013c 1092 0000 sts TimerPauseReg,__zero_reg__
- 610 0140 1092 0000 sts (TimerPauseReg)+1,__zero_reg__
- 611 0144 1092 0000 sts (TimerPauseReg)+2,__zero_reg__
- 612 0148 1092 0000 sts (TimerPauseReg)+3,__zero_reg__
- 614 .LM55:
- 615 014c BEDF rcall timer0GetPrescaler
- 616 014e 9C01 movw r18,r24
- 617 0150 4427 clr r20
- 618 0152 5527 clr r21
- 619 0154 60E0 ldi r22,lo8(16000000)
- 620 0156 74E2 ldi r23,hi8(16000000)
- 621 0158 84EF ldi r24,hlo8(16000000)
- 622 015a 90E0 ldi r25,hhi8(16000000)
- 623 015c 00D0 rcall __divmodsi4
- 625 .LM56:
- 626 015e 293B cpi r18,lo8(429497)
- 627 0160 8DE8 ldi r24,hi8(429497)
- 628 0162 3807 cpc r19,r24
- 629 0164 86E0 ldi r24,hlo8(429497)
- 630 0166 4807 cpc r20,r24
- 631 0168 80E0 ldi r24,hhi8(429497)
- 632 016a 5807 cpc r21,r24
- 633 016c B0F4 brsh .L32
- 635 .LM57:
- 636 016e 87E2 ldi r24,hi8(10001)
- 637 0170 C131 cpi r28,lo8(10001)
- 638 0172 D807 cpc r29,r24
- 639 0174 90F4 brsh .L32
- 641 .LM58:
- 642 0176 CE01 movw r24,r28
- 643 0178 AA27 clr r26
- 644 017a BB27 clr r27
- 645 017c BC01 movw r22,r24
- 646 017e CD01 movw r24,r26
- 647 0180 00D0 rcall __mulsi3
- 648 0182 DC01 movw r26,r24
- 649 0184 CB01 movw r24,r22
- 650 0186 BC01 movw r22,r24
- 651 0188 CD01 movw r24,r26
- 652 018a 28EE ldi r18,lo8(1000)
- 653 018c 33E0 ldi r19,hi8(1000)
- 654 018e 40E0 ldi r20,hlo8(1000)
- 655 0190 50E0 ldi r21,hhi8(1000)
- 656 0192 00D0 rcall __udivmodsi4
- 657 0194 FA01 movw r30,r20
- 658 0196 E901 movw r28,r18
- 659 0198 0FC0 rjmp .L33
- 660 .L32:
- 662 .LM59:
- 663 019a 7E01 movw r14,r28
- 664 019c 0027 clr r16
- 665 019e 1127 clr r17
- 666 01a0 CA01 movw r24,r20
- 667 01a2 B901 movw r22,r18
- 668 01a4 28EE ldi r18,lo8(1000)
- 669 01a6 33E0 ldi r19,hi8(1000)
- 670 01a8 40E0 ldi r20,hlo8(1000)
- 671 01aa 50E0 ldi r21,hhi8(1000)
- 672 01ac 00D0 rcall __udivmodsi4
- 673 01ae C801 movw r24,r16
- 674 01b0 B701 movw r22,r14
- 675 01b2 00D0 rcall __mulsi3
- 676 01b4 FC01 movw r30,r24
- 677 01b6 EB01 movw r28,r22
- 678 .L33:
- 680 .LM60:
- 681 01b8 8091 0000 lds r24,TimerPauseReg
- 682 01bc 9091 0000 lds r25,(TimerPauseReg)+1
- 683 01c0 A091 0000 lds r26,(TimerPauseReg)+2
- 684 01c4 B091 0000 lds r27,(TimerPauseReg)+3
- 685 01c8 2227 clr r18
- 686 01ca 382F mov r19,r24
- 687 01cc 492F mov r20,r25
- 688 01ce 5A2F mov r21,r26
- 689 01d0 82B7 in r24,82-0x20
- 690 01d2 9927 clr r25
- 691 01d4 AA27 clr r26
- 692 01d6 BB27 clr r27
- 693 01d8 282B or r18,r24
- 694 01da 392B or r19,r25
- 695 01dc 4A2B or r20,r26
- 696 01de 5B2B or r21,r27
- 697 01e0 CD0D add r28,r13
- 698 01e2 D11D adc r29,__zero_reg__
- 699 01e4 E11D adc r30,__zero_reg__
- 700 01e6 F11D adc r31,__zero_reg__
- 701 01e8 2C17 cp r18,r28
- 702 01ea 3D07 cpc r19,r29
- 703 01ec 4E07 cpc r20,r30
- 704 01ee 5F07 cpc r21,r31
- 705 01f0 58F5 brsh .L41
- 706 .L39:
- 708 .LM61:
- 709 01f2 8091 0000 lds r24,TimerPauseReg
- 710 01f6 9091 0000 lds r25,(TimerPauseReg)+1
- 711 01fa A091 0000 lds r26,(TimerPauseReg)+2
- 712 01fe B091 0000 lds r27,(TimerPauseReg)+3
- 714 .LM62:
- 715 0202 85B7 in r24,85-0x20
- 716 0204 8F78 andi r24,lo8(-113)
- 717 0206 85BF out 85-0x20,r24
- 719 .LM63:
- 720 0208 85B7 in r24,85-0x20
- 721 020a 8068 ori r24,lo8(-128)
- 722 020c 85BF out 85-0x20,r24
- 723 /* #APP */
- 724 020e 8895 sleep
- 725
- 726 /* #NOAPP */
- 727 0210 85B7 in r24,85-0x20
- 728 0212 8F77 andi r24,lo8(127)
- 729 0214 85BF out 85-0x20,r24
- 730 0216 8091 0000 lds r24,TimerPauseReg
- 731 021a 9091 0000 lds r25,(TimerPauseReg)+1
- 732 021e A091 0000 lds r26,(TimerPauseReg)+2
- 733 0222 B091 0000 lds r27,(TimerPauseReg)+3
- 734 0226 BA2F mov r27,r26
- 735 0228 A92F mov r26,r25
- 736 022a 982F mov r25,r24
- 737 022c 8827 clr r24
- 738 022e 22B7 in r18,82-0x20
- 739 0230 3327 clr r19
- 740 0232 4427 clr r20
- 741 0234 5527 clr r21
- 742 0236 822B or r24,r18
- 743 0238 932B or r25,r19
- 744 023a A42B or r26,r20
- 745 023c B52B or r27,r21
- 746 023e 8C17 cp r24,r28
- 747 0240 9D07 cpc r25,r29
- 748 0242 AE07 cpc r26,r30
- 749 0244 BF07 cpc r27,r31
- 750 0246 A8F2 brlo .L39
- 751 .L41:
- 752 /* epilogue: frame size=0 */
- 753 0248 DF91 pop r29
- 754 024a CF91 pop r28
- 755 024c 1F91 pop r17
- 756 024e 0F91 pop r16
- 757 0250 FF90 pop r15
- 758 0252 EF90 pop r14
- 759 0254 DF90 pop r13
- 760 0256 0895 ret
- 761 /* epilogue end (size=8) */
- 762 /* function timerPause size 154 (139) */
- 769 .Lscope15:
- 772 .global timer0GetOverflowCount
- 774 timer0GetOverflowCount:
- 776 .LM64:
- 777 /* prologue: frame size=0 */
- 778 /* prologue end (size=0) */
- 780 .LM65:
- 781 0258 8091 0000 lds r24,Timer0Reg0
- 782 025c 9091 0000 lds r25,(Timer0Reg0)+1
- 783 0260 A091 0000 lds r26,(Timer0Reg0)+2
- 784 0264 B091 0000 lds r27,(Timer0Reg0)+3
- 786 .LM66:
- 787 0268 BC01 movw r22,r24
- 788 026a CD01 movw r24,r26
- 789 /* epilogue: frame size=0 */
- 790 026c 0895 ret
- 791 /* epilogue end (size=1) */
- 792 /* function timer0GetOverflowCount size 11 (10) */
- 794 .Lscope16:
- 797 .global timer2GetOverflowCount
- 799 timer2GetOverflowCount:
- 270:../avrlib/timer.c **** }
- 271:../avrlib/timer.c ****
- 272:../avrlib/timer.c **** long timer2GetOverflowCount(void)
- 273:../avrlib/timer.c **** {
- 801 .LM67:
- 802 /* prologue: frame size=0 */
- 803 /* prologue end (size=0) */
- 274:../avrlib/timer.c **** // return the current timer overflow count
- 275:../avrlib/timer.c **** // (this is since the last timer2ClearOverflowCount() command was called)
- 276:../avrlib/timer.c **** return Timer2Reg0;
- 805 .LM68:
- 806 026e 8091 0000 lds r24,Timer2Reg0
- 807 0272 9091 0000 lds r25,(Timer2Reg0)+1
- 808 0276 A091 0000 lds r26,(Timer2Reg0)+2
- 809 027a B091 0000 lds r27,(Timer2Reg0)+3
- 277:../avrlib/timer.c **** }
- 811 .LM69:
- 812 027e BC01 movw r22,r24
- 813 0280 CD01 movw r24,r26
- 814 /* epilogue: frame size=0 */
- 815 0282 0895 ret
- 816 /* epilogue end (size=1) */
- 817 /* function timer2GetOverflowCount size 11 (10) */
- 819 .Lscope17:
- 823 .global timer1PWMInit
- 825 timer1PWMInit:
- 278:../avrlib/timer.c **** #endif
- 279:../avrlib/timer.c ****
- 280:../avrlib/timer.c **** void timer1PWMInit(u08 bitRes)
- 281:../avrlib/timer.c **** {
- 827 .LM70:
- 828 /* prologue: frame size=0 */
- 829 /* prologue end (size=0) */
- 282:../avrlib/timer.c **** // configures timer1 for use with PWM output
- 283:../avrlib/timer.c **** // on OC1A and OC1B pins
- 284:../avrlib/timer.c ****
- 285:../avrlib/timer.c **** // enable timer1 as 8,9,10bit PWM
- 286:../avrlib/timer.c **** if(bitRes == 9)
- 831 .LM71:
- 832 0284 8930 cpi r24,lo8(9)
- 833 0286 31F4 brne .L45
- 287:../avrlib/timer.c **** { // 9bit mode
- 288:../avrlib/timer.c **** sbi(TCCR1A,PWM11);
- 835 .LM72:
- 836 0288 8FB5 in r24,79-0x20
- 837 028a 8260 ori r24,lo8(2)
- 838 028c 8FBD out 79-0x20,r24
- 289:../avrlib/timer.c **** cbi(TCCR1A,PWM10);
- 840 .LM73:
- 841 028e 8FB5 in r24,79-0x20
- 842 0290 8E7F andi r24,lo8(-2)
- 843 0292 0AC0 rjmp .L50
- 844 .L45:
- 290:../avrlib/timer.c **** }
- 291:../avrlib/timer.c **** else if( bitRes == 10 )
- 846 .LM74:
- 847 0294 8A30 cpi r24,lo8(10)
- 848 0296 19F4 brne .L47
- 292:../avrlib/timer.c **** { // 10bit mode
- 293:../avrlib/timer.c **** sbi(TCCR1A,PWM11);
- 850 .LM75:
- 851 0298 8FB5 in r24,79-0x20
- 852 029a 8260 ori r24,lo8(2)
- 853 029c 02C0 rjmp .L49
- 854 .L47:
- 294:../avrlib/timer.c **** sbi(TCCR1A,PWM10);
- 295:../avrlib/timer.c **** }
- 296:../avrlib/timer.c **** else
- 297:../avrlib/timer.c **** { // default 8bit mode
- 298:../avrlib/timer.c **** cbi(TCCR1A,PWM11);
- 856 .LM76:
- 857 029e 8FB5 in r24,79-0x20
- 858 02a0 8D7F andi r24,lo8(-3)
- 859 .L49:
- 860 02a2 8FBD out 79-0x20,r24
- 299:../avrlib/timer.c **** sbi(TCCR1A,PWM10);
- 862 .LM77:
- 863 02a4 8FB5 in r24,79-0x20
- 864 02a6 8160 ori r24,lo8(1)
- 865 .L50:
- 866 02a8 8FBD out 79-0x20,r24
- 300:../avrlib/timer.c **** }
- 301:../avrlib/timer.c ****
- 302:../avrlib/timer.c **** // clear output compare value A
- 303:../avrlib/timer.c **** outb(OCR1AH, 0);
- 868 .LM78:
- 869 02aa 1BBC out 75-0x20,__zero_reg__
- 304:../avrlib/timer.c **** outb(OCR1AL, 0);
- 871 .LM79:
- 872 02ac 1ABC out 74-0x20,__zero_reg__
- 305:../avrlib/timer.c **** // clear output compare value B
- 306:../avrlib/timer.c **** outb(OCR1BH, 0);
- 874 .LM80:
- 875 02ae 19BC out 73-0x20,__zero_reg__
- 307:../avrlib/timer.c **** outb(OCR1BL, 0);
- 877 .LM81:
- 878 02b0 18BC out 72-0x20,__zero_reg__
- 879 /* epilogue: frame size=0 */
- 880 02b2 0895 ret
- 881 /* epilogue end (size=1) */
- 882 /* function timer1PWMInit size 24 (23) */
- 884 .Lscope18:
- 888 .global timer1PWMInitICR
- 890 timer1PWMInitICR:
- 308:../avrlib/timer.c **** }
- 309:../avrlib/timer.c ****
- 310:../avrlib/timer.c **** #ifdef WGM10
- 311:../avrlib/timer.c **** // include support for arbitrary top-count PWM
- 312:../avrlib/timer.c **** // on new AVR processors that support it
- 313:../avrlib/timer.c **** void timer1PWMInitICR(u16 topcount)
- 314:../avrlib/timer.c **** {
- 892 .LM82:
- 893 /* prologue: frame size=0 */
- 894 /* prologue end (size=0) */
- 895 02b4 9C01 movw r18,r24
- 315:../avrlib/timer.c **** // set PWM mode with ICR top-count
- 316:../avrlib/timer.c **** cbi(TCCR1A,WGM10);
- 897 .LM83:
- 898 02b6 8FB5 in r24,79-0x20
- 899 02b8 8E7F andi r24,lo8(-2)
- 900 02ba 8FBD out 79-0x20,r24
- 317:../avrlib/timer.c **** sbi(TCCR1A,WGM11);
- 902 .LM84:
- 903 02bc 8FB5 in r24,79-0x20
- 904 02be 8260 ori r24,lo8(2)
- 905 02c0 8FBD out 79-0x20,r24
- 318:../avrlib/timer.c **** sbi(TCCR1B,WGM12);
- 907 .LM85:
- 908 02c2 8EB5 in r24,78-0x20
- 909 02c4 8860 ori r24,lo8(8)
- 910 02c6 8EBD out 78-0x20,r24
- 319:../avrlib/timer.c **** sbi(TCCR1B,WGM13);
- 912 .LM86:
- 913 02c8 8EB5 in r24,78-0x20
- 914 02ca 8061 ori r24,lo8(16)
- 915 02cc 8EBD out 78-0x20,r24
- 320:../avrlib/timer.c ****
- 321:../avrlib/timer.c **** // set top count value
- 322:../avrlib/timer.c **** ICR1 = topcount;
- 917 .LM87:
- 918 02ce 37BD out (70)+1-0x20,r19
- 919 02d0 26BD out 70-0x20,r18
- 323:../avrlib/timer.c ****
- 324:../avrlib/timer.c **** // clear output compare value A
- 325:../avrlib/timer.c **** OCR1A = 0;
- 921 .LM88:
- 922 02d2 1BBC out (74)+1-0x20,__zero_reg__
- 923 02d4 1ABC out 74-0x20,__zero_reg__
- 326:../avrlib/timer.c **** // clear output compare value B
- 327:../avrlib/timer.c **** OCR1B = 0;
- 925 .LM89:
- 926 02d6 19BC out (72)+1-0x20,__zero_reg__
- 927 02d8 18BC out 72-0x20,__zero_reg__
- 928 /* epilogue: frame size=0 */
- 929 02da 0895 ret
- 930 /* epilogue end (size=1) */
- 931 /* function timer1PWMInitICR size 20 (19) */
- 933 .Lscope19:
- 936 .global timer1PWMAOff
- 938 timer1PWMAOff:
- 328:../avrlib/timer.c ****
- 329:../avrlib/timer.c **** }
- 330:../avrlib/timer.c **** #endif
- 331:../avrlib/timer.c ****
- 332:../avrlib/timer.c **** void timer1PWMOff(void)
- 333:../avrlib/timer.c **** {
- 334:../avrlib/timer.c **** // turn off timer1 PWM mode
- 335:../avrlib/timer.c **** cbi(TCCR1A,PWM11);
- 336:../avrlib/timer.c **** cbi(TCCR1A,PWM10);
- 337:../avrlib/timer.c **** // set PWM1A/B (OutputCompare action) to none
- 338:../avrlib/timer.c **** timer1PWMAOff();
- 339:../avrlib/timer.c **** timer1PWMBOff();
- 340:../avrlib/timer.c **** }
- 341:../avrlib/timer.c ****
- 342:../avrlib/timer.c **** void timer1PWMAOn(void)
- 343:../avrlib/timer.c **** {
- 344:../avrlib/timer.c **** // turn on channel A (OC1A) PWM output
- 345:../avrlib/timer.c **** // set OC1A as non-inverted PWM
- 346:../avrlib/timer.c **** sbi(TCCR1A,COM1A1);
- 347:../avrlib/timer.c **** cbi(TCCR1A,COM1A0);
- 348:../avrlib/timer.c **** }
- 349:../avrlib/timer.c ****
- 350:../avrlib/timer.c **** void timer1PWMBOn(void)
- 351:../avrlib/timer.c **** {
- 352:../avrlib/timer.c **** // turn on channel B (OC1B) PWM output
- 353:../avrlib/timer.c **** // set OC1B as non-inverted PWM
- 354:../avrlib/timer.c **** sbi(TCCR1A,COM1B1);
- 355:../avrlib/timer.c **** cbi(TCCR1A,COM1B0);
- 356:../avrlib/timer.c **** }
- 357:../avrlib/timer.c ****
- 358:../avrlib/timer.c **** void timer1PWMAOff(void)
- 359:../avrlib/timer.c **** {
- 940 .LM90:
- 941 /* prologue: frame size=0 */
- 942 /* prologue end (size=0) */
- 360:../avrlib/timer.c **** // turn off channel A (OC1A) PWM output
- 361:../avrlib/timer.c **** // set OC1A (OutputCompare action) to none
- 362:../avrlib/timer.c **** cbi(TCCR1A,COM1A1);
- 944 .LM91:
- 945 02dc 8FB5 in r24,79-0x20
- 946 02de 8F77 andi r24,lo8(127)
- 947 02e0 8FBD out 79-0x20,r24
- 363:../avrlib/timer.c **** cbi(TCCR1A,COM1A0);
- 949 .LM92:
- 950 02e2 8FB5 in r24,79-0x20
- 951 02e4 8F7B andi r24,lo8(-65)
- 952 02e6 8FBD out 79-0x20,r24
- 953 /* epilogue: frame size=0 */
- 954 02e8 0895 ret
- 955 /* epilogue end (size=1) */
- 956 /* function timer1PWMAOff size 7 (6) */
- 958 .Lscope20:
- 961 .global timer1PWMBOff
- 963 timer1PWMBOff:
- 364:../avrlib/timer.c **** }
- 365:../avrlib/timer.c ****
- 366:../avrlib/timer.c **** void timer1PWMBOff(void)
- 367:../avrlib/timer.c **** {
- 965 .LM93:
- 966 /* prologue: frame size=0 */
- 967 /* prologue end (size=0) */
- 368:../avrlib/timer.c **** // turn off channel B (OC1B) PWM output
- 369:../avrlib/timer.c **** // set OC1B (OutputCompare action) to none
- 370:../avrlib/timer.c **** cbi(TCCR1A,COM1B1);
- 969 .LM94:
- 970 02ea 8FB5 in r24,79-0x20
- 971 02ec 8F7D andi r24,lo8(-33)
- 972 02ee 8FBD out 79-0x20,r24
- 371:../avrlib/timer.c **** cbi(TCCR1A,COM1B0);
- 974 .LM95:
- 975 02f0 8FB5 in r24,79-0x20
- 976 02f2 8F7E andi r24,lo8(-17)
- 977 02f4 8FBD out 79-0x20,r24
- 978 /* epilogue: frame size=0 */
- 979 02f6 0895 ret
- 980 /* epilogue end (size=1) */
- 981 /* function timer1PWMBOff size 7 (6) */
- 983 .Lscope21:
- 986 .global timer1PWMOff
- 988 timer1PWMOff:
- 990 .LM96:
- 991 /* prologue: frame size=0 */
- 992 /* prologue end (size=0) */
- 994 .LM97:
- 995 02f8 8FB5 in r24,79-0x20
- 996 02fa 8D7F andi r24,lo8(-3)
- 997 02fc 8FBD out 79-0x20,r24
- 999 .LM98:
- 1000 02fe 8FB5 in r24,79-0x20
- 1001 0300 8E7F andi r24,lo8(-2)
- 1002 0302 8FBD out 79-0x20,r24
- 1004 .LM99:
- 1005 0304 EBDF rcall timer1PWMAOff
- 1007 .LM100:
- 1008 0306 F1DF rcall timer1PWMBOff
- 1009 /* epilogue: frame size=0 */
- 1010 0308 0895 ret
- 1011 /* epilogue end (size=1) */
- 1012 /* function timer1PWMOff size 9 (8) */
- 1014 .Lscope22:
- 1017 .global timer1PWMAOn
- 1019 timer1PWMAOn:
- 1021 .LM101:
- 1022 /* prologue: frame size=0 */
- 1023 /* prologue end (size=0) */
- 1025 .LM102:
- 1026 030a 8FB5 in r24,79-0x20
- 1027 030c 8068 ori r24,lo8(-128)
- 1028 030e 8FBD out 79-0x20,r24
- 1030 .LM103:
- 1031 0310 8FB5 in r24,79-0x20
- 1032 0312 8F7B andi r24,lo8(-65)
- 1033 0314 8FBD out 79-0x20,r24
- 1034 /* epilogue: frame size=0 */
- 1035 0316 0895 ret
- 1036 /* epilogue end (size=1) */
- 1037 /* function timer1PWMAOn size 7 (6) */
- 1039 .Lscope23:
- 1042 .global timer1PWMBOn
- 1044 timer1PWMBOn:
- 1046 .LM104:
- 1047 /* prologue: frame size=0 */
- 1048 /* prologue end (size=0) */
- 1050 .LM105:
- 1051 0318 8FB5 in r24,79-0x20
- 1052 031a 8062 ori r24,lo8(32)
- 1053 031c 8FBD out 79-0x20,r24
- 1055 .LM106:
- 1056 031e 8FB5 in r24,79-0x20
- 1057 0320 8F7E andi r24,lo8(-17)
- 1058 0322 8FBD out 79-0x20,r24
- 1059 /* epilogue: frame size=0 */
- 1060 0324 0895 ret
- 1061 /* epilogue end (size=1) */
- 1062 /* function timer1PWMBOn size 7 (6) */
- 1064 .Lscope24:
- 1068 .global timer1PWMASet
- 1070 timer1PWMASet:
- 372:../avrlib/timer.c **** }
- 373:../avrlib/timer.c ****
- 374:../avrlib/timer.c **** void timer1PWMASet(u16 pwmDuty)
- 375:../avrlib/timer.c **** {
- 1072 .LM107:
- 1073 /* prologue: frame size=0 */
- 1074 /* prologue end (size=0) */
- 376:../avrlib/timer.c **** // set PWM (output compare) duty for channel A
- 377:../avrlib/timer.c **** // this PWM output is generated on OC1A pin
- 378:../avrlib/timer.c **** // NOTE: pwmDuty should be in the range 0-255 for 8bit PWM
- 379:../avrlib/timer.c **** // pwmDuty should be in the range 0-511 for 9bit PWM
- 380:../avrlib/timer.c **** // pwmDuty should be in the range 0-1023 for 10bit PWM
- 381:../avrlib/timer.c **** //outp( (pwmDuty>>8), OCR1AH); // set the high 8bits of OCR1A
- 382:../avrlib/timer.c **** //outp( (pwmDuty&0x00FF), OCR1AL); // set the low 8bits of OCR1A
- 383:../avrlib/timer.c **** OCR1A = pwmDuty;
- 1076 .LM108:
- 1077 0326 9BBD out (74)+1-0x20,r25
- 1078 0328 8ABD out 74-0x20,r24
- 1079 /* epilogue: frame size=0 */
- 1080 032a 0895 ret
- 1081 /* epilogue end (size=1) */
- 1082 /* function timer1PWMASet size 3 (2) */
- 1084 .Lscope25:
- 1088 .global timer1PWMBSet
- 1090 timer1PWMBSet:
- 384:../avrlib/timer.c **** }
- 385:../avrlib/timer.c ****
- 386:../avrlib/timer.c **** void timer1PWMBSet(u16 pwmDuty)
- 387:../avrlib/timer.c **** {
- 1092 .LM109:
- 1093 /* prologue: frame size=0 */
- 1094 /* prologue end (size=0) */
- 388:../avrlib/timer.c **** // set PWM (output compare) duty for channel B
- 389:../avrlib/timer.c **** // this PWM output is generated on OC1B pin
- 390:../avrlib/timer.c **** // NOTE: pwmDuty should be in the range 0-255 for 8bit PWM
- 391:../avrlib/timer.c **** // pwmDuty should be in the range 0-511 for 9bit PWM
- 392:../avrlib/timer.c **** // pwmDuty should be in the range 0-1023 for 10bit PWM
- 393:../avrlib/timer.c **** //outp( (pwmDuty>>8), OCR1BH); // set the high 8bits of OCR1B
- 394:../avrlib/timer.c **** //outp( (pwmDuty&0x00FF), OCR1BL); // set the low 8bits of OCR1B
- 395:../avrlib/timer.c **** OCR1B = pwmDuty;
- 1096 .LM110:
- 1097 032c 99BD out (72)+1-0x20,r25
- 1098 032e 88BD out 72-0x20,r24
- 1099 /* epilogue: frame size=0 */
- 1100 0330 0895 ret
- 1101 /* epilogue end (size=1) */
- 1102 /* function timer1PWMBSet size 3 (2) */
- 1104 .Lscope26:
- 1107 .global __vector_9
- 1109 __vector_9:
- 396:../avrlib/timer.c **** }
- 397:../avrlib/timer.c ****
- 398:../avrlib/timer.c **** //! Interrupt handler for tcnt0 overflow interrupt
- 399:../avrlib/timer.c **** TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW0)
- 400:../avrlib/timer.c **** {
- 1111 .LM111:
- 1112 /* prologue: frame size=0 */
- 1113 0332 1F92 push __zero_reg__
- 1114 0334 0F92 push __tmp_reg__
- 1115 0336 0FB6 in __tmp_reg__,__SREG__
- 1116 0338 0F92 push __tmp_reg__
- 1117 033a 1124 clr __zero_reg__
- 1118 033c 2F93 push r18
- 1119 033e 3F93 push r19
- 1120 0340 4F93 push r20
- 1121 0342 5F93 push r21
- 1122 0344 6F93 push r22
- 1123 0346 7F93 push r23
- 1124 0348 8F93 push r24
- 1125 034a 9F93 push r25
- 1126 034c AF93 push r26
- 1127 034e BF93 push r27
- 1128 0350 EF93 push r30
- 1129 0352 FF93 push r31
- 1130 /* prologue end (size=17) */
- 401:../avrlib/timer.c **** Timer0Reg0++; // increment low-order counter
- 1132 .LM112:
- 1133 0354 8091 0000 lds r24,Timer0Reg0
- 1134 0358 9091 0000 lds r25,(Timer0Reg0)+1
- 1135 035c A091 0000 lds r26,(Timer0Reg0)+2
- 1136 0360 B091 0000 lds r27,(Timer0Reg0)+3
- 1137 0364 0196 adiw r24,1
- 1138 0366 A11D adc r26,__zero_reg__
- 1139 0368 B11D adc r27,__zero_reg__
- 1140 036a 8093 0000 sts Timer0Reg0,r24
- 1141 036e 9093 0000 sts (Timer0Reg0)+1,r25
- 1142 0372 A093 0000 sts (Timer0Reg0)+2,r26
- 1143 0376 B093 0000 sts (Timer0Reg0)+3,r27
- 402:../avrlib/timer.c ****
- 403:../avrlib/timer.c **** // increment pause counter
- 404:../avrlib/timer.c **** TimerPauseReg++;
- 1145 .LM113:
- 1146 037a 8091 0000 lds r24,TimerPauseReg
- 1147 037e 9091 0000 lds r25,(TimerPauseReg)+1
- 1148 0382 A091 0000 lds r26,(TimerPauseReg)+2
- 1149 0386 B091 0000 lds r27,(TimerPauseReg)+3
- 1150 038a 0196 adiw r24,1
- 1151 038c A11D adc r26,__zero_reg__
- 1152 038e B11D adc r27,__zero_reg__
- 1153 0390 8093 0000 sts TimerPauseReg,r24
- 1154 0394 9093 0000 sts (TimerPauseReg)+1,r25
- 1155 0398 A093 0000 sts (TimerPauseReg)+2,r26
- 1156 039c B093 0000 sts (TimerPauseReg)+3,r27
- 405:../avrlib/timer.c ****
- 406:../avrlib/timer.c **** // if a user function is defined, execute it too
- 407:../avrlib/timer.c **** if(TimerIntFunc[TIMER0OVERFLOW_INT])
- 1158 .LM114:
- 1159 03a0 8091 0000 lds r24,TimerIntFunc
- 1160 03a4 9091 0000 lds r25,(TimerIntFunc)+1
- 1161 03a8 892B or r24,r25
- 1162 03aa 29F0 breq .L59
- 408:../avrlib/timer.c **** TimerIntFunc[TIMER0OVERFLOW_INT]();
- 1164 .LM115:
- 1165 03ac E091 0000 lds r30,TimerIntFunc
- 1166 03b0 F091 0000 lds r31,(TimerIntFunc)+1
- 1167 03b4 0995 icall
- 1168 .L59:
- 1169 /* epilogue: frame size=0 */
- 1170 03b6 FF91 pop r31
- 1171 03b8 EF91 pop r30
- 1172 03ba BF91 pop r27
- 1173 03bc AF91 pop r26
- 1174 03be 9F91 pop r25
- 1175 03c0 8F91 pop r24
- 1176 03c2 7F91 pop r23
- 1177 03c4 6F91 pop r22
- 1178 03c6 5F91 pop r21
- 1179 03c8 4F91 pop r20
- 1180 03ca 3F91 pop r19
- 1181 03cc 2F91 pop r18
- 1182 03ce 0F90 pop __tmp_reg__
- 1183 03d0 0FBE out __SREG__,__tmp_reg__
- 1184 03d2 0F90 pop __tmp_reg__
- 1185 03d4 1F90 pop __zero_reg__
- 1186 03d6 1895 reti
- 1187 /* epilogue end (size=17) */
- 1188 /* function __vector_9 size 83 (49) */
- 1190 .Lscope27:
- 1193 .global __vector_8
- 1195 __vector_8:
- 409:../avrlib/timer.c **** }
- 410:../avrlib/timer.c ****
- 411:../avrlib/timer.c **** //! Interrupt handler for tcnt1 overflow interrupt
- 412:../avrlib/timer.c **** TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW1)
- 413:../avrlib/timer.c **** {
- 1197 .LM116:
- 1198 /* prologue: frame size=0 */
- 1199 03d8 1F92 push __zero_reg__
- 1200 03da 0F92 push __tmp_reg__
- 1201 03dc 0FB6 in __tmp_reg__,__SREG__
- 1202 03de 0F92 push __tmp_reg__
- 1203 03e0 1124 clr __zero_reg__
- 1204 03e2 2F93 push r18
- 1205 03e4 3F93 push r19
- 1206 03e6 4F93 push r20
- 1207 03e8 5F93 push r21
- 1208 03ea 6F93 push r22
- 1209 03ec 7F93 push r23
- 1210 03ee 8F93 push r24
- 1211 03f0 9F93 push r25
- 1212 03f2 AF93 push r26
- 1213 03f4 BF93 push r27
- 1214 03f6 EF93 push r30
- 1215 03f8 FF93 push r31
- 1216 /* prologue end (size=17) */
- 414:../avrlib/timer.c **** // if a user function is defined, execute it
- 415:../avrlib/timer.c **** if(TimerIntFunc[TIMER1OVERFLOW_INT])
- 1218 .LM117:
- 1219 03fa 8091 0000 lds r24,TimerIntFunc+2
- 1220 03fe 9091 0000 lds r25,(TimerIntFunc+2)+1
- 1221 0402 892B or r24,r25
- 1222 0404 29F0 breq .L61
- 416:../avrlib/timer.c **** TimerIntFunc[TIMER1OVERFLOW_INT]();
- 1224 .LM118:
- 1225 0406 E091 0000 lds r30,TimerIntFunc+2
- 1226 040a F091 0000 lds r31,(TimerIntFunc+2)+1
- 1227 040e 0995 icall
- 1228 .L61:
- 1229 /* epilogue: frame size=0 */
- 1230 0410 FF91 pop r31
- 1231 0412 EF91 pop r30
- 1232 0414 BF91 pop r27
- 1233 0416 AF91 pop r26
- 1234 0418 9F91 pop r25
- 1235 041a 8F91 pop r24
- 1236 041c 7F91 pop r23
- 1237 041e 6F91 pop r22
- 1238 0420 5F91 pop r21
- 1239 0422 4F91 pop r20
- 1240 0424 3F91 pop r19
- 1241 0426 2F91 pop r18
- 1242 0428 0F90 pop __tmp_reg__
- 1243 042a 0FBE out __SREG__,__tmp_reg__
- 1244 042c 0F90 pop __tmp_reg__
- 1245 042e 1F90 pop __zero_reg__
- 1246 0430 1895 reti
- 1247 /* epilogue end (size=17) */
- 1248 /* function __vector_8 size 45 (11) */
- 1250 .Lscope28:
- 1253 .global __vector_4
- 1255 __vector_4:
- 417:../avrlib/timer.c **** }
- 418:../avrlib/timer.c ****
- 419:../avrlib/timer.c **** #ifdef TCNT2 // support timer2 only if it exists
- 420:../avrlib/timer.c **** //! Interrupt handler for tcnt2 overflow interrupt
- 421:../avrlib/timer.c **** TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW2)
- 422:../avrlib/timer.c **** {
- 1257 .LM119:
- 1258 /* prologue: frame size=0 */
- 1259 0432 1F92 push __zero_reg__
- 1260 0434 0F92 push __tmp_reg__
- 1261 0436 0FB6 in __tmp_reg__,__SREG__
- 1262 0438 0F92 push __tmp_reg__
- 1263 043a 1124 clr __zero_reg__
- 1264 043c 2F93 push r18
- 1265 043e 3F93 push r19
- 1266 0440 4F93 push r20
- 1267 0442 5F93 push r21
- 1268 0444 6F93 push r22
- 1269 0446 7F93 push r23
- 1270 0448 8F93 push r24
- 1271 044a 9F93 push r25
- 1272 044c AF93 push r26
- 1273 044e BF93 push r27
- 1274 0450 EF93 push r30
- 1275 0452 FF93 push r31
- 1276 /* prologue end (size=17) */
- 423:../avrlib/timer.c **** Timer2Reg0++; // increment low-order counter
- 1278 .LM120:
- 1279 0454 8091 0000 lds r24,Timer2Reg0
- 1280 0458 9091 0000 lds r25,(Timer2Reg0)+1
- 1281 045c A091 0000 lds r26,(Timer2Reg0)+2
- 1282 0460 B091 0000 lds r27,(Timer2Reg0)+3
- 1283 0464 0196 adiw r24,1
- 1284 0466 A11D adc r26,__zero_reg__
- 1285 0468 B11D adc r27,__zero_reg__
- 1286 046a 8093 0000 sts Timer2Reg0,r24
- 1287 046e 9093 0000 sts (Timer2Reg0)+1,r25
- 1288 0472 A093 0000 sts (Timer2Reg0)+2,r26
- 1289 0476 B093 0000 sts (Timer2Reg0)+3,r27
- 424:../avrlib/timer.c ****
- 425:../avrlib/timer.c **** // if a user function is defined, execute it
- 426:../avrlib/timer.c **** if(TimerIntFunc[TIMER2OVERFLOW_INT])
- 1291 .LM121:
- 1292 047a 8091 0000 lds r24,TimerIntFunc+10
- 1293 047e 9091 0000 lds r25,(TimerIntFunc+10)+1
- 1294 0482 892B or r24,r25
- 1295 0484 29F0 breq .L63
- 427:../avrlib/timer.c **** TimerIntFunc[TIMER2OVERFLOW_INT]();
- 1297 .LM122:
- 1298 0486 E091 0000 lds r30,TimerIntFunc+10
- 1299 048a F091 0000 lds r31,(TimerIntFunc+10)+1
- 1300 048e 0995 icall
- 1301 .L63:
- 1302 /* epilogue: frame size=0 */
- 1303 0490 FF91 pop r31
- 1304 0492 EF91 pop r30
- 1305 0494 BF91 pop r27
- 1306 0496 AF91 pop r26
- 1307 0498 9F91 pop r25
- 1308 049a 8F91 pop r24
- 1309 049c 7F91 pop r23
- 1310 049e 6F91 pop r22
- 1311 04a0 5F91 pop r21
- 1312 04a2 4F91 pop r20
- 1313 04a4 3F91 pop r19
- 1314 04a6 2F91 pop r18
- 1315 04a8 0F90 pop __tmp_reg__
- 1316 04aa 0FBE out __SREG__,__tmp_reg__
- 1317 04ac 0F90 pop __tmp_reg__
- 1318 04ae 1F90 pop __zero_reg__
- 1319 04b0 1895 reti
- 1320 /* epilogue end (size=17) */
- 1321 /* function __vector_4 size 64 (30) */
- 1323 .Lscope29:
- 1326 .global __vector_6
- 1328 __vector_6:
- 428:../avrlib/timer.c **** }
- 429:../avrlib/timer.c **** #endif
- 430:../avrlib/timer.c ****
- 431:../avrlib/timer.c **** #ifdef OCR0
- 432:../avrlib/timer.c **** // include support for Output Compare 0 for new AVR processors that support it
- 433:../avrlib/timer.c **** //! Interrupt handler for OutputCompare0 match (OC0) interrupt
- 434:../avrlib/timer.c **** TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE0)
- 435:../avrlib/timer.c **** {
- 436:../avrlib/timer.c **** // if a user function is defined, execute it
- 437:../avrlib/timer.c **** if(TimerIntFunc[TIMER0OUTCOMPARE_INT])
- 438:../avrlib/timer.c **** TimerIntFunc[TIMER0OUTCOMPARE_INT]();
- 439:../avrlib/timer.c **** }
- 440:../avrlib/timer.c **** #endif
- 441:../avrlib/timer.c ****
- 442:../avrlib/timer.c **** //! Interrupt handler for CutputCompare1A match (OC1A) interrupt
- 443:../avrlib/timer.c **** TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1A)
- 444:../avrlib/timer.c **** {
- 1330 .LM123:
- 1331 /* prologue: frame size=0 */
- 1332 04b2 1F92 push __zero_reg__
- 1333 04b4 0F92 push __tmp_reg__
- 1334 04b6 0FB6 in __tmp_reg__,__SREG__
- 1335 04b8 0F92 push __tmp_reg__
- 1336 04ba 1124 clr __zero_reg__
- 1337 04bc 2F93 push r18
- 1338 04be 3F93 push r19
- 1339 04c0 4F93 push r20
- 1340 04c2 5F93 push r21
- 1341 04c4 6F93 push r22
- 1342 04c6 7F93 push r23
- 1343 04c8 8F93 push r24
- 1344 04ca 9F93 push r25
- 1345 04cc AF93 push r26
- 1346 04ce BF93 push r27
- 1347 04d0 EF93 push r30
- 1348 04d2 FF93 push r31
- 1349 /* prologue end (size=17) */
- 445:../avrlib/timer.c **** // if a user function is defined, execute it
- 446:../avrlib/timer.c **** if(TimerIntFunc[TIMER1OUTCOMPAREA_INT])
- 1351 .LM124:
- 1352 04d4 8091 0000 lds r24,TimerIntFunc+4
- 1353 04d8 9091 0000 lds r25,(TimerIntFunc+4)+1
- 1354 04dc 892B or r24,r25
- 1355 04de 29F0 breq .L65
- 447:../avrlib/timer.c **** TimerIntFunc[TIMER1OUTCOMPAREA_INT]();
- 1357 .LM125:
- 1358 04e0 E091 0000 lds r30,TimerIntFunc+4
- 1359 04e4 F091 0000 lds r31,(TimerIntFunc+4)+1
- 1360 04e8 0995 icall
- 1361 .L65:
- 1362 /* epilogue: frame size=0 */
- 1363 04ea FF91 pop r31
- 1364 04ec EF91 pop r30
- 1365 04ee BF91 pop r27
- 1366 04f0 AF91 pop r26
- 1367 04f2 9F91 pop r25
- 1368 04f4 8F91 pop r24
- 1369 04f6 7F91 pop r23
- 1370 04f8 6F91 pop r22
- 1371 04fa 5F91 pop r21
- 1372 04fc 4F91 pop r20
- 1373 04fe 3F91 pop r19
- 1374 0500 2F91 pop r18
- 1375 0502 0F90 pop __tmp_reg__
- 1376 0504 0FBE out __SREG__,__tmp_reg__
- 1377 0506 0F90 pop __tmp_reg__
- 1378 0508 1F90 pop __zero_reg__
- 1379 050a 1895 reti
- 1380 /* epilogue end (size=17) */
- 1381 /* function __vector_6 size 45 (11) */
- 1383 .Lscope30:
- 1386 .global __vector_7
- 1388 __vector_7:
- 448:../avrlib/timer.c **** }
- 449:../avrlib/timer.c ****
- 450:../avrlib/timer.c **** //! Interrupt handler for OutputCompare1B match (OC1B) interrupt
- 451:../avrlib/timer.c **** TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1B)
- 452:../avrlib/timer.c **** {
- 1390 .LM126:
- 1391 /* prologue: frame size=0 */
- 1392 050c 1F92 push __zero_reg__
- 1393 050e 0F92 push __tmp_reg__
- 1394 0510 0FB6 in __tmp_reg__,__SREG__
- 1395 0512 0F92 push __tmp_reg__
- 1396 0514 1124 clr __zero_reg__
- 1397 0516 2F93 push r18
- 1398 0518 3F93 push r19
- 1399 051a 4F93 push r20
- 1400 051c 5F93 push r21
- 1401 051e 6F93 push r22
- 1402 0520 7F93 push r23
- 1403 0522 8F93 push r24
- 1404 0524 9F93 push r25
- 1405 0526 AF93 push r26
- 1406 0528 BF93 push r27
- 1407 052a EF93 push r30
- 1408 052c FF93 push r31
- 1409 /* prologue end (size=17) */
- 453:../avrlib/timer.c **** // if a user function is defined, execute it
- 454:../avrlib/timer.c **** if(TimerIntFunc[TIMER1OUTCOMPAREB_INT])
- 1411 .LM127:
- 1412 052e 8091 0000 lds r24,TimerIntFunc+6
- 1413 0532 9091 0000 lds r25,(TimerIntFunc+6)+1
- 1414 0536 892B or r24,r25
- 1415 0538 29F0 breq .L67
- 455:../avrlib/timer.c **** TimerIntFunc[TIMER1OUTCOMPAREB_INT]();
- 1417 .LM128:
- 1418 053a E091 0000 lds r30,TimerIntFunc+6
- 1419 053e F091 0000 lds r31,(TimerIntFunc+6)+1
- 1420 0542 0995 icall
- 1421 .L67:
- 1422 /* epilogue: frame size=0 */
- 1423 0544 FF91 pop r31
- 1424 0546 EF91 pop r30
- 1425 0548 BF91 pop r27
- 1426 054a AF91 pop r26
- 1427 054c 9F91 pop r25
- 1428 054e 8F91 pop r24
- 1429 0550 7F91 pop r23
- 1430 0552 6F91 pop r22
- 1431 0554 5F91 pop r21
- 1432 0556 4F91 pop r20
- 1433 0558 3F91 pop r19
- 1434 055a 2F91 pop r18
- 1435 055c 0F90 pop __tmp_reg__
- 1436 055e 0FBE out __SREG__,__tmp_reg__
- 1437 0560 0F90 pop __tmp_reg__
- 1438 0562 1F90 pop __zero_reg__
- 1439 0564 1895 reti
- 1440 /* epilogue end (size=17) */
- 1441 /* function __vector_7 size 45 (11) */
- 1443 .Lscope31:
- 1446 .global __vector_5
- 1448 __vector_5:
- 456:../avrlib/timer.c **** }
- 457:../avrlib/timer.c ****
- 458:../avrlib/timer.c **** //! Interrupt handler for InputCapture1 (IC1) interrupt
- 459:../avrlib/timer.c **** TIMER_INTERRUPT_HANDLER(SIG_INPUT_CAPTURE1)
- 460:../avrlib/timer.c **** {
- 1450 .LM129:
- 1451 /* prologue: frame size=0 */
- 1452 0566 1F92 push __zero_reg__
- 1453 0568 0F92 push __tmp_reg__
- 1454 056a 0FB6 in __tmp_reg__,__SREG__
- 1455 056c 0F92 push __tmp_reg__
- 1456 056e 1124 clr __zero_reg__
- 1457 0570 2F93 push r18
- 1458 0572 3F93 push r19
- 1459 0574 4F93 push r20
- 1460 0576 5F93 push r21
- 1461 0578 6F93 push r22
- 1462 057a 7F93 push r23
- 1463 057c 8F93 push r24
- 1464 057e 9F93 push r25
- 1465 0580 AF93 push r26
- 1466 0582 BF93 push r27
- 1467 0584 EF93 push r30
- 1468 0586 FF93 push r31
- 1469 /* prologue end (size=17) */
- 461:../avrlib/timer.c **** // if a user function is defined, execute it
- 462:../avrlib/timer.c **** if(TimerIntFunc[TIMER1INPUTCAPTURE_INT])
- 1471 .LM130:
- 1472 0588 8091 0000 lds r24,TimerIntFunc+8
- 1473 058c 9091 0000 lds r25,(TimerIntFunc+8)+1
- 1474 0590 892B or r24,r25
- 1475 0592 29F0 breq .L69
- 463:../avrlib/timer.c **** TimerIntFunc[TIMER1INPUTCAPTURE_INT]();
- 1477 .LM131:
- 1478 0594 E091 0000 lds r30,TimerIntFunc+8
- 1479 0598 F091 0000 lds r31,(TimerIntFunc+8)+1
- 1480 059c 0995 icall
- 1481 .L69:
- 1482 /* epilogue: frame size=0 */
- 1483 059e FF91 pop r31
- 1484 05a0 EF91 pop r30
- 1485 05a2 BF91 pop r27
- 1486 05a4 AF91 pop r26
- 1487 05a6 9F91 pop r25
- 1488 05a8 8F91 pop r24
- 1489 05aa 7F91 pop r23
- 1490 05ac 6F91 pop r22
- 1491 05ae 5F91 pop r21
- 1492 05b0 4F91 pop r20
- 1493 05b2 3F91 pop r19
- 1494 05b4 2F91 pop r18
- 1495 05b6 0F90 pop __tmp_reg__
- 1496 05b8 0FBE out __SREG__,__tmp_reg__
- 1497 05ba 0F90 pop __tmp_reg__
- 1498 05bc 1F90 pop __zero_reg__
- 1499 05be 1895 reti
- 1500 /* epilogue end (size=17) */
- 1501 /* function __vector_5 size 45 (11) */
- 1503 .Lscope32:
- 1506 .global __vector_3
- 1508 __vector_3:
- 464:../avrlib/timer.c **** }
- 465:../avrlib/timer.c ****
- 466:../avrlib/timer.c **** //! Interrupt handler for OutputCompare2 match (OC2) interrupt
- 467:../avrlib/timer.c **** TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE2)
- 468:../avrlib/timer.c **** {
- 1510 .LM132:
- 1511 /* prologue: frame size=0 */
- 1512 05c0 1F92 push __zero_reg__
- 1513 05c2 0F92 push __tmp_reg__
- 1514 05c4 0FB6 in __tmp_reg__,__SREG__
- 1515 05c6 0F92 push __tmp_reg__
- 1516 05c8 1124 clr __zero_reg__
- 1517 05ca 2F93 push r18
- 1518 05cc 3F93 push r19
- 1519 05ce 4F93 push r20
- 1520 05d0 5F93 push r21
- 1521 05d2 6F93 push r22
- 1522 05d4 7F93 push r23
- 1523 05d6 8F93 push r24
- 1524 05d8 9F93 push r25
- 1525 05da AF93 push r26
- 1526 05dc BF93 push r27
- 1527 05de EF93 push r30
- 1528 05e0 FF93 push r31
- 1529 /* prologue end (size=17) */
- 469:../avrlib/timer.c **** // if a user function is defined, execute it
- 470:../avrlib/timer.c **** if(TimerIntFunc[TIMER2OUTCOMPARE_INT])
- 1531 .LM133:
- 1532 05e2 8091 0000 lds r24,TimerIntFunc+12
- 1533 05e6 9091 0000 lds r25,(TimerIntFunc+12)+1
- 1534 05ea 892B or r24,r25
- 1535 05ec 29F0 breq .L71
- 471:../avrlib/timer.c **** TimerIntFunc[TIMER2OUTCOMPARE_INT]();
- 1537 .LM134:
- 1538 05ee E091 0000 lds r30,TimerIntFunc+12
- 1539 05f2 F091 0000 lds r31,(TimerIntFunc+12)+1
- 1540 05f6 0995 icall
- 1541 .L71:
- 1542 /* epilogue: frame size=0 */
- 1543 05f8 FF91 pop r31
- 1544 05fa EF91 pop r30
- 1545 05fc BF91 pop r27
- 1546 05fe AF91 pop r26
- 1547 0600 9F91 pop r25
- 1548 0602 8F91 pop r24
- 1549 0604 7F91 pop r23
- 1550 0606 6F91 pop r22
- 1551 0608 5F91 pop r21
- 1552 060a 4F91 pop r20
- 1553 060c 3F91 pop r19
- 1554 060e 2F91 pop r18
- 1555 0610 0F90 pop __tmp_reg__
- 1556 0612 0FBE out __SREG__,__tmp_reg__
- 1557 0614 0F90 pop __tmp_reg__
- 1558 0616 1F90 pop __zero_reg__
- 1559 0618 1895 reti
- 1560 /* epilogue end (size=17) */
- 1561 /* function __vector_3 size 45 (11) */
- 1563 .Lscope33:
- 1565 .comm TimerPauseReg,4,1
- 1566 .comm Timer0Reg0,4,1
- 1567 .comm Timer2Reg0,4,1
- 1568 .lcomm TimerIntFunc,14
- 1575 .text
- 1577 Letext:
- 1578 /* File "../avrlib/timer.c": code 797 = 0x031d ( 517), prologues 127, epilogues 153 */
-DEFINED SYMBOLS
- *ABS*:00000000 timer.c
- *ABS*:0000003f __SREG__
- *ABS*:0000003e __SP_H__
- *ABS*:0000003d __SP_L__
- *ABS*:00000000 __tmp_reg__
- *ABS*:00000001 __zero_reg__
-/var/tmp//cca6lG7e.s:98 .progmem.data:00000000 TimerRTCPrescaleFactor
-/var/tmp//cca6lG7e.s:110 .progmem.data:00000010 TimerPrescaleFactor
-/var/tmp//cca6lG7e.s:122 .text:00000000 delay_us
-/var/tmp//cca6lG7e.s:167 .text:00000026 timerDetach
- .bss:00000000 TimerIntFunc
-/var/tmp//cca6lG7e.s:199 .text:0000003e timer0SetPrescaler
-/var/tmp//cca6lG7e.s:220 .text:00000048 timer0ClearOverflowCount
- *COM*:00000004 Timer0Reg0
-/var/tmp//cca6lG7e.s:241 .text:0000005a timer0Init
-/var/tmp//cca6lG7e.s:272 .text:0000006a timer1SetPrescaler
-/var/tmp//cca6lG7e.s:293 .text:00000074 timer1Init
-/var/tmp//cca6lG7e.s:324 .text:00000084 timer2SetPrescaler
-/var/tmp//cca6lG7e.s:345 .text:0000008e timer2ClearOverflowCount
- *COM*:00000004 Timer2Reg0
-/var/tmp//cca6lG7e.s:366 .text:000000a0 timer2Init
-/var/tmp//cca6lG7e.s:396 .text:000000b0 timerInit
-/var/tmp//cca6lG7e.s:443 .text:000000ca timer0GetPrescaler
-/var/tmp//cca6lG7e.s:481 .text:000000e2 timer1GetPrescaler
-/var/tmp//cca6lG7e.s:519 .text:000000fa timer2GetPrescaler
-/var/tmp//cca6lG7e.s:559 .text:00000112 timerAttach
-/var/tmp//cca6lG7e.s:591 .text:0000012a timerPause
- *COM*:00000004 TimerPauseReg
-/var/tmp//cca6lG7e.s:774 .text:00000258 timer0GetOverflowCount
-/var/tmp//cca6lG7e.s:799 .text:0000026e timer2GetOverflowCount
-/var/tmp//cca6lG7e.s:825 .text:00000284 timer1PWMInit
-/var/tmp//cca6lG7e.s:890 .text:000002b4 timer1PWMInitICR
-/var/tmp//cca6lG7e.s:938 .text:000002dc timer1PWMAOff
-/var/tmp//cca6lG7e.s:963 .text:000002ea timer1PWMBOff
-/var/tmp//cca6lG7e.s:988 .text:000002f8 timer1PWMOff
-/var/tmp//cca6lG7e.s:1019 .text:0000030a timer1PWMAOn
-/var/tmp//cca6lG7e.s:1044 .text:00000318 timer1PWMBOn
-/var/tmp//cca6lG7e.s:1070 .text:00000326 timer1PWMASet
-/var/tmp//cca6lG7e.s:1090 .text:0000032c timer1PWMBSet
-/var/tmp//cca6lG7e.s:1109 .text:00000332 __vector_9
-/var/tmp//cca6lG7e.s:1195 .text:000003d8 __vector_8
-/var/tmp//cca6lG7e.s:1255 .text:00000432 __vector_4
-/var/tmp//cca6lG7e.s:1328 .text:000004b2 __vector_6
-/var/tmp//cca6lG7e.s:1388 .text:0000050c __vector_7
-/var/tmp//cca6lG7e.s:1448 .text:00000566 __vector_5
-/var/tmp//cca6lG7e.s:1508 .text:000005c0 __vector_3
-/var/tmp//cca6lG7e.s:1577 .text:0000061a Letext
-
-UNDEFINED SYMBOLS
-__do_copy_data
-__do_clear_bss
-__udivmodhi4
-__divmodsi4
-__mulsi3
-__udivmodsi4
diff --git a/build/shared/lib/avrlib/timer128.c b/build/shared/lib/avrlib/timer128.c
deleted file mode 100755
index 71be684c0..000000000
--- a/build/shared/lib/avrlib/timer128.c
+++ /dev/null
@@ -1,692 +0,0 @@
-/*! \file timer128.c \brief System Timer function library for Mega128. */
-//*****************************************************************************
-//
-// File Name : 'timer128.c'
-// Title : System Timer function library for Mega128
-// Author : Pascal Stang - Copyright (C) 2000-2003
-// Created : 11/22/2000
-// Revised : 02/24/2003
-// Version : 1.2
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
- #include
- #include
- #include
- #include
- #include
-#endif
-
-#include "global.h"
-#include "timer128.h"
-
-// Program ROM constants
-// the prescale division values stored in order of timer control register index
-// STOP, CLK, CLK/8, CLK/64, CLK/256, CLK/1024
-unsigned short __attribute__ ((progmem)) TimerPrescaleFactor[] = {0,1,8,64,256,1024};
-// the prescale division values stored in order of timer control register index
-// STOP, CLK, CLK/8, CLK/32, CLK/64, CLK/128, CLK/256, CLK/1024
-unsigned short __attribute__ ((progmem)) TimerRTCPrescaleFactor[] = {0,1,8,32,64,128,256,1024};
-
-// Global variables
-// time registers
-volatile unsigned long TimerPauseReg;
-volatile unsigned long Timer0Reg0;
-volatile unsigned long Timer0Reg1;
-volatile unsigned long Timer2Reg0;
-volatile unsigned long Timer2Reg1;
-
-typedef void (*voidFuncPtr)(void);
-volatile static voidFuncPtr TimerIntFunc[TIMER_NUM_INTERRUPTS];
-
-// delay for a minimum of microseconds
-// the time resolution is dependent on the time the loop takes
-// e.g. with 4Mhz and 5 cycles per loop, the resolution is 1.25 us
-void delay_us(unsigned short time_us)
-{
- unsigned short delay_loops;
- register unsigned short i;
-
- delay_loops = (time_us+3)/5*CYCLES_PER_US; // +3 for rounding up (dirty)
-
- // one loop takes 5 cpu cycles
- for (i=0; i < delay_loops; i++) {};
-}
-/*
-void delay_ms(unsigned char time_ms)
-{
- unsigned short delay_count = F_CPU / 4000;
-
- unsigned short cnt;
- asm volatile ("\n"
- "L_dl1%=:\n\t"
- "mov %A0, %A2\n\t"
- "mov %B0, %B2\n"
- "L_dl2%=:\n\t"
- "sbiw %A0, 1\n\t"
- "brne L_dl2%=\n\t"
- "dec %1\n\t" "brne L_dl1%=\n\t":"=&w" (cnt)
- :"r"(time_ms), "r"((unsigned short) (delay_count))
- );
-}
-*/
-void timerInit(void)
-{
- u08 intNum;
- // detach all user functions from interrupts
- for(intNum=0; intNum number of milliseconds
- u08 timerThres;
- u32 ticRateHz;
- u32 pause;
-
- // capture current pause timer value
- timerThres = inb(TCNT2);
- // reset pause timer overflow count
- TimerPauseReg = 0;
- // calculate delay for [pause_ms] milliseconds
- // prescaler division = 1<<(pgm_read_byte(TimerPrescaleFactor+inb(TCCR2)))
- ticRateHz = F_CPU/timer2GetPrescaler();
- // precision management
- // prevent overflow and precision underflow
- // -could add more conditions to improve accuracy
- if( ((ticRateHz < 429497) && (pause_ms <= 10000)) )
- pause = (pause_ms*ticRateHz)/1000;
- else
- pause = pause_ms*(ticRateHz/1000);
-
- // loop until time expires
- while( ((TimerPauseReg<<8) | inb(TCNT2)) < (pause+timerThres) )
- {
- if( TimerPauseReg < (pause>>8));
- {
- // save power by idling the processor
- set_sleep_mode(SLEEP_MODE_IDLE);
- sleep_mode();
- }
- }
-}
-
-void timer0ClearOverflowCount(void)
-{
- // clear the timer overflow counter registers
- Timer0Reg0 = 0; // initialize time registers
- Timer0Reg1 = 0; // initialize time registers
-}
-
-long timer0GetOverflowCount(void)
-{
- // return the current timer overflow count
- // (this is since the last timer0ClearOverflowCount() command was called)
- return Timer0Reg0;
-}
-
-void timer2ClearOverflowCount(void)
-{
- // clear the timer overflow counter registers
- Timer2Reg0 = 0; // initialize time registers
- Timer2Reg1 = 0; // initialize time registers
-}
-
-long timer2GetOverflowCount(void)
-{
- // return the current timer overflow count
- // (this is since the last timer2ClearOverflowCount() command was called)
- return Timer2Reg0;
-}
-
-
-void timer1PWMInit(u08 bitRes)
-{
- // configures timer1 for use with PWM output
- // on pins OC1A, OC1B, and OC1C
-
- // enable Timer1 as 8,9,10bit PWM
- if(bitRes == 9)
- { // 9bit mode
- sbi(TCCR1A,WGMA1);
- cbi(TCCR1A,WGMA0);
- }
- else if( bitRes == 10 )
- { // 10bit mode
- sbi(TCCR1A,WGMA1);
- sbi(TCCR1A,WGMA0);
- }
- else
- { // default 8bit mode
- cbi(TCCR1A,WGMA1);
- sbi(TCCR1A,WGMA0);
- }
-
- // set clear-timer-on-compare-match
- //cbi(TCCR1B,CTC1);
- // clear output compare value A
- outb(OCR1AH, 0);
- outb(OCR1AL, 0);
- // clear output compare value B
- outb(OCR1BH, 0);
- outb(OCR1BL, 0);
- // clear output compare value C
- outb(OCR1CH, 0);
- outb(OCR1CL, 0);
-}
-
-void timer1PWMInitICR(u16 topcount)
-{
- // set PWM mode with ICR top-count
- cbi(TCCR1A,WGM10);
- sbi(TCCR1A,WGM11);
- sbi(TCCR1B,WGM12);
- sbi(TCCR1B,WGM13);
-
- // set top count value
- ICR1H = (u08)(topcount>>8);
- ICR1L = (u08)topcount;
-
- // clear output compare value A
- outb(OCR1AH, 0);
- outb(OCR1AL, 0);
- // clear output compare value B
- outb(OCR1BH, 0);
- outb(OCR1BL, 0);
- // clear output compare value C
- outb(OCR1CH, 0);
- outb(OCR1CL, 0);
-}
-
-void timer1PWMOff(void)
-{
- // turn off PWM on Timer1
- cbi(TCCR1A,WGMA1);
- cbi(TCCR1A,WGMA0);
- // clear (disable) clear-timer-on-compare-match
- //cbi(TCCR1B,CTC1);
- // set PWM1A/B/C (OutputCompare action) to none
- timer1PWMAOff();
- timer1PWMBOff();
- timer1PWMCOff();
-}
-
-void timer1PWMAOn(void)
-{
- // turn on channel A (OC1A) PWM output
- // set OC1A as non-inverted PWM
- sbi(TCCR1A,COMA1);
- cbi(TCCR1A,COMA0);
-}
-
-void timer1PWMBOn(void)
-{
- // turn on channel B (OC1B) PWM output
- // set OC1B as non-inverted PWM
- sbi(TCCR1A,COMB1);
- cbi(TCCR1A,COMB0);
-}
-
-void timer1PWMCOn(void)
-{
- // turn on channel C (OC1C) PWM output
- // set OC1C as non-inverted PWM
- sbi(TCCR1A,COMC1);
- cbi(TCCR1A,COMC0);
-}
-
-void timer1PWMAOff(void)
-{
- // turn off channel A (OC1A) PWM output
- // set OC1A (OutputCompare action) to none
- cbi(TCCR1A,COMA1);
- cbi(TCCR1A,COMA0);
-}
-
-void timer1PWMBOff(void)
-{
- // turn off channel B (OC1B) PWM output
- // set OC1B (OutputCompare action) to none
- cbi(TCCR1A,COMB1);
- cbi(TCCR1A,COMB0);
-}
-
-void timer1PWMCOff(void)
-{
- // turn off channel C (OC1C) PWM output
- // set OC1C (OutputCompare action) to none
- cbi(TCCR1A,COMC1);
- cbi(TCCR1A,COMC0);
-}
-
-void timer1PWMASet(u16 pwmDuty)
-{
- // set PWM (output compare) duty for channel A
- // this PWM output is generated on OC1A pin
- // NOTE: pwmDuty should be in the range 0-255 for 8bit PWM
- // pwmDuty should be in the range 0-511 for 9bit PWM
- // pwmDuty should be in the range 0-1023 for 10bit PWM
- outb(OCR1AH, (pwmDuty>>8)); // set the high 8bits of OCR1A
- outb(OCR1AL, (pwmDuty&0x00FF)); // set the low 8bits of OCR1A
-}
-
-void timer1PWMBSet(u16 pwmDuty)
-{
- // set PWM (output compare) duty for channel B
- // this PWM output is generated on OC1B pin
- // NOTE: pwmDuty should be in the range 0-255 for 8bit PWM
- // pwmDuty should be in the range 0-511 for 9bit PWM
- // pwmDuty should be in the range 0-1023 for 10bit PWM
- outb(OCR1BH, (pwmDuty>>8)); // set the high 8bits of OCR1B
- outb(OCR1BL, (pwmDuty&0x00FF)); // set the low 8bits of OCR1B
-}
-
-void timer1PWMCSet(u16 pwmDuty)
-{
- // set PWM (output compare) duty for channel C
- // this PWM output is generated on OC1C pin
- // NOTE: pwmDuty should be in the range 0-255 for 8bit PWM
- // pwmDuty should be in the range 0-511 for 9bit PWM
- // pwmDuty should be in the range 0-1023 for 10bit PWM
- outb(OCR1CH, (pwmDuty>>8)); // set the high 8bits of OCR1C
- outb(OCR1CL, (pwmDuty&0x00FF)); // set the low 8bits of OCR1C
-}
-
-
-void timer3PWMInit(u08 bitRes)
-{
- // configures timer1 for use with PWM output
- // on pins OC3A, OC3B, and OC3C
-
- // enable Timer3 as 8,9,10bit PWM
- if(bitRes == 9)
- { // 9bit mode
- sbi(TCCR3A,WGMA1);
- cbi(TCCR3A,WGMA0);
- }
- else if( bitRes == 10 )
- { // 10bit mode
- sbi(TCCR3A,WGMA1);
- sbi(TCCR3A,WGMA0);
- }
- else
- { // default 8bit mode
- cbi(TCCR3A,WGMA1);
- sbi(TCCR3A,WGMA0);
- }
-
- // set clear-timer-on-compare-match
- //cbi(TCCR3B,CTC1);
- // clear output compare value A
- outb(OCR3AH, 0);
- outb(OCR3AL, 0);
- // clear output compare value B
- outb(OCR3BH, 0);
- outb(OCR3BL, 0);
- // clear output compare value B
- outb(OCR3CH, 0);
- outb(OCR3CL, 0);
-}
-
-void timer3PWMInitICR(u16 topcount)
-{
- // set PWM mode with ICR top-count
- cbi(TCCR3A,WGM30);
- sbi(TCCR3A,WGM31);
- sbi(TCCR3B,WGM32);
- sbi(TCCR3B,WGM33);
-
- // set top count value
- ICR3H = (u08)(topcount>>8);
- ICR3L = (u08)topcount;
-
- // clear output compare value A
- outb(OCR3AH, 0);
- outb(OCR3AL, 0);
- // clear output compare value B
- outb(OCR3BH, 0);
- outb(OCR3BL, 0);
- // clear output compare value C
- outb(OCR3CH, 0);
- outb(OCR3CL, 0);
-}
-
-void timer3PWMOff(void)
-{
- // turn off PWM mode on Timer3
- cbi(TCCR3A,WGMA1);
- cbi(TCCR3A,WGMA0);
- // clear (disable) clear-timer-on-compare-match
- //cbi(TCCR3B,CTC1);
- // set OC3A/B/C (OutputCompare action) to none
- timer3PWMAOff();
- timer3PWMBOff();
- timer3PWMCOff();
-}
-
-void timer3PWMAOn(void)
-{
- // turn on channel A (OC3A) PWM output
- // set OC3A as non-inverted PWM
- sbi(TCCR3A,COMA1);
- cbi(TCCR3A,COMA0);
-}
-
-void timer3PWMBOn(void)
-{
- // turn on channel B (OC3B) PWM output
- // set OC3B as non-inverted PWM
- sbi(TCCR3A,COMB1);
- cbi(TCCR3A,COMB0);
-}
-
-void timer3PWMCOn(void)
-{
- // turn on channel C (OC3C) PWM output
- // set OC3C as non-inverted PWM
- sbi(TCCR3A,COMC1);
- cbi(TCCR3A,COMC0);
-}
-
-void timer3PWMAOff(void)
-{
- // turn off channel A (OC3A) PWM output
- // set OC3A (OutputCompare action) to none
- cbi(TCCR3A,COMA1);
- cbi(TCCR3A,COMA0);
-}
-
-void timer3PWMBOff(void)
-{
- // turn off channel B (OC3B) PWM output
- // set OC3B (OutputCompare action) to none
- cbi(TCCR3A,COMB1);
- cbi(TCCR3A,COMB0);
-}
-
-void timer3PWMCOff(void)
-{
- // turn off channel C (OC3C) PWM output
- // set OC3C (OutputCompare action) to none
- cbi(TCCR3A,COMC1);
- cbi(TCCR3A,COMC0);
-}
-
-void timer3PWMASet(u16 pwmDuty)
-{
- // set PWM (output compare) duty for channel A
- // this PWM output is generated on OC3A pin
- // NOTE: pwmDuty should be in the range 0-255 for 8bit PWM
- // pwmDuty should be in the range 0-511 for 9bit PWM
- // pwmDuty should be in the range 0-1023 for 10bit PWM
- outb(OCR3AH, (pwmDuty>>8), ); // set the high 8bits of OCR3A
- outb(OCR3AL, (pwmDuty&0x00FF), ); // set the low 8bits of OCR3A
-}
-
-void timer3PWMBSet(u16 pwmDuty)
-{
- // set PWM (output compare) duty for channel B
- // this PWM output is generated on OC3B pin
- // NOTE: pwmDuty should be in the range 0-255 for 8bit PWM
- // pwmDuty should be in the range 0-511 for 9bit PWM
- // pwmDuty should be in the range 0-1023 for 10bit PWM
- outb(OCR3BH, (pwmDuty>>8)); // set the high 8bits of OCR3B
- outb(OCR3BL, (pwmDuty&0x00FF)); // set the low 8bits of OCR3B
-}
-
-void timer3PWMCSet(u16 pwmDuty)
-{
- // set PWM (output compare) duty for channel B
- // this PWM output is generated on OC3C pin
- // NOTE: pwmDuty should be in the range 0-255 for 8bit PWM
- // pwmDuty should be in the range 0-511 for 9bit PWM
- // pwmDuty should be in the range 0-1023 for 10bit PWM
- outb(OCR3CH, (pwmDuty>>8)); // set the high 8bits of OCR3C
- outb(OCR3CL, (pwmDuty&0x00FF)); // set the low 8bits of OCR3C
-}
-
-
-//! Interrupt handler for tcnt0 overflow interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW0)
-{
- Timer0Reg0++; // increment low-order counter
- if(!Timer0Reg0) // if low-order counter rollover
- Timer0Reg1++; // increment high-order counter
-
- // if a user function is defined, execute it too
- if(TimerIntFunc[TIMER0OVERFLOW_INT])
- TimerIntFunc[TIMER0OVERFLOW_INT]();
-}
-
-//! Interrupt handler for Timer1 overflow interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW1)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER1OVERFLOW_INT])
- TimerIntFunc[TIMER1OVERFLOW_INT]();
-}
-
-//! Interrupt handler for Timer2 overflow interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW2)
-{
- Timer2Reg0++; // increment low-order counter
- if(!Timer2Reg0) // if low-order counter rollover
- Timer2Reg1++; // increment high-order counter
-
- // increment pause counter
- TimerPauseReg++;
-
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER2OVERFLOW_INT])
- TimerIntFunc[TIMER2OVERFLOW_INT]();
-}
-
-//! Interrupt handler for Timer3 overflow interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW3)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER3OVERFLOW_INT])
- TimerIntFunc[TIMER3OVERFLOW_INT]();
-}
-
-//! Interrupt handler for OutputCompare0 match (OC0) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE0)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER0OUTCOMPARE_INT])
- TimerIntFunc[TIMER0OUTCOMPARE_INT]();
-}
-
-//! Interrupt handler for OutputCompare1A match (OC1A) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1A)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER1OUTCOMPAREA_INT])
- TimerIntFunc[TIMER1OUTCOMPAREA_INT]();
-}
-
-//! Interrupt handler for OutputCompare1B match (OC1B) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1B)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER1OUTCOMPAREB_INT])
- TimerIntFunc[TIMER1OUTCOMPAREB_INT]();
-}
-
-//! Interrupt handler for OutputCompare1C match (OC1C) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1C)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER1OUTCOMPAREC_INT])
- TimerIntFunc[TIMER1OUTCOMPAREC_INT]();
-}
-
-//! Interrupt handler for InputCapture1(IC1) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_INPUT_CAPTURE1)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER1INPUTCAPTURE_INT])
- TimerIntFunc[TIMER1INPUTCAPTURE_INT]();
-}
-
-//! Interrupt handler for OutputCompare2 match (OC2) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE2)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER2OUTCOMPARE_INT])
- TimerIntFunc[TIMER2OUTCOMPARE_INT]();
-}
-
-//! Interrupt handler for OutputCompare3A match (OC3A) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE3A)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER3OUTCOMPAREA_INT])
- TimerIntFunc[TIMER3OUTCOMPAREA_INT]();
-}
-
-//! Interrupt handler for OutputCompare3B match (OC3B) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE3B)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER3OUTCOMPAREB_INT])
- TimerIntFunc[TIMER3OUTCOMPAREB_INT]();
-}
-
-//! Interrupt handler for OutputCompare3C match (OC3C) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE3C)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER3OUTCOMPAREC_INT])
- TimerIntFunc[TIMER3OUTCOMPAREC_INT]();
-}
-
-//! Interrupt handler for InputCapture3 (IC3) interrupt
-TIMER_INTERRUPT_HANDLER(SIG_INPUT_CAPTURE3)
-{
- // if a user function is defined, execute it
- if(TimerIntFunc[TIMER3INPUTCAPTURE_INT])
- TimerIntFunc[TIMER3INPUTCAPTURE_INT]();
-}
diff --git a/build/shared/lib/avrlib/timer128.h b/build/shared/lib/avrlib/timer128.h
deleted file mode 100755
index 09ed2c39c..000000000
--- a/build/shared/lib/avrlib/timer128.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/*! \file timer128.h \brief System Timer function library for Mega128. */
-//*****************************************************************************
-//
-// File Name : 'timer128.h'
-// Title : System Timer function library for Mega128
-// Author : Pascal Stang - Copyright (C) 2000-2003
-// Created : 11/22/2000
-// Revised : 02/10/2003
-// Version : 1.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//
-// Notes: The Atmel AVR Series Processors each contain at least one
-// hardware timer/counter. Many of the processors contain 2 or 3
-// timers. Generally speaking, a timer is a hardware counter inside
-// the processor which counts at a rate related to the main CPU clock
-// frequency. Because the counter value increasing (counting up) at
-// a precise rate, we can use it as a timer to create or measure
-// precise delays, schedule events, or generate signals of a certain
-// frequency or pulse-width.
-// As an example, the ATmega163 processor has 3 timer/counters.
-// Timer0, Timer1, and Timer2 are 8, 16, and 8 bits wide respectively.
-// This means that they overflow, or roll over back to zero, at a
-// count value of 256 for 8bits or 65536 for 16bits. A prescaler is
-// avaiable for each timer, and the prescaler allows you to pre-divide
-// the main CPU clock rate down to a slower speed before feeding it to
-// the counting input of a timer. For example, if the CPU clock
-// frequency is 3.69MHz, and Timer0's prescaler is set to divide-by-8,
-// then Timer0 will "tic" at 3690000/8 = 461250Hz. Because Timer0 is
-// an 8bit timer, it will count to 256 in just 256/461250Hz = 0.555ms.
-// In fact, when it hits 255, it will overflow and start again at
-// zero. In this case, Timer0 will overflow 461250/256 = 1801.76
-// times per second.
-// Timer0 can be used a number of ways simultaneously. First, the
-// value of the timer can be read by accessing the CPU register TCNT0.
-// We could, for example, figure out how long it takes to execute a
-// C command by recording the value of TCNT0 before and after
-// execution, then subtract (after-before) = time elapsed. Or we can
-// enable the overflow interrupt which goes off every time T0
-// overflows and count out longer delays (multiple overflows), or
-// execute a special periodic function at every overflow.
-// The other timers (Timer1 and Timer2) offer all the abilities of
-// Timer0 and many more features. Both T1 and T2 can operate as
-// general-purpose timers, but T1 has special hardware allowing it to
-// generate PWM signals, while T2 is specially designed to help count
-// out real time (like hours, minutes, seconds). See the
-// Timer/Counter section of the processor datasheet for more info.
-//
-//*****************************************************************************
-
-#ifndef TIMER128_H
-#define TIMER128_H
-
-#include "global.h"
-
-// constants/macros/typdefs
-
-// Timer/clock prescaler values and timer overflow rates
-// tics = rate at which the timer counts up
-// 8bitoverflow = rate at which the timer overflows 8bits (or reaches 256)
-// 16bit [overflow] = rate at which the timer overflows 16bits (65536)
-//
-// overflows can be used to generate periodic interrupts
-//
-// for 8MHz crystal
-// 0 = STOP (Timer not counting)
-// 1 = CLOCK tics= 8MHz 8bitoverflow= 31250Hz 16bit= 122.070Hz
-// 2 = CLOCK/8 tics= 1MHz 8bitoverflow= 3906.25Hz 16bit= 15.259Hz
-// 3 = CLOCK/64 tics= 125kHz 8bitoverflow= 488.28Hz 16bit= 1.907Hz
-// 4 = CLOCK/256 tics= 31250Hz 8bitoverflow= 122.07Hz 16bit= 0.477Hz
-// 5 = CLOCK/1024 tics= 7812.5Hz 8bitoverflow= 30.52Hz 16bit= 0.119Hz
-// 6 = External Clock on T(x) pin (falling edge)
-// 7 = External Clock on T(x) pin (rising edge)
-
-// for 4MHz crystal
-// 0 = STOP (Timer not counting)
-// 1 = CLOCK tics= 4MHz 8bitoverflow= 15625Hz 16bit= 61.035Hz
-// 2 = CLOCK/8 tics= 500kHz 8bitoverflow= 1953.125Hz 16bit= 7.629Hz
-// 3 = CLOCK/64 tics= 62500Hz 8bitoverflow= 244.141Hz 16bit= 0.954Hz
-// 4 = CLOCK/256 tics= 15625Hz 8bitoverflow= 61.035Hz 16bit= 0.238Hz
-// 5 = CLOCK/1024 tics= 3906.25Hz 8bitoverflow= 15.259Hz 16bit= 0.060Hz
-// 6 = External Clock on T(x) pin (falling edge)
-// 7 = External Clock on T(x) pin (rising edge)
-
-// for 3.69MHz crystal
-// 0 = STOP (Timer not counting)
-// 1 = CLOCK tics= 3.69MHz 8bitoverflow= 14414Hz 16bit= 56.304Hz
-// 2 = CLOCK/8 tics= 461250Hz 8bitoverflow= 1801.758Hz 16bit= 7.038Hz
-// 3 = CLOCK/64 tics= 57625.25Hz 8bitoverflow= 225.220Hz 16bit= 0.880Hz
-// 4 = CLOCK/256 tics= 14414.063Hz 8bitoverflow= 56.305Hz 16bit= 0.220Hz
-// 5 = CLOCK/1024 tics= 3603.516Hz 8bitoverflow= 14.076Hz 16bit= 0.055Hz
-// 6 = External Clock on T(x) pin (falling edge)
-// 7 = External Clock on T(x) pin (rising edge)
-
-// for 32.768KHz crystal on timer 2 (use for real-time clock)
-// 0 = STOP
-// 1 = CLOCK tics= 32.768kHz 8bitoverflow= 128Hz
-// 2 = CLOCK/8 tics= 4096kHz 8bitoverflow= 16Hz
-// 3 = CLOCK/64 tics= 512Hz 8bitoverflow= 2Hz
-// 4 = CLOCK/256 tics= 128Hz 8bitoverflow= 0.5Hz
-// 5 = CLOCK/1024 tics= 32Hz 8bitoverflow= 0.125Hz
-
-#define TIMER_CLK_STOP 0x00 ///< Timer Stopped
-#define TIMER_CLK_DIV1 0x01 ///< Timer clocked at F_CPU
-#define TIMER_CLK_DIV8 0x02 ///< Timer clocked at F_CPU/8
-#define TIMER_CLK_DIV64 0x03 ///< Timer clocked at F_CPU/64
-#define TIMER_CLK_DIV256 0x04 ///< Timer clocked at F_CPU/256
-#define TIMER_CLK_DIV1024 0x05 ///< Timer clocked at F_CPU/1024
-#define TIMER_CLK_T_FALL 0x06 ///< Timer clocked at T falling edge
-#define TIMER_CLK_T_RISE 0x07 ///< Timer clocked at T rising edge
-#define TIMER_PRESCALE_MASK 0x07 ///< Timer Prescaler Bit-Mask
-
-#define TIMERRTC_CLK_STOP 0x00 ///< RTC Timer Stopped
-#define TIMERRTC_CLK_DIV1 0x01 ///< RTC Timer clocked at F_CPU
-#define TIMERRTC_CLK_DIV8 0x02 ///< RTC Timer clocked at F_CPU/8
-#define TIMERRTC_CLK_DIV32 0x03 ///< RTC Timer clocked at F_CPU/32
-#define TIMERRTC_CLK_DIV64 0x04 ///< RTC Timer clocked at F_CPU/64
-#define TIMERRTC_CLK_DIV128 0x05 ///< RTC Timer clocked at F_CPU/128
-#define TIMERRTC_CLK_DIV256 0x06 ///< RTC Timer clocked at F_CPU/256
-#define TIMERRTC_CLK_DIV1024 0x07 ///< RTC Timer clocked at F_CPU/1024
-#define TIMERRTC_PRESCALE_MASK 0x07 ///< RTC Timer Prescaler Bit-Mask
-
-// default prescale settings for the timers
-// these settings are applied when you call
-// timerInit or any of the timerInit
-#define TIMER0PRESCALE TIMERRTC_CLK_DIV64 ///< timer 0 prescaler default
-#define TIMER1PRESCALE TIMER_CLK_DIV64 ///< timer 1 prescaler default
-#define TIMER2PRESCALE TIMER_CLK_DIV8 ///< timer 2 prescaler default
-#define TIMER3PRESCALE TIMER_CLK_DIV64 ///< timer 3 prescaler default
-
-// interrupt macros for attaching user functions to timer interrupts
-// use these with timerAttach( intNum, function )
-// timer 0
-#define TIMER0OVERFLOW_INT 0
-#define TIMER0OUTCOMPARE_INT 1
-// timer 1
-#define TIMER1OVERFLOW_INT 2
-#define TIMER1OUTCOMPAREA_INT 3
-#define TIMER1OUTCOMPAREB_INT 4
-#define TIMER1OUTCOMPAREC_INT 5
-#define TIMER1INPUTCAPTURE_INT 6
-// timer 2
-#define TIMER2OVERFLOW_INT 7
-#define TIMER2OUTCOMPARE_INT 8
-// timer 3
-#define TIMER3OVERFLOW_INT 9
-#define TIMER3OUTCOMPAREA_INT 10
-#define TIMER3OUTCOMPAREB_INT 11
-#define TIMER3OUTCOMPAREC_INT 12
-#define TIMER3INPUTCAPTURE_INT 13
-
-#define TIMER_NUM_INTERRUPTS 14
-
-// type of interrupt handler to use for timers
-// *do not change unless you know what you're doing
-// Value may be SIGNAL or INTERRUPT
-#ifndef TIMER_INTERRUPT_HANDLER
-#define TIMER_INTERRUPT_HANDLER SIGNAL
-#endif
-
-// functions
-#define delay delay_us
-#define delay_ms timerPause
-void delay_us(unsigned short time_us);
-
-// initializes timing system
-// runs all timer init functions
-// sets all timers to default prescale values #defined in systimer.c
-void timerInit(void);
-
-// default initialization routines for each timer
-void timer0Init(void);
-void timer1Init(void);
-void timer2Init(void);
-void timer3Init(void);
-
-// Clock prescaler set/get commands for each timer/counter
-// For setting the prescaler, you should use one of the #defines
-// above like TIMER_CLK_DIVx, where [x] is the division rate
-// you want.
-// When getting the current prescaler setting, the return value
-// will be the [x] division value currently set.
-void timer0SetPrescaler(u08 prescale); ///< set timer0 prescaler division index
-void timer1SetPrescaler(u08 prescale); ///< set timer1 prescaler division index
-void timer2SetPrescaler(u08 prescale); ///< set timer2 prescaler division index
-void timer3SetPrescaler(u08 prescale); ///< set timer3 prescaler division index
-u16 timer0GetPrescaler(void); ///< get timer0 prescaler division rate
-u16 timer1GetPrescaler(void); ///< get timer1 prescaler division rate
-u16 timer2GetPrescaler(void); ///< get timer2 prescaler division rate
-u16 timer3GetPrescaler(void); ///< get timer3 prescaler division rate
-
-
-// TimerAttach and Detach commands
-// These functions allow the attachment (or detachment) of any user function
-// to a timer interrupt. "Attaching" one of your own functions to a timer
-// interrupt means that it will be called whenever that interrupt happens.
-// Using attach is better than rewriting the actual INTERRUPT() function
-// because your code will still work and be compatible if the timer library
-// is updated. Also, using Attach allows your code and any predefined timer
-// code to work together and at the same time. (ie. "attaching" your own
-// function to the timer0 overflow doesn't prevent timerPause from working,
-// but rather allows you to share the interrupt.)
-//
-// timerAttach(TIMER1OVERFLOW_INT, myOverflowFunction);
-// timerDetach(TIMER1OVERFLOW_INT)
-//
-// timerAttach causes the myOverflowFunction() to be attached, and therefore
-// execute, whenever an overflow on timer1 occurs. timerDetach removes the
-// association and executes no user function when the interrupt occurs.
-// myOverflowFunction must be defined with no return value and no arguments:
-//
-// void myOverflowFunction(void) { ... }
-
-void timerAttach(u08 interruptNum, void (*userFunc)(void) );
-void timerDetach(u08 interruptNum);
-
-
-// timing commands
-// timerPause pauses for the number of milliseconds specified in
-void timerPause(unsigned short pause_ms);
-
-// overflow counters
-// to be documented
-void timer0ClearOverflowCount(void);
-long timer0GetOverflowCount(void);
-void timer2ClearOverflowCount(void);
-long timer2GetOverflowCount(void);
-
-// PWM initialization and set commands for timerX (where X is either 1 or 3)
-// timerXPWMInit()
-// configures the timerX hardware for PWM mode on pins OCXA, OCXB, and OCXC.
-// bitRes should be 8,9,or 10 for 8,9,or 10bit PWM resolution
-//
-// timerXPWMOff()
-// turns off all timerX PWM output and set timer mode to normal state
-//
-// timerXPWMAOn(), timerXPWMBOn(), timerXPWMCOn()
-// turn on output of PWM signals to OCXA,B,C pins
-// NOTE: Until you define the OCXA,B,C pins as outputs, and run
-// this "on" command, no PWM output will be output
-//
-// timerXPWMAOff(), timerXPWMBOff(), timerXPWMCOff()
-// turn off output of PWM signals to OCXA,B,C pins
-//
-// timerXPWMASet(), timer1PWMBSet(), timerXPWMCSet()
-// sets the PWM duty cycle for each channel
-// NOTE: should be in the range 0-255 for 8bit PWM
-// should be in the range 0-511 for 9bit PWM
-// should be in the range 0-1023 for 10bit PWM
-// NOTE: the PWM frequency can be controlled in increments by setting the
-// prescaler for timer1
-
-void timer1PWMInit(u08 bitRes); ///< initialize and set timer1 mode to PWM
-void timer1PWMInitICR(u16 topcount);///< initialize and set timer1 mode to PWM with specific top count
-void timer1PWMOff(void); ///< turn off all timer1 PWM output and set timer mode to normal
-void timer1PWMAOn(void); ///< turn on timer1 Channel A (OC1A) PWM output
-void timer1PWMBOn(void); ///< turn on timer1 Channel B (OC1B) PWM output
-void timer1PWMCOn(void); ///< turn on timer1 Channel C (OC1C) PWM output
-void timer1PWMAOff(void); ///< turn off timer1 Channel A (OC1A) PWM output
-void timer1PWMBOff(void); ///< turn off timer1 Channel B (OC1B) PWM output
-void timer1PWMCOff(void); ///< turn off timer1 Channel C (OC1C) PWM output
-void timer1PWMASet(u16 pwmDuty); ///< set duty of timer1 Channel A (OC1A) PWM output
-void timer1PWMBSet(u16 pwmDuty); ///< set duty of timer1 Channel B (OC1B) PWM output
-void timer1PWMCSet(u16 pwmDuty); ///< set duty of timer1 Channel C (OC1C) PWM output
-
-void timer3PWMInit(u08 bitRes); ///< initialize and set timer3 mode to PWM
-void timer3PWMInitICR(u16 topcount);///< initialize and set timer3 mode to PWM with specific top count
-void timer3PWMOff(void); ///< turn off all timer3 PWM output and set timer mode to normal
-void timer3PWMAOn(void); ///< turn on timer3 Channel A (OC3A) PWM output
-void timer3PWMBOn(void); ///< turn on timer3 Channel B (OC3B) PWM output
-void timer3PWMCOn(void); ///< turn on timer3 Channel C (OC3C) PWM output
-void timer3PWMAOff(void); ///< turn off timer3 Channel A (OC3A) PWM output
-void timer3PWMBOff(void); ///< turn off timer3 Channel B (OC3B) PWM output
-void timer3PWMCOff(void); ///< turn off timer3 Channel C (OC3C) PWM output
-void timer3PWMASet(u16 pwmDuty); ///< set duty of timer3 Channel A (OC3A) PWM output
-void timer3PWMBSet(u16 pwmDuty); ///< set duty of timer3 Channel B (OC3B) PWM output
-void timer3PWMCSet(u16 pwmDuty); ///< set duty of timer3 Channel C (OC3C) PWM output
-
-// Pulse generation commands have been moved to the pulse.c library
-
-#endif
diff --git a/build/shared/lib/avrlib/tsip.c b/build/shared/lib/avrlib/tsip.c
deleted file mode 100755
index a654cdd3f..000000000
--- a/build/shared/lib/avrlib/tsip.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/*! \file tsip.c \brief TSIP (Trimble Standard Interface Protocol) function library. */
-//*****************************************************************************
-//
-// File Name : 'tsip.c'
-// Title : TSIP (Trimble Standard Interface Protocol) function library
-// Author : Pascal Stang - Copyright (C) 2002-2003
-// Created : 2002.08.27
-// Revised : 2003.07.17
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
- #include
- #include
- #include
- #include
-#endif
-
-#include "global.h"
-#include "buffer.h"
-#include "rprintf.h"
-#include "uart2.h"
-#include "gps.h"
-
-#include "tsip.h"
-
-// Program ROM constants
-
-// Global variables
-extern GpsInfoType GpsInfo;
-#define BUFFERSIZE 0x40
-u08 TsipPacket[BUFFERSIZE];
-u08 debug;
-
-// function pointer to single byte output routine
-static void (*TsipTxByteFunc)(unsigned char c);
-
-void tsipInit(void (*txbytefunc)(unsigned char c))
-{
- // set transmit function
- // (this function will be used for all SendPacket commands)
- TsipTxByteFunc = txbytefunc;
-
- // set debug status
- debug = 0;
-
- // compose GPS receiver configuration packet
- u08 packet[4];
- packet[0] = BV(POS_LLA);
- packet[1] = BV(VEL_ENU);
- packet[2] = 0;
- packet[3] = 0;
- // send configuration
- tsipSendPacket(TSIPTYPE_SET_IO_OPTIONS, 4, packet);
-}
-
-void tsipSendPacket(u08 tsipType, u08 dataLength, u08* data)
-{
- u08 i;
- u08 dataIdx = 0;
-
- // start of packet
- TsipPacket[dataIdx++] = DLE;
- // packet type
- TsipPacket[dataIdx++] = tsipType;
- // add packet data
- for(i=0; idatalength > 1)
- {
- // look for a potential start of TSIP packet
- if(bufferGetAtIndex(rxBuffer,0) == DLE)
- {
- // make sure the next byte is not DLE or ETX
- data = bufferGetAtIndex(rxBuffer,1);
- if((data != DLE) && (data != ETX))
- {
- // found potential start
- startFlag = TRUE;
- // done looking for start
- break;
- }
- }
- else
- // not DLE, dump character from buffer
- bufferGetFromFront(rxBuffer);
- }
-
- // if we detected a start, look for end of packet
- if(startFlag)
- {
- for(i=1; i<(rxBuffer->datalength)-1; i++)
- {
- // check for potential end of TSIP packet
- if((bufferGetAtIndex(rxBuffer,i) == DLE) && (bufferGetAtIndex(rxBuffer,i+1) == ETX))
- {
- // have a packet end
- // dump initial DLE
- bufferGetFromFront(rxBuffer);
- // copy data to TsipPacket
- TsipPacketIdx = 0;
- for(j=0; j<(i-1); j++)
- {
- data = bufferGetFromFront(rxBuffer);
- if(data == DLE)
- {
- if(bufferGetAtIndex(rxBuffer,0) == DLE)
- {
- // found double-DLE escape sequence, skip one of them
- bufferGetFromFront(rxBuffer);
- j++;
- }
- }
- TsipPacket[TsipPacketIdx++] = data;
- }
- // dump ending DLE+ETX
- bufferGetFromFront(rxBuffer);
- bufferGetFromFront(rxBuffer);
-
- // found a packet
- if(debug)
- {
- rprintf("Rx TSIP packet type: 0x%x len: %d rawlen: %d\r\n",
- TsipPacket[0],
- TsipPacketIdx,
- i);
- for(k=0; k
-#include
-#include
-
-#include "buffer.h"
-#include "uart.h"
-
-// UART global variables
-// flag variables
-volatile u08 uartReadyTx; ///< uartReadyTx flag
-volatile u08 uartBufferedTx; ///< uartBufferedTx flag
-// receive and transmit buffers
-cBuffer uartRxBuffer; ///< uart receive buffer
-cBuffer uartTxBuffer; ///< uart transmit buffer
-unsigned short uartRxOverflow; ///< receive overflow counter
-
-#ifndef UART_BUFFERS_EXTERNAL_RAM
- // using internal ram,
- // automatically allocate space in ram for each buffer
- static char uartRxData[UART_RX_BUFFER_SIZE];
- static char uartTxData[UART_TX_BUFFER_SIZE];
-#endif
-
-typedef void (*voidFuncPtru08)(unsigned char);
-volatile static voidFuncPtru08 UartRxFunc;
-
-//! enable and initialize the uart
-void uartInit(void)
-{
- // initialize the buffers
- uartInitBuffers();
- // initialize user receive handler
- UartRxFunc = 0;
-
- // enable RxD/TxD and interrupts
- outb(UCR, BV(RXCIE)|BV(TXCIE)|BV(RXEN)|BV(TXEN));
-
- // set default baud rate
- uartSetBaudRate(UART_DEFAULT_BAUD_RATE);
- // initialize states
- uartReadyTx = TRUE;
- uartBufferedTx = FALSE;
- // clear overflow count
- uartRxOverflow = 0;
- // enable interrupts
- sei();
-}
-
-//! create and initialize the uart transmit and receive buffers
-void uartInitBuffers(void)
-{
- #ifndef UART_BUFFERS_EXTERNAL_RAM
- // initialize the UART receive buffer
- bufferInit(&uartRxBuffer, uartRxData, UART_RX_BUFFER_SIZE);
- // initialize the UART transmit buffer
- bufferInit(&uartTxBuffer, uartTxData, UART_TX_BUFFER_SIZE);
- #else
- // initialize the UART receive buffer
- bufferInit(&uartRxBuffer, (u08*) UART_RX_BUFFER_ADDR, UART_RX_BUFFER_SIZE);
- // initialize the UART transmit buffer
- bufferInit(&uartTxBuffer, (u08*) UART_TX_BUFFER_ADDR, UART_TX_BUFFER_SIZE);
- #endif
-}
-
-//! redirects received data to a user function
-void uartSetRxHandler(void (*rx_func)(unsigned char c))
-{
- // set the receive interrupt to run the supplied user function
- UartRxFunc = rx_func;
-}
-
-//! set the uart baud rate
-void uartSetBaudRate(u32 baudrate)
-{
- // calculate division factor for requested baud rate, and set it
- u16 bauddiv = ((F_CPU+(baudrate*8L))/(baudrate*16L)-1);
- outb(UBRRL, bauddiv);
- #ifdef UBRRH
- outb(UBRRH, bauddiv>>8);
- #endif
-}
-
-//! returns the receive buffer structure
-cBuffer* uartGetRxBuffer(void)
-{
- // return rx buffer pointer
- return &uartRxBuffer;
-}
-
-//! returns the transmit buffer structure
-cBuffer* uartGetTxBuffer(void)
-{
- // return tx buffer pointer
- return &uartTxBuffer;
-}
-
-//! transmits a byte over the uart
-void uartSendByte(u08 txData)
-{
- // wait for the transmitter to be ready
- while(!uartReadyTx);
- // send byte
- outb(UDR, txData);
- // set ready state to FALSE
- uartReadyTx = FALSE;
-}
-
-//! gets a single byte from the uart receive buffer (getchar-style)
-int uartGetByte(void)
-{
- u08 c;
- if(uartReceiveByte(&c))
- return c;
- else
- return -1;
-}
-
-//! gets a byte (if available) from the uart receive buffer
-u08 uartReceiveByte(u08* rxData)
-{
- // make sure we have a receive buffer
- if(uartRxBuffer.size)
- {
- // make sure we have data
- if(uartRxBuffer.datalength)
- {
- // get byte from beginning of buffer
- *rxData = bufferGetFromFront(&uartRxBuffer);
- return TRUE;
- }
- else
- {
- // no data
- return FALSE;
- }
- }
- else
- {
- // no buffer
- return FALSE;
- }
-}
-
-//! flush all data out of the receive buffer
-void uartFlushReceiveBuffer(void)
-{
- // flush all data from receive buffer
- //bufferFlush(&uartRxBuffer);
- // same effect as above
- uartRxBuffer.datalength = 0;
-}
-
-//! return true if uart receive buffer is empty
-u08 uartReceiveBufferIsEmpty(void)
-{
- if(uartRxBuffer.datalength == 0)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
-}
-
-//! add byte to end of uart Tx buffer
-void uartAddToTxBuffer(u08 data)
-{
- // add data byte to the end of the tx buffer
- bufferAddToEnd(&uartTxBuffer, data);
-}
-
-//! start transmission of the current uart Tx buffer contents
-void uartSendTxBuffer(void)
-{
- // turn on buffered transmit
- uartBufferedTx = TRUE;
- // send the first byte to get things going by interrupts
- uartSendByte(bufferGetFromFront(&uartTxBuffer));
-}
-/*
-//! transmit nBytes from buffer out the uart
-u08 uartSendBuffer(char *buffer, u16 nBytes)
-{
- register u08 first;
- register u16 i;
-
- // check if there's space (and that we have any bytes to send at all)
- if((uartTxBuffer.datalength + nBytes < uartTxBuffer.size) && nBytes)
- {
- // grab first character
- first = *buffer++;
- // copy user buffer to uart transmit buffer
- for(i = 0; i < nBytes-1; i++)
- {
- // put data bytes at end of buffer
- bufferAddToEnd(&uartTxBuffer, *buffer++);
- }
-
- // send the first byte to get things going by interrupts
- uartBufferedTx = TRUE;
- uartSendByte(first);
- // return success
- return TRUE;
- }
- else
- {
- // return failure
- return FALSE;
- }
-}
-*/
-//! UART Transmit Complete Interrupt Handler
-UART_INTERRUPT_HANDLER(SIG_UART_TRANS)
-{
- // check if buffered tx is enabled
- if(uartBufferedTx)
- {
- // check if there's data left in the buffer
- if(uartTxBuffer.datalength)
- {
- // send byte from top of buffer
- outb(UDR, bufferGetFromFront(&uartTxBuffer));
- }
- else
- {
- // no data left
- uartBufferedTx = FALSE;
- // return to ready state
- uartReadyTx = TRUE;
- }
- }
- else
- {
- // we're using single-byte tx mode
- // indicate transmit complete, back to ready
- uartReadyTx = TRUE;
- }
-}
-
-//! UART Receive Complete Interrupt Handler
-UART_INTERRUPT_HANDLER(SIG_UART_RECV)
-{
- u08 c;
-
- // get received char
- c = inb(UDR);
-
- // if there's a user function to handle this receive event
- if(UartRxFunc)
- {
- // call it and pass the received data
- UartRxFunc(c);
- }
- else
- {
- // otherwise do default processing
- // put received char in buffer
- // check if there's space
- if( !bufferAddToEnd(&uartRxBuffer, c) )
- {
- // no space in buffer
- // count overflow
- uartRxOverflow++;
- }
- }
-}
diff --git a/build/shared/lib/avrlib/uart.h b/build/shared/lib/avrlib/uart.h
deleted file mode 100755
index 26e915acc..000000000
--- a/build/shared/lib/avrlib/uart.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*! \file uart.h \brief UART driver with buffer support. */
-//*****************************************************************************
-//
-// File Name : 'uart.h'
-// Title : UART driver with buffer support
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 11/22/2000
-// Revised : 02/01/2004
-// Version : 1.3
-// Target MCU : ATMEL AVR Series
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef UART_H
-#define UART_H
-
-#include "global.h"
-#include "buffer.h"
-
-//! default baud rate
-//! can be changed by using uartSetBaudRate()
-#define UART_DEFAULT_BAUD_RATE 9600
-
-// buffer memory allocation defines
-// buffer sizes
-#ifndef UART_TX_BUFFER_SIZE
-#define UART_TX_BUFFER_SIZE 0x0040 ///< number of bytes for uart transmit buffer
-#endif
-#ifndef UART_RX_BUFFER_SIZE
-#define UART_RX_BUFFER_SIZE 0x0040 ///< number of bytes for uart receive buffer
-#endif
-
-// define this key if you wish to use
-// external RAM for the UART buffers
-//#define UART_BUFFER_EXTERNAL_RAM
-#ifdef UART_BUFFER_EXTERNAL_RAM
- // absolute address of uart buffers
- #define UART_TX_BUFFER_ADDR 0x1000
- #define UART_RX_BUFFER_ADDR 0x1100
-#endif
-
-// type of interrupt handler to use
-// *do not change unless you know what you're doing
-// Value may be SIGNAL or INTERRUPT
-#ifndef UART_INTERRUPT_HANDLER
-#define UART_INTERRUPT_HANDLER SIGNAL
-#endif
-
-// compatibility with most newer processors
-#ifdef UCSRB
- #define UCR UCSRB
-#endif
-// compatibility with old Mega processors
-#if defined(UBRR) && !defined(UBRRL)
- #define UBRRL UBRR
-#endif
-// compatibility with dual-uart processors
-// (if you need to use both uarts, please use the uart2 library)
-#if defined(__AVR_ATmega128__)
- #define UDR UDR0
- #define UCR UCSR0B
- #define UBRRL UBRR0L
- #define UBRRH UBRR0H
- #define SIG_UART_TRANS SIG_UART0_TRANS
- #define SIG_UART_RECV SIG_UART0_RECV
- #define SIG_UART_DATA SIG_UART0_DATA
-#endif
-#if defined(__AVR_ATmega161__)
- #define UDR UDR0
- #define UCR UCSR0B
- #define UBRRL UBRR0
- #define SIG_UART_TRANS SIG_UART0_TRANS
- #define SIG_UART_RECV SIG_UART0_RECV
- #define SIG_UART_DATA SIG_UART0_DATA
-#endif
-
-// functions
-
-//! initializes transmit and receive buffers
-// called from uartInit()
-void uartInitBuffers(void);
-
-//! initializes uart
-void uartInit(void);
-
-//! redirects received data to a user function
-void uartSetRxHandler(void (*rx_func)(unsigned char c));
-
-//! sets the uart baud rate
-void uartSetBaudRate(u32 baudrate);
-
-//! returns pointer to the receive buffer structure
-cBuffer* uartGetRxBuffer(void);
-
-//! returns pointer to the transmit buffer structure
-cBuffer* uartGetTxBuffer(void);
-
-//! sends a single byte over the uart
-void uartSendByte(u08 data);
-
-//! gets a single byte from the uart receive buffer (getchar-style)
-// returns the byte, or -1 if no byte is available
-int uartGetByte(void);
-
-//! gets a single byte from the uart receive buffer
-// Function returns TRUE if data was available, FALSE if not.
-// Actual data is returned in variable pointed to by "data".
-// example usage:
-// char myReceivedByte;
-// uartReceiveByte( &myReceivedByte );
-u08 uartReceiveByte(u08* data);
-
-//! returns TRUE/FALSE if receive buffer is empty/not-empty
-u08 uartReceiveBufferIsEmpty(void);
-
-//! flushes (deletes) all data from receive buffer
-void uartFlushReceiveBuffer(void);
-
-//! add byte to end of uart Tx buffer
-void uartAddToTxBuffer(u08 data);
-
-//! begins transmission of the transmit buffer under interrupt control
-void uartSendTxBuffer(void);
-
-//! sends a buffer of length nBytes via the uart using interrupt control
-u08 uartSendBuffer(char *buffer, u16 nBytes);
-
-#endif
-
-
diff --git a/build/shared/lib/avrlib/uart.lst b/build/shared/lib/avrlib/uart.lst
deleted file mode 100755
index cde40dc78..000000000
--- a/build/shared/lib/avrlib/uart.lst
+++ /dev/null
@@ -1,789 +0,0 @@
- 1 .file "uart.c"
- 2 .arch atmega8
- 3 __SREG__ = 0x3f
- 4 __SP_H__ = 0x3e
- 5 __SP_L__ = 0x3d
- 6 __tmp_reg__ = 0
- 7 __zero_reg__ = 1
- 8 .global __do_copy_data
- 9 .global __do_clear_bss
- 12 .text
- 13 .Ltext0:
- 86 .global uartSetBaudRate
- 88 uartSetBaudRate:
- 1:../avrlib/uart.c **** /*! \file uart.c \brief UART driver with buffer support. */
- 2:../avrlib/uart.c **** // *****************************************************************************
- 3:../avrlib/uart.c **** //
- 4:../avrlib/uart.c **** // File Name : 'uart.c'
- 5:../avrlib/uart.c **** // Title : UART driver with buffer support
- 6:../avrlib/uart.c **** // Author : Pascal Stang - Copyright (C) 2000-2002
- 7:../avrlib/uart.c **** // Created : 11/22/2000
- 8:../avrlib/uart.c **** // Revised : 06/09/2003
- 9:../avrlib/uart.c **** // Version : 1.3
- 10:../avrlib/uart.c **** // Target MCU : ATMEL AVR Series
- 11:../avrlib/uart.c **** // Editor Tabs : 4
- 12:../avrlib/uart.c **** //
- 13:../avrlib/uart.c **** // This code is distributed under the GNU Public License
- 14:../avrlib/uart.c **** // which can be found at http://www.gnu.org/licenses/gpl.txt
- 15:../avrlib/uart.c **** //
- 16:../avrlib/uart.c **** // *****************************************************************************
- 17:../avrlib/uart.c ****
- 18:../avrlib/uart.c **** #include
- 19:../avrlib/uart.c **** #include
- 20:../avrlib/uart.c **** #include
- 21:../avrlib/uart.c ****
- 22:../avrlib/uart.c **** #include "buffer.h"
- 23:../avrlib/uart.c **** #include "uart.h"
- 24:../avrlib/uart.c ****
- 25:../avrlib/uart.c **** // UART global variables
- 26:../avrlib/uart.c **** // flag variables
- 27:../avrlib/uart.c **** volatile u08 uartReadyTx; ///< uartReadyTx flag
- 28:../avrlib/uart.c **** volatile u08 uartBufferedTx; ///< uartBufferedTx flag
- 29:../avrlib/uart.c **** // receive and transmit buffers
- 30:../avrlib/uart.c **** cBuffer uartRxBuffer; ///< uart receive buffer
- 31:../avrlib/uart.c **** cBuffer uartTxBuffer; ///< uart transmit buffer
- 32:../avrlib/uart.c **** unsigned short uartRxOverflow; ///< receive overflow counter
- 33:../avrlib/uart.c ****
- 34:../avrlib/uart.c **** #ifndef UART_BUFFERS_EXTERNAL_RAM
- 35:../avrlib/uart.c **** // using internal ram,
- 36:../avrlib/uart.c **** // automatically allocate space in ram for each buffer
- 37:../avrlib/uart.c **** static char uartRxData[UART_RX_BUFFER_SIZE];
- 38:../avrlib/uart.c **** static char uartTxData[UART_TX_BUFFER_SIZE];
- 39:../avrlib/uart.c **** #endif
- 40:../avrlib/uart.c ****
- 41:../avrlib/uart.c **** typedef void (*voidFuncPtru08)(unsigned char);
- 42:../avrlib/uart.c **** volatile static voidFuncPtru08 UartRxFunc;
- 43:../avrlib/uart.c ****
- 44:../avrlib/uart.c **** //! enable and initialize the uart
- 45:../avrlib/uart.c **** void uartInit(void)
- 46:../avrlib/uart.c **** {
- 47:../avrlib/uart.c **** // initialize the buffers
- 48:../avrlib/uart.c **** uartInitBuffers();
- 49:../avrlib/uart.c **** // initialize user receive handler
- 50:../avrlib/uart.c **** UartRxFunc = 0;
- 51:../avrlib/uart.c ****
- 52:../avrlib/uart.c **** // enable RxD/TxD and interrupts
- 53:../avrlib/uart.c **** outb(UCR, BV(RXCIE)|BV(TXCIE)|BV(RXEN)|BV(TXEN));
- 54:../avrlib/uart.c ****
- 55:../avrlib/uart.c **** // set default baud rate
- 56:../avrlib/uart.c **** uartSetBaudRate(UART_DEFAULT_BAUD_RATE);
- 57:../avrlib/uart.c **** // initialize states
- 58:../avrlib/uart.c **** uartReadyTx = TRUE;
- 59:../avrlib/uart.c **** uartBufferedTx = FALSE;
- 60:../avrlib/uart.c **** // clear overflow count
- 61:../avrlib/uart.c **** uartRxOverflow = 0;
- 62:../avrlib/uart.c **** // enable interrupts
- 63:../avrlib/uart.c **** sei();
- 64:../avrlib/uart.c **** }
- 65:../avrlib/uart.c ****
- 66:../avrlib/uart.c **** //! create and initialize the uart transmit and receive buffers
- 67:../avrlib/uart.c **** void uartInitBuffers(void)
- 68:../avrlib/uart.c **** {
- 69:../avrlib/uart.c **** #ifndef UART_BUFFERS_EXTERNAL_RAM
- 70:../avrlib/uart.c **** // initialize the UART receive buffer
- 71:../avrlib/uart.c **** bufferInit(&uartRxBuffer, uartRxData, UART_RX_BUFFER_SIZE);
- 72:../avrlib/uart.c **** // initialize the UART transmit buffer
- 73:../avrlib/uart.c **** bufferInit(&uartTxBuffer, uartTxData, UART_TX_BUFFER_SIZE);
- 74:../avrlib/uart.c **** #else
- 75:../avrlib/uart.c **** // initialize the UART receive buffer
- 76:../avrlib/uart.c **** bufferInit(&uartRxBuffer, (u08*) UART_RX_BUFFER_ADDR, UART_RX_BUFFER_SIZE);
- 77:../avrlib/uart.c **** // initialize the UART transmit buffer
- 78:../avrlib/uart.c **** bufferInit(&uartTxBuffer, (u08*) UART_TX_BUFFER_ADDR, UART_TX_BUFFER_SIZE);
- 79:../avrlib/uart.c **** #endif
- 80:../avrlib/uart.c **** }
- 81:../avrlib/uart.c ****
- 82:../avrlib/uart.c **** //! redirects received data to a user function
- 83:../avrlib/uart.c **** void uartSetRxHandler(void (*rx_func)(unsigned char c))
- 84:../avrlib/uart.c **** {
- 85:../avrlib/uart.c **** // set the receive interrupt to run the supplied user function
- 86:../avrlib/uart.c **** UartRxFunc = rx_func;
- 87:../avrlib/uart.c **** }
- 88:../avrlib/uart.c ****
- 89:../avrlib/uart.c **** //! set the uart baud rate
- 90:../avrlib/uart.c **** void uartSetBaudRate(u32 baudrate)
- 91:../avrlib/uart.c **** {
- 90 .LM1:
- 91 /* prologue: frame size=0 */
- 92 /* prologue end (size=0) */
- 93 0000 DC01 movw r26,r24
- 94 0002 CB01 movw r24,r22
- 92:../avrlib/uart.c **** // calculate division factor for requested baud rate, and set it
- 93:../avrlib/uart.c **** u16 bauddiv = ((F_CPU+(baudrate*8L))/(baudrate*16L)-1);
- 96 .LM2:
- 97 0004 73E0 ldi r23,3
- 98 0006 880F 1: lsl r24
- 99 0008 991F rol r25
- 100 000a AA1F rol r26
- 101 000c BB1F rol r27
- 102 000e 7A95 dec r23
- 103 0010 D1F7 brne 1b
- 104 0012 9C01 movw r18,r24
- 105 0014 AD01 movw r20,r26
- 106 0016 220F lsl r18
- 107 0018 331F rol r19
- 108 001a 441F rol r20
- 109 001c 551F rol r21
- 110 001e 8050 subi r24,lo8(-(16000000))
- 111 0020 9C4D sbci r25,hi8(-(16000000))
- 112 0022 AB40 sbci r26,hlo8(-(16000000))
- 113 0024 BF4F sbci r27,hhi8(-(16000000))
- 114 0026 BC01 movw r22,r24
- 115 0028 CD01 movw r24,r26
- 116 002a 00D0 rcall __udivmodsi4
- 117 002c DA01 movw r26,r20
- 118 002e C901 movw r24,r18
- 119 0030 0197 sbiw r24,1
- 94:../avrlib/uart.c **** outb(UBRRL, bauddiv);
- 121 .LM3:
- 122 0032 89B9 out 41-0x20,r24
- 95:../avrlib/uart.c **** #ifdef UBRRH
- 96:../avrlib/uart.c **** outb(UBRRH, bauddiv>>8);
- 124 .LM4:
- 125 0034 892F mov r24,r25
- 126 0036 9927 clr r25
- 127 0038 80BD out 64-0x20,r24
- 128 /* epilogue: frame size=0 */
- 129 003a 0895 ret
- 130 /* epilogue end (size=1) */
- 131 /* function uartSetBaudRate size 30 (29) */
- 136 .Lscope0:
- 139 .global uartInitBuffers
- 141 uartInitBuffers:
- 143 .LM5:
- 144 /* prologue: frame size=0 */
- 145 /* prologue end (size=0) */
- 147 .LM6:
- 148 003c 40E4 ldi r20,lo8(64)
- 149 003e 50E0 ldi r21,hi8(64)
- 150 0040 60E0 ldi r22,lo8(uartRxData)
- 151 0042 70E0 ldi r23,hi8(uartRxData)
- 152 0044 80E0 ldi r24,lo8(uartRxBuffer)
- 153 0046 90E0 ldi r25,hi8(uartRxBuffer)
- 154 0048 00D0 rcall bufferInit
- 156 .LM7:
- 157 004a 40E4 ldi r20,lo8(64)
- 158 004c 50E0 ldi r21,hi8(64)
- 159 004e 60E0 ldi r22,lo8(uartTxData)
- 160 0050 70E0 ldi r23,hi8(uartTxData)
- 161 0052 80E0 ldi r24,lo8(uartTxBuffer)
- 162 0054 90E0 ldi r25,hi8(uartTxBuffer)
- 163 0056 00D0 rcall bufferInit
- 164 /* epilogue: frame size=0 */
- 165 0058 0895 ret
- 166 /* epilogue end (size=1) */
- 167 /* function uartInitBuffers size 15 (14) */
- 169 .Lscope1:
- 172 .global uartInit
- 174 uartInit:
- 176 .LM8:
- 177 /* prologue: frame size=0 */
- 178 /* prologue end (size=0) */
- 180 .LM9:
- 181 005a F0DF rcall uartInitBuffers
- 183 .LM10:
- 184 005c 1092 0000 sts (UartRxFunc)+1,__zero_reg__
- 185 0060 1092 0000 sts UartRxFunc,__zero_reg__
- 187 .LM11:
- 188 0064 88ED ldi r24,lo8(-40)
- 189 0066 8AB9 out 42-0x20,r24
- 191 .LM12:
- 192 0068 60E8 ldi r22,lo8(9600)
- 193 006a 75E2 ldi r23,hi8(9600)
- 194 006c 80E0 ldi r24,hlo8(9600)
- 195 006e 90E0 ldi r25,hhi8(9600)
- 196 0070 C7DF rcall uartSetBaudRate
- 198 .LM13:
- 199 0072 8FEF ldi r24,lo8(-1)
- 200 0074 8093 0000 sts uartReadyTx,r24
- 202 .LM14:
- 203 0078 1092 0000 sts uartBufferedTx,__zero_reg__
- 205 .LM15:
- 206 007c 1092 0000 sts (uartRxOverflow)+1,__zero_reg__
- 207 0080 1092 0000 sts uartRxOverflow,__zero_reg__
- 209 .LM16:
- 210 /* #APP */
- 211 0084 7894 sei
- 212 /* #NOAPP */
- 213 /* epilogue: frame size=0 */
- 214 0086 0895 ret
- 215 /* epilogue end (size=1) */
- 216 /* function uartInit size 24 (23) */
- 218 .Lscope2:
- 222 .global uartSetRxHandler
- 224 uartSetRxHandler:
- 226 .LM17:
- 227 /* prologue: frame size=0 */
- 228 /* prologue end (size=0) */
- 230 .LM18:
- 231 0088 9093 0000 sts (UartRxFunc)+1,r25
- 232 008c 8093 0000 sts UartRxFunc,r24
- 233 /* epilogue: frame size=0 */
- 234 0090 0895 ret
- 235 /* epilogue end (size=1) */
- 236 /* function uartSetRxHandler size 5 (4) */
- 238 .Lscope3:
- 241 .global uartGetRxBuffer
- 243 uartGetRxBuffer:
- 97:../avrlib/uart.c **** #endif
- 98:../avrlib/uart.c **** }
- 99:../avrlib/uart.c ****
- 100:../avrlib/uart.c **** //! returns the receive buffer structure
- 101:../avrlib/uart.c **** cBuffer* uartGetRxBuffer(void)
- 102:../avrlib/uart.c **** {
- 245 .LM19:
- 246 /* prologue: frame size=0 */
- 247 /* prologue end (size=0) */
- 103:../avrlib/uart.c **** // return rx buffer pointer
- 104:../avrlib/uart.c **** return &uartRxBuffer;
- 105:../avrlib/uart.c **** }
- 249 .LM20:
- 250 0092 80E0 ldi r24,lo8(uartRxBuffer)
- 251 0094 90E0 ldi r25,hi8(uartRxBuffer)
- 252 /* epilogue: frame size=0 */
- 253 0096 0895 ret
- 254 /* epilogue end (size=1) */
- 255 /* function uartGetRxBuffer size 3 (2) */
- 257 .Lscope4:
- 260 .global uartGetTxBuffer
- 262 uartGetTxBuffer:
- 106:../avrlib/uart.c ****
- 107:../avrlib/uart.c **** //! returns the transmit buffer structure
- 108:../avrlib/uart.c **** cBuffer* uartGetTxBuffer(void)
- 109:../avrlib/uart.c **** {
- 264 .LM21:
- 265 /* prologue: frame size=0 */
- 266 /* prologue end (size=0) */
- 110:../avrlib/uart.c **** // return tx buffer pointer
- 111:../avrlib/uart.c **** return &uartTxBuffer;
- 112:../avrlib/uart.c **** }
- 268 .LM22:
- 269 0098 80E0 ldi r24,lo8(uartTxBuffer)
- 270 009a 90E0 ldi r25,hi8(uartTxBuffer)
- 271 /* epilogue: frame size=0 */
- 272 009c 0895 ret
- 273 /* epilogue end (size=1) */
- 274 /* function uartGetTxBuffer size 3 (2) */
- 276 .Lscope5:
- 280 .global uartSendByte
- 282 uartSendByte:
- 113:../avrlib/uart.c ****
- 114:../avrlib/uart.c **** //! transmits a byte over the uart
- 115:../avrlib/uart.c **** void uartSendByte(u08 txData)
- 116:../avrlib/uart.c **** {
- 284 .LM23:
- 285 /* prologue: frame size=0 */
- 286 /* prologue end (size=0) */
- 287 009e 982F mov r25,r24
- 288 .L8:
- 117:../avrlib/uart.c **** // wait for the transmitter to be ready
- 118:../avrlib/uart.c **** while(!uartReadyTx);
- 290 .LM24:
- 291 00a0 8091 0000 lds r24,uartReadyTx
- 292 00a4 8823 tst r24
- 293 00a6 E1F3 breq .L8
- 119:../avrlib/uart.c **** // send byte
- 120:../avrlib/uart.c **** outb(UDR, txData);
- 295 .LM25:
- 296 00a8 9CB9 out 44-0x20,r25
- 121:../avrlib/uart.c **** // set ready state to FALSE
- 122:../avrlib/uart.c **** uartReadyTx = FALSE;
- 298 .LM26:
- 299 00aa 1092 0000 sts uartReadyTx,__zero_reg__
- 300 /* epilogue: frame size=0 */
- 301 00ae 0895 ret
- 302 /* epilogue end (size=1) */
- 303 /* function uartSendByte size 9 (8) */
- 305 .Lscope6:
- 309 .global uartReceiveByte
- 311 uartReceiveByte:
- 123:../avrlib/uart.c **** }
- 124:../avrlib/uart.c ****
- 125:../avrlib/uart.c **** //! gets a single byte from the uart receive buffer (getchar-style)
- 126:../avrlib/uart.c **** int uartGetByte(void)
- 127:../avrlib/uart.c **** {
- 128:../avrlib/uart.c **** u08 c;
- 129:../avrlib/uart.c **** if(uartReceiveByte(&c))
- 130:../avrlib/uart.c **** return c;
- 131:../avrlib/uart.c **** else
- 132:../avrlib/uart.c **** return -1;
- 133:../avrlib/uart.c **** }
- 134:../avrlib/uart.c ****
- 135:../avrlib/uart.c **** //! gets a byte (if available) from the uart receive buffer
- 136:../avrlib/uart.c **** u08 uartReceiveByte(u08* rxData)
- 137:../avrlib/uart.c **** {
- 313 .LM27:
- 314 /* prologue: frame size=0 */
- 315 00b0 CF93 push r28
- 316 00b2 DF93 push r29
- 317 /* prologue end (size=2) */
- 318 00b4 EC01 movw r28,r24
- 138:../avrlib/uart.c **** // make sure we have a receive buffer
- 139:../avrlib/uart.c **** if(uartRxBuffer.size)
- 320 .LM28:
- 321 00b6 8091 0000 lds r24,uartRxBuffer+2
- 322 00ba 9091 0000 lds r25,(uartRxBuffer+2)+1
- 323 00be 0097 sbiw r24,0
- 324 00c0 61F0 breq .L11
- 140:../avrlib/uart.c **** {
- 141:../avrlib/uart.c **** // make sure we have data
- 142:../avrlib/uart.c **** if(uartRxBuffer.datalength)
- 326 .LM29:
- 327 00c2 8091 0000 lds r24,uartRxBuffer+4
- 328 00c6 9091 0000 lds r25,(uartRxBuffer+4)+1
- 329 00ca 0097 sbiw r24,0
- 330 00cc 31F0 breq .L11
- 143:../avrlib/uart.c **** {
- 144:../avrlib/uart.c **** // get byte from beginning of buffer
- 145:../avrlib/uart.c **** *rxData = bufferGetFromFront(&uartRxBuffer);
- 332 .LM30:
- 333 00ce 80E0 ldi r24,lo8(uartRxBuffer)
- 334 00d0 90E0 ldi r25,hi8(uartRxBuffer)
- 335 00d2 00D0 rcall bufferGetFromFront
- 336 00d4 8883 st Y,r24
- 146:../avrlib/uart.c **** return TRUE;
- 338 .LM31:
- 339 00d6 8FEF ldi r24,lo8(255)
- 340 00d8 90E0 ldi r25,hi8(255)
- 341 .L11:
- 342 /* epilogue: frame size=0 */
- 343 00da DF91 pop r29
- 344 00dc CF91 pop r28
- 345 00de 0895 ret
- 346 /* epilogue end (size=3) */
- 347 /* function uartReceiveByte size 24 (19) */
- 349 .Lscope7:
- 352 .global uartGetByte
- 354 uartGetByte:
- 356 .LM32:
- 357 /* prologue: frame size=1 */
- 358 00e0 CF93 push r28
- 359 00e2 DF93 push r29
- 360 00e4 CDB7 in r28,__SP_L__
- 361 00e6 DEB7 in r29,__SP_H__
- 362 00e8 2197 sbiw r28,1
- 363 00ea 0FB6 in __tmp_reg__,__SREG__
- 364 00ec F894 cli
- 365 00ee DEBF out __SP_H__,r29
- 366 00f0 0FBE out __SREG__,__tmp_reg__
- 367 00f2 CDBF out __SP_L__,r28
- 368 /* prologue end (size=10) */
- 370 .LM33:
- 371 00f4 CE01 movw r24,r28
- 372 00f6 0196 adiw r24,1
- 373 00f8 DBDF rcall uartReceiveByte
- 374 00fa 8823 tst r24
- 375 00fc 19F0 breq .L17
- 377 .LM34:
- 378 00fe 8981 ldd r24,Y+1
- 379 0100 9927 clr r25
- 380 0102 02C0 rjmp .L16
- 381 .L17:
- 383 .LM35:
- 384 0104 8FEF ldi r24,lo8(-1)
- 385 0106 9FEF ldi r25,hi8(-1)
- 386 .L16:
- 387 /* epilogue: frame size=1 */
- 388 0108 2196 adiw r28,1
- 389 010a 0FB6 in __tmp_reg__,__SREG__
- 390 010c F894 cli
- 391 010e DEBF out __SP_H__,r29
- 392 0110 0FBE out __SREG__,__tmp_reg__
- 393 0112 CDBF out __SP_L__,r28
- 394 0114 DF91 pop r29
- 395 0116 CF91 pop r28
- 396 0118 0895 ret
- 397 /* epilogue end (size=9) */
- 398 /* function uartGetByte size 29 (10) */
- 403 .Lscope8:
- 406 .global uartFlushReceiveBuffer
- 408 uartFlushReceiveBuffer:
- 147:../avrlib/uart.c **** }
- 148:../avrlib/uart.c **** else
- 149:../avrlib/uart.c **** {
- 150:../avrlib/uart.c **** // no data
- 151:../avrlib/uart.c **** return FALSE;
- 152:../avrlib/uart.c **** }
- 153:../avrlib/uart.c **** }
- 154:../avrlib/uart.c **** else
- 155:../avrlib/uart.c **** {
- 156:../avrlib/uart.c **** // no buffer
- 157:../avrlib/uart.c **** return FALSE;
- 158:../avrlib/uart.c **** }
- 159:../avrlib/uart.c **** }
- 160:../avrlib/uart.c ****
- 161:../avrlib/uart.c **** //! flush all data out of the receive buffer
- 162:../avrlib/uart.c **** void uartFlushReceiveBuffer(void)
- 163:../avrlib/uart.c **** {
- 410 .LM36:
- 411 /* prologue: frame size=0 */
- 412 /* prologue end (size=0) */
- 164:../avrlib/uart.c **** // flush all data from receive buffer
- 165:../avrlib/uart.c **** //bufferFlush(&uartRxBuffer);
- 166:../avrlib/uart.c **** // same effect as above
- 167:../avrlib/uart.c **** uartRxBuffer.datalength = 0;
- 414 .LM37:
- 415 011a 1092 0000 sts (uartRxBuffer+4)+1,__zero_reg__
- 416 011e 1092 0000 sts uartRxBuffer+4,__zero_reg__
- 417 /* epilogue: frame size=0 */
- 418 0122 0895 ret
- 419 /* epilogue end (size=1) */
- 420 /* function uartFlushReceiveBuffer size 5 (4) */
- 422 .Lscope9:
- 425 .global uartReceiveBufferIsEmpty
- 427 uartReceiveBufferIsEmpty:
- 168:../avrlib/uart.c **** }
- 169:../avrlib/uart.c ****
- 170:../avrlib/uart.c **** //! return true if uart receive buffer is empty
- 171:../avrlib/uart.c **** u08 uartReceiveBufferIsEmpty(void)
- 172:../avrlib/uart.c **** {
- 429 .LM38:
- 430 /* prologue: frame size=0 */
- 431 /* prologue end (size=0) */
- 173:../avrlib/uart.c **** if(uartRxBuffer.datalength == 0)
- 433 .LM39:
- 434 0124 8091 0000 lds r24,uartRxBuffer+4
- 435 0128 9091 0000 lds r25,(uartRxBuffer+4)+1
- 436 012c 892B or r24,r25
- 437 012e 19F4 brne .L21
- 174:../avrlib/uart.c **** {
- 175:../avrlib/uart.c **** return TRUE;
- 439 .LM40:
- 440 0130 8FEF ldi r24,lo8(255)
- 441 0132 90E0 ldi r25,hi8(255)
- 442 0134 0895 ret
- 443 .L21:
- 176:../avrlib/uart.c **** }
- 177:../avrlib/uart.c **** else
- 178:../avrlib/uart.c **** {
- 179:../avrlib/uart.c **** return FALSE;
- 445 .LM41:
- 446 0136 80E0 ldi r24,lo8(0)
- 447 0138 90E0 ldi r25,hi8(0)
- 180:../avrlib/uart.c **** }
- 181:../avrlib/uart.c **** }
- 449 .LM42:
- 450 013a 0895 ret
- 451 /* epilogue: frame size=0 */
- 452 013c 0895 ret
- 453 /* epilogue end (size=1) */
- 454 /* function uartReceiveBufferIsEmpty size 13 (12) */
- 456 .Lscope10:
- 460 .global uartAddToTxBuffer
- 462 uartAddToTxBuffer:
- 182:../avrlib/uart.c ****
- 183:../avrlib/uart.c **** //! add byte to end of uart Tx buffer
- 184:../avrlib/uart.c **** void uartAddToTxBuffer(u08 data)
- 185:../avrlib/uart.c **** {
- 464 .LM43:
- 465 /* prologue: frame size=0 */
- 466 /* prologue end (size=0) */
- 186:../avrlib/uart.c **** // add data byte to the end of the tx buffer
- 187:../avrlib/uart.c **** bufferAddToEnd(&uartTxBuffer, data);
- 468 .LM44:
- 469 013e 682F mov r22,r24
- 470 0140 80E0 ldi r24,lo8(uartTxBuffer)
- 471 0142 90E0 ldi r25,hi8(uartTxBuffer)
- 472 0144 00D0 rcall bufferAddToEnd
- 473 /* epilogue: frame size=0 */
- 474 0146 0895 ret
- 475 /* epilogue end (size=1) */
- 476 /* function uartAddToTxBuffer size 5 (4) */
- 478 .Lscope11:
- 481 .global uartSendTxBuffer
- 483 uartSendTxBuffer:
- 188:../avrlib/uart.c **** }
- 189:../avrlib/uart.c ****
- 190:../avrlib/uart.c **** //! start transmission of the current uart Tx buffer contents
- 191:../avrlib/uart.c **** void uartSendTxBuffer(void)
- 192:../avrlib/uart.c **** {
- 485 .LM45:
- 486 /* prologue: frame size=0 */
- 487 /* prologue end (size=0) */
- 193:../avrlib/uart.c **** // turn on buffered transmit
- 194:../avrlib/uart.c **** uartBufferedTx = TRUE;
- 489 .LM46:
- 490 0148 8FEF ldi r24,lo8(-1)
- 491 014a 8093 0000 sts uartBufferedTx,r24
- 195:../avrlib/uart.c **** // send the first byte to get things going by interrupts
- 196:../avrlib/uart.c **** uartSendByte(bufferGetFromFront(&uartTxBuffer));
- 493 .LM47:
- 494 014e 80E0 ldi r24,lo8(uartTxBuffer)
- 495 0150 90E0 ldi r25,hi8(uartTxBuffer)
- 496 0152 00D0 rcall bufferGetFromFront
- 497 0154 A4DF rcall uartSendByte
- 498 /* epilogue: frame size=0 */
- 499 0156 0895 ret
- 500 /* epilogue end (size=1) */
- 501 /* function uartSendTxBuffer size 8 (7) */
- 503 .Lscope12:
- 506 .global __vector_13
- 508 __vector_13:
- 197:../avrlib/uart.c **** }
- 198:../avrlib/uart.c **** /*
- 199:../avrlib/uart.c **** //! transmit nBytes from buffer out the uart
- 200:../avrlib/uart.c **** u08 uartSendBuffer(char *buffer, u16 nBytes)
- 201:../avrlib/uart.c **** {
- 202:../avrlib/uart.c **** register u08 first;
- 203:../avrlib/uart.c **** register u16 i;
- 204:../avrlib/uart.c ****
- 205:../avrlib/uart.c **** // check if there's space (and that we have any bytes to send at all)
- 206:../avrlib/uart.c **** if((uartTxBuffer.datalength + nBytes < uartTxBuffer.size) && nBytes)
- 207:../avrlib/uart.c **** {
- 208:../avrlib/uart.c **** // grab first character
- 209:../avrlib/uart.c **** first = *buffer++;
- 210:../avrlib/uart.c **** // copy user buffer to uart transmit buffer
- 211:../avrlib/uart.c **** for(i = 0; i < nBytes-1; i++)
- 212:../avrlib/uart.c **** {
- 213:../avrlib/uart.c **** // put data bytes at end of buffer
- 214:../avrlib/uart.c **** bufferAddToEnd(&uartTxBuffer, *buffer++);
- 215:../avrlib/uart.c **** }
- 216:../avrlib/uart.c ****
- 217:../avrlib/uart.c **** // send the first byte to get things going by interrupts
- 218:../avrlib/uart.c **** uartBufferedTx = TRUE;
- 219:../avrlib/uart.c **** uartSendByte(first);
- 220:../avrlib/uart.c **** // return success
- 221:../avrlib/uart.c **** return TRUE;
- 222:../avrlib/uart.c **** }
- 223:../avrlib/uart.c **** else
- 224:../avrlib/uart.c **** {
- 225:../avrlib/uart.c **** // return failure
- 226:../avrlib/uart.c **** return FALSE;
- 227:../avrlib/uart.c **** }
- 228:../avrlib/uart.c **** }
- 229:../avrlib/uart.c **** */
- 230:../avrlib/uart.c **** //! UART Transmit Complete Interrupt Handler
- 231:../avrlib/uart.c **** UART_INTERRUPT_HANDLER(SIG_UART_TRANS)
- 232:../avrlib/uart.c **** {
- 510 .LM48:
- 511 /* prologue: frame size=0 */
- 512 0158 1F92 push __zero_reg__
- 513 015a 0F92 push __tmp_reg__
- 514 015c 0FB6 in __tmp_reg__,__SREG__
- 515 015e 0F92 push __tmp_reg__
- 516 0160 1124 clr __zero_reg__
- 517 0162 2F93 push r18
- 518 0164 3F93 push r19
- 519 0166 4F93 push r20
- 520 0168 5F93 push r21
- 521 016a 6F93 push r22
- 522 016c 7F93 push r23
- 523 016e 8F93 push r24
- 524 0170 9F93 push r25
- 525 0172 AF93 push r26
- 526 0174 BF93 push r27
- 527 0176 EF93 push r30
- 528 0178 FF93 push r31
- 529 /* prologue end (size=17) */
- 233:../avrlib/uart.c **** // check if buffered tx is enabled
- 234:../avrlib/uart.c **** if(uartBufferedTx)
- 531 .LM49:
- 532 017a 8091 0000 lds r24,uartBufferedTx
- 533 017e 8823 tst r24
- 534 0180 69F0 breq .L26
- 235:../avrlib/uart.c **** {
- 236:../avrlib/uart.c **** // check if there's data left in the buffer
- 237:../avrlib/uart.c **** if(uartTxBuffer.datalength)
- 536 .LM50:
- 537 0182 8091 0000 lds r24,uartTxBuffer+4
- 538 0186 9091 0000 lds r25,(uartTxBuffer+4)+1
- 539 018a 892B or r24,r25
- 540 018c 29F0 breq .L27
- 238:../avrlib/uart.c **** {
- 239:../avrlib/uart.c **** // send byte from top of buffer
- 240:../avrlib/uart.c **** outb(UDR, bufferGetFromFront(&uartTxBuffer));
- 542 .LM51:
- 543 018e 80E0 ldi r24,lo8(uartTxBuffer)
- 544 0190 90E0 ldi r25,hi8(uartTxBuffer)
- 545 0192 00D0 rcall bufferGetFromFront
- 546 0194 8CB9 out 44-0x20,r24
- 547 0196 05C0 rjmp .L25
- 548 .L27:
- 241:../avrlib/uart.c **** }
- 242:../avrlib/uart.c **** else
- 243:../avrlib/uart.c **** {
- 244:../avrlib/uart.c **** // no data left
- 245:../avrlib/uart.c **** uartBufferedTx = FALSE;
- 550 .LM52:
- 551 0198 1092 0000 sts uartBufferedTx,__zero_reg__
- 552 .L26:
- 246:../avrlib/uart.c **** // return to ready state
- 247:../avrlib/uart.c **** uartReadyTx = TRUE;
- 248:../avrlib/uart.c **** }
- 249:../avrlib/uart.c **** }
- 250:../avrlib/uart.c **** else
- 251:../avrlib/uart.c **** {
- 252:../avrlib/uart.c **** // we're using single-byte tx mode
- 253:../avrlib/uart.c **** // indicate transmit complete, back to ready
- 254:../avrlib/uart.c **** uartReadyTx = TRUE;
- 554 .LM53:
- 555 019c 8FEF ldi r24,lo8(-1)
- 556 019e 8093 0000 sts uartReadyTx,r24
- 557 .L25:
- 558 /* epilogue: frame size=0 */
- 559 01a2 FF91 pop r31
- 560 01a4 EF91 pop r30
- 561 01a6 BF91 pop r27
- 562 01a8 AF91 pop r26
- 563 01aa 9F91 pop r25
- 564 01ac 8F91 pop r24
- 565 01ae 7F91 pop r23
- 566 01b0 6F91 pop r22
- 567 01b2 5F91 pop r21
- 568 01b4 4F91 pop r20
- 569 01b6 3F91 pop r19
- 570 01b8 2F91 pop r18
- 571 01ba 0F90 pop __tmp_reg__
- 572 01bc 0FBE out __SREG__,__tmp_reg__
- 573 01be 0F90 pop __tmp_reg__
- 574 01c0 1F90 pop __zero_reg__
- 575 01c2 1895 reti
- 576 /* epilogue end (size=17) */
- 577 /* function __vector_13 size 54 (20) */
- 579 .Lscope13:
- 582 .global __vector_11
- 584 __vector_11:
- 255:../avrlib/uart.c **** }
- 256:../avrlib/uart.c **** }
- 257:../avrlib/uart.c ****
- 258:../avrlib/uart.c **** //! UART Receive Complete Interrupt Handler
- 259:../avrlib/uart.c **** UART_INTERRUPT_HANDLER(SIG_UART_RECV)
- 260:../avrlib/uart.c **** {
- 586 .LM54:
- 587 /* prologue: frame size=0 */
- 588 01c4 1F92 push __zero_reg__
- 589 01c6 0F92 push __tmp_reg__
- 590 01c8 0FB6 in __tmp_reg__,__SREG__
- 591 01ca 0F92 push __tmp_reg__
- 592 01cc 1124 clr __zero_reg__
- 593 01ce 2F93 push r18
- 594 01d0 3F93 push r19
- 595 01d2 4F93 push r20
- 596 01d4 5F93 push r21
- 597 01d6 6F93 push r22
- 598 01d8 7F93 push r23
- 599 01da 8F93 push r24
- 600 01dc 9F93 push r25
- 601 01de AF93 push r26
- 602 01e0 BF93 push r27
- 603 01e2 EF93 push r30
- 604 01e4 FF93 push r31
- 605 /* prologue end (size=17) */
- 261:../avrlib/uart.c **** u08 c;
- 262:../avrlib/uart.c ****
- 263:../avrlib/uart.c **** // get received char
- 264:../avrlib/uart.c **** c = inb(UDR);
- 607 .LM55:
- 608 01e6 6CB1 in r22,44-0x20
- 265:../avrlib/uart.c ****
- 266:../avrlib/uart.c **** // if there's a user function to handle this receive event
- 267:../avrlib/uart.c **** if(UartRxFunc)
- 610 .LM56:
- 611 01e8 8091 0000 lds r24,UartRxFunc
- 612 01ec 9091 0000 lds r25,(UartRxFunc)+1
- 613 01f0 892B or r24,r25
- 614 01f2 39F0 breq .L31
- 268:../avrlib/uart.c **** {
- 269:../avrlib/uart.c **** // call it and pass the received data
- 270:../avrlib/uart.c **** UartRxFunc(c);
- 616 .LM57:
- 617 01f4 E091 0000 lds r30,UartRxFunc
- 618 01f8 F091 0000 lds r31,(UartRxFunc)+1
- 619 01fc 862F mov r24,r22
- 620 01fe 0995 icall
- 621 0200 0EC0 rjmp .L30
- 622 .L31:
- 271:../avrlib/uart.c **** }
- 272:../avrlib/uart.c **** else
- 273:../avrlib/uart.c **** {
- 274:../avrlib/uart.c **** // otherwise do default processing
- 275:../avrlib/uart.c **** // put received char in buffer
- 276:../avrlib/uart.c **** // check if there's space
- 277:../avrlib/uart.c **** if( !bufferAddToEnd(&uartRxBuffer, c) )
- 624 .LM58:
- 625 0202 80E0 ldi r24,lo8(uartRxBuffer)
- 626 0204 90E0 ldi r25,hi8(uartRxBuffer)
- 627 0206 00D0 rcall bufferAddToEnd
- 628 0208 8823 tst r24
- 629 020a 49F4 brne .L30
- 278:../avrlib/uart.c **** {
- 279:../avrlib/uart.c **** // no space in buffer
- 280:../avrlib/uart.c **** // count overflow
- 281:../avrlib/uart.c **** uartRxOverflow++;
- 631 .LM59:
- 632 020c 8091 0000 lds r24,uartRxOverflow
- 633 0210 9091 0000 lds r25,(uartRxOverflow)+1
- 634 0214 0196 adiw r24,1
- 635 0216 9093 0000 sts (uartRxOverflow)+1,r25
- 636 021a 8093 0000 sts uartRxOverflow,r24
- 637 .L30:
- 638 /* epilogue: frame size=0 */
- 639 021e FF91 pop r31
- 640 0220 EF91 pop r30
- 641 0222 BF91 pop r27
- 642 0224 AF91 pop r26
- 643 0226 9F91 pop r25
- 644 0228 8F91 pop r24
- 645 022a 7F91 pop r23
- 646 022c 6F91 pop r22
- 647 022e 5F91 pop r21
- 648 0230 4F91 pop r20
- 649 0232 3F91 pop r19
- 650 0234 2F91 pop r18
- 651 0236 0F90 pop __tmp_reg__
- 652 0238 0FBE out __SREG__,__tmp_reg__
- 653 023a 0F90 pop __tmp_reg__
- 654 023c 1F90 pop __zero_reg__
- 655 023e 1895 reti
- 656 /* epilogue end (size=17) */
- 657 /* function __vector_11 size 62 (28) */
- 662 .Lscope14:
- 664 .comm uartReadyTx,1,1
- 665 .comm uartBufferedTx,1,1
- 666 .comm uartRxBuffer,8,1
- 667 .comm uartTxBuffer,8,1
- 668 .comm uartRxOverflow,2,1
- 669 .lcomm uartRxData,64
- 670 .lcomm uartTxData,64
- 671 .lcomm UartRxFunc,2
- 680 .text
- 682 Letext:
- 683 /* File "../avrlib/uart.c": code 289 = 0x0121 ( 186), prologues 46, epilogues 57 */
-DEFINED SYMBOLS
- *ABS*:00000000 uart.c
- *ABS*:0000003f __SREG__
- *ABS*:0000003e __SP_H__
- *ABS*:0000003d __SP_L__
- *ABS*:00000000 __tmp_reg__
- *ABS*:00000001 __zero_reg__
-/var/tmp//cclgUhYv.s:88 .text:00000000 uartSetBaudRate
-/var/tmp//cclgUhYv.s:141 .text:0000003c uartInitBuffers
- .bss:00000000 uartRxData
- *COM*:00000008 uartRxBuffer
-/var/tmp//cclgUhYv.s:669 .bss:00000040 uartTxData
- *COM*:00000008 uartTxBuffer
-/var/tmp//cclgUhYv.s:174 .text:0000005a uartInit
-/var/tmp//cclgUhYv.s:670 .bss:00000080 UartRxFunc
- *COM*:00000001 uartReadyTx
- *COM*:00000001 uartBufferedTx
- *COM*:00000002 uartRxOverflow
-/var/tmp//cclgUhYv.s:224 .text:00000088 uartSetRxHandler
-/var/tmp//cclgUhYv.s:243 .text:00000092 uartGetRxBuffer
-/var/tmp//cclgUhYv.s:262 .text:00000098 uartGetTxBuffer
-/var/tmp//cclgUhYv.s:282 .text:0000009e uartSendByte
-/var/tmp//cclgUhYv.s:311 .text:000000b0 uartReceiveByte
-/var/tmp//cclgUhYv.s:354 .text:000000e0 uartGetByte
-/var/tmp//cclgUhYv.s:408 .text:0000011a uartFlushReceiveBuffer
-/var/tmp//cclgUhYv.s:427 .text:00000124 uartReceiveBufferIsEmpty
-/var/tmp//cclgUhYv.s:462 .text:0000013e uartAddToTxBuffer
-/var/tmp//cclgUhYv.s:483 .text:00000148 uartSendTxBuffer
-/var/tmp//cclgUhYv.s:508 .text:00000158 __vector_13
-/var/tmp//cclgUhYv.s:584 .text:000001c4 __vector_11
-/var/tmp//cclgUhYv.s:682 .text:00000240 Letext
-
-UNDEFINED SYMBOLS
-__do_copy_data
-__do_clear_bss
-__udivmodsi4
-bufferInit
-bufferGetFromFront
-bufferAddToEnd
diff --git a/build/shared/lib/avrlib/uart2.c b/build/shared/lib/avrlib/uart2.c
deleted file mode 100755
index 3151cfa1e..000000000
--- a/build/shared/lib/avrlib/uart2.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/*! \file uart2.c \brief Dual UART driver with buffer support. */
-//*****************************************************************************
-//
-// File Name : 'uart2.c'
-// Title : Dual UART driver with buffer support
-// Author : Pascal Stang - Copyright (C) 2000-2004
-// Created : 11/20/2000
-// Revised : 07/04/2004
-// Version : 1.0
-// Target MCU : ATMEL AVR Series
-// Editor Tabs : 4
-//
-// Description : This is a UART driver for AVR-series processors with two
-// hardware UARTs such as the mega161 and mega128
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "buffer.h"
-#include "uart2.h"
-
-// UART global variables
-// flag variables
-volatile u08 uartReadyTx[2];
-volatile u08 uartBufferedTx[2];
-// receive and transmit buffers
-cBuffer uartRxBuffer[2];
-cBuffer uartTxBuffer[2];
-unsigned short uartRxOverflow[2];
-#ifndef UART_BUFFERS_EXTERNAL_RAM
- // using internal ram,
- // automatically allocate space in ram for each buffer
- static char uart0RxData[UART0_RX_BUFFER_SIZE];
- static char uart0TxData[UART0_TX_BUFFER_SIZE];
- static char uart1RxData[UART1_RX_BUFFER_SIZE];
- static char uart1TxData[UART1_TX_BUFFER_SIZE];
-#endif
-
-typedef void (*voidFuncPtru08)(unsigned char);
-volatile static voidFuncPtru08 UartRxFunc[2];
-
-void uartInit(void)
-{
- // initialize both uarts
- uart0Init();
- uart1Init();
-}
-
-void uart0Init(void)
-{
- // initialize the buffers
- uart0InitBuffers();
- // initialize user receive handlers
- UartRxFunc[0] = 0;
- // enable RxD/TxD and interrupts
- outb(UCSR0B, BV(RXCIE)|BV(TXCIE)|BV(RXEN)|BV(TXEN));
- // set default baud rate
- uartSetBaudRate(0, UART0_DEFAULT_BAUD_RATE);
- // initialize states
- uartReadyTx[0] = TRUE;
- uartBufferedTx[0] = FALSE;
- // clear overflow count
- uartRxOverflow[0] = 0;
- // enable interrupts
- sei();
-}
-
-void uart1Init(void)
-{
- // initialize the buffers
- uart1InitBuffers();
- // initialize user receive handlers
- UartRxFunc[1] = 0;
- // enable RxD/TxD and interrupts
- outb(UCSR1B, BV(RXCIE)|BV(TXCIE)|BV(RXEN)|BV(TXEN));
- // set default baud rate
- uartSetBaudRate(1, UART1_DEFAULT_BAUD_RATE);
- // initialize states
- uartReadyTx[1] = TRUE;
- uartBufferedTx[1] = FALSE;
- // clear overflow count
- uartRxOverflow[1] = 0;
- // enable interrupts
- sei();
-}
-
-void uart0InitBuffers(void)
-{
- #ifndef UART_BUFFERS_EXTERNAL_RAM
- // initialize the UART0 buffers
- bufferInit(&uartRxBuffer[0], uart0RxData, UART0_RX_BUFFER_SIZE);
- bufferInit(&uartTxBuffer[0], uart0TxData, UART0_TX_BUFFER_SIZE);
- #else
- // initialize the UART0 buffers
- bufferInit(&uartRxBuffer[0], (u08*) UART0_RX_BUFFER_ADDR, UART0_RX_BUFFER_SIZE);
- bufferInit(&uartTxBuffer[0], (u08*) UART0_TX_BUFFER_ADDR, UART0_TX_BUFFER_SIZE);
- #endif
-}
-
-void uart1InitBuffers(void)
-{
- #ifndef UART_BUFFERS_EXTERNAL_RAM
- // initialize the UART1 buffers
- bufferInit(&uartRxBuffer[1], uart1RxData, UART1_RX_BUFFER_SIZE);
- bufferInit(&uartTxBuffer[1], uart1TxData, UART1_TX_BUFFER_SIZE);
- #else
- // initialize the UART1 buffers
- bufferInit(&uartRxBuffer[1], (u08*) UART1_RX_BUFFER_ADDR, UART1_RX_BUFFER_SIZE);
- bufferInit(&uartTxBuffer[1], (u08*) UART1_TX_BUFFER_ADDR, UART1_TX_BUFFER_SIZE);
- #endif
-}
-
-void uartSetRxHandler(u08 nUart, void (*rx_func)(unsigned char c))
-{
- // make sure the uart number is within bounds
- if(nUart < 2)
- {
- // set the receive interrupt to run the supplied user function
- UartRxFunc[nUart] = rx_func;
- }
-}
-
-void uartSetBaudRate(u08 nUart, u32 baudrate)
-{
- // calculate division factor for requested baud rate, and set it
- u08 baudrateDiv;
- baudrateDiv = (u08)((F_CPU+(baudrate*8L))/(baudrate*16L)-1);
- if(nUart)
- outb(UBRR1L, baudrateDiv);
- else
- outb(UBRR0L, baudrateDiv);
-}
-
-cBuffer* uartGetRxBuffer(u08 nUart)
-{
- // return rx buffer pointer
- return &uartRxBuffer[nUart];
-}
-
-cBuffer* uartGetTxBuffer(u08 nUart)
-{
- // return tx buffer pointer
- return &uartTxBuffer[nUart];
-}
-
-void uartSendByte(u08 nUart, u08 txData)
-{
- // wait for the transmitter to be ready
- while(!uartReadyTx[nUart]);
- // send byte
- if(nUart)
- outb(UDR1, txData);
- else
- outb(UDR0, txData);
- // set ready state to FALSE
- uartReadyTx[nUart] = FALSE;
-}
-
-void uart0SendByte(u08 data)
-{
- // send byte on UART0
- uartSendByte(0, data);
-}
-
-void uart1SendByte(u08 data)
-{
- // send byte on UART1
- uartSendByte(1, data);
-}
-
-int uart0GetByte(void)
-{
- // get single byte from receive buffer (if available)
- u08 c;
- if(uartReceiveByte(0,&c))
- return c;
- else
- return -1;
-}
-
-int uart1GetByte(void)
-{
- // get single byte from receive buffer (if available)
- u08 c;
- if(uartReceiveByte(1,&c))
- return c;
- else
- return -1;
-}
-
-
-u08 uartReceiveByte(u08 nUart, u08* rxData)
-{
- // make sure we have a receive buffer
- if(uartRxBuffer[nUart].size)
- {
- // make sure we have data
- if(uartRxBuffer[nUart].datalength)
- {
- // get byte from beginning of buffer
- *rxData = bufferGetFromFront(&uartRxBuffer[nUart]);
- return TRUE;
- }
- else
- return FALSE; // no data
- }
- else
- return FALSE; // no buffer
-}
-
-void uartFlushReceiveBuffer(u08 nUart)
-{
- // flush all data from receive buffer
- bufferFlush(&uartRxBuffer[nUart]);
-}
-
-u08 uartReceiveBufferIsEmpty(u08 nUart)
-{
- return (uartRxBuffer[nUart].datalength == 0);
-}
-
-void uartAddToTxBuffer(u08 nUart, u08 data)
-{
- // add data byte to the end of the tx buffer
- bufferAddToEnd(&uartTxBuffer[nUart], data);
-}
-
-void uart0AddToTxBuffer(u08 data)
-{
- uartAddToTxBuffer(0,data);
-}
-
-void uart1AddToTxBuffer(u08 data)
-{
- uartAddToTxBuffer(1,data);
-}
-
-void uartSendTxBuffer(u08 nUart)
-{
- // turn on buffered transmit
- uartBufferedTx[nUart] = TRUE;
- // send the first byte to get things going by interrupts
- uartSendByte(nUart, bufferGetFromFront(&uartTxBuffer[nUart]));
-}
-
-u08 uartSendBuffer(u08 nUart, char *buffer, u16 nBytes)
-{
- register u08 first;
- register u16 i;
-
- // check if there's space (and that we have any bytes to send at all)
- if((uartTxBuffer[nUart].datalength + nBytes < uartTxBuffer[nUart].size) && nBytes)
- {
- // grab first character
- first = *buffer++;
- // copy user buffer to uart transmit buffer
- for(i = 0; i < nBytes-1; i++)
- {
- // put data bytes at end of buffer
- bufferAddToEnd(&uartTxBuffer[nUart], *buffer++);
- }
-
- // send the first byte to get things going by interrupts
- uartBufferedTx[nUart] = TRUE;
- uartSendByte(nUart, first);
- // return success
- return TRUE;
- }
- else
- {
- // return failure
- return FALSE;
- }
-}
-
-// UART Transmit Complete Interrupt Function
-void uartTransmitService(u08 nUart)
-{
- // check if buffered tx is enabled
- if(uartBufferedTx[nUart])
- {
- // check if there's data left in the buffer
- if(uartTxBuffer[nUart].datalength)
- {
- // send byte from top of buffer
- if(nUart)
- outb(UDR1, bufferGetFromFront(&uartTxBuffer[1]) );
- else
- outb(UDR0, bufferGetFromFront(&uartTxBuffer[0]) );
- }
- else
- {
- // no data left
- uartBufferedTx[nUart] = FALSE;
- // return to ready state
- uartReadyTx[nUart] = TRUE;
- }
- }
- else
- {
- // we're using single-byte tx mode
- // indicate transmit complete, back to ready
- uartReadyTx[nUart] = TRUE;
- }
-}
-
-// UART Receive Complete Interrupt Function
-void uartReceiveService(u08 nUart)
-{
- u08 c;
- // get received char
- if(nUart)
- c = inb(UDR1);
- else
- c = inb(UDR0);
-
- // if there's a user function to handle this receive event
- if(UartRxFunc[nUart])
- {
- // call it and pass the received data
- UartRxFunc[nUart](c);
- }
- else
- {
- // otherwise do default processing
- // put received char in buffer
- // check if there's space
- if( !bufferAddToEnd(&uartRxBuffer[nUart], c) )
- {
- // no space in buffer
- // count overflow
- uartRxOverflow[nUart]++;
- }
- }
-}
-
-UART_INTERRUPT_HANDLER(SIG_UART0_TRANS)
-{
- // service UART0 transmit interrupt
- uartTransmitService(0);
-}
-
-UART_INTERRUPT_HANDLER(SIG_UART1_TRANS)
-{
- // service UART1 transmit interrupt
- uartTransmitService(1);
-}
-
-UART_INTERRUPT_HANDLER(SIG_UART0_RECV)
-{
- // service UART0 receive interrupt
- uartReceiveService(0);
-}
-
-UART_INTERRUPT_HANDLER(SIG_UART1_RECV)
-{
- // service UART1 receive interrupt
- uartReceiveService(1);
-}
diff --git a/build/shared/lib/avrlib/uart2.h b/build/shared/lib/avrlib/uart2.h
deleted file mode 100755
index ab2d0c55e..000000000
--- a/build/shared/lib/avrlib/uart2.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*! \file uart2.h \brief Dual UART driver with buffer support. */
-//*****************************************************************************
-//
-// File Name : 'uart2.h'
-// Title : Dual UART driver with buffer support
-// Author : Pascal Stang - Copyright (C) 2000-2002
-// Created : 11/20/2000
-// Revised : 07/04/2004
-// Version : 1.0
-// Target MCU : ATMEL AVR Series
-// Editor Tabs : 4
-//
-// Description : This is a UART driver for AVR-series processors with two
-// hardware UARTs such as the mega161 and mega128
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef UART2_H
-#define UART2_H
-
-#include "global.h"
-#include "buffer.h"
-
-// default baud rate
-// can be changed by using uartSetBaudRate()
-#define UART0_DEFAULT_BAUD_RATE 9600 ///< default baud rate for UART0
-#define UART1_DEFAULT_BAUD_RATE 9600 ///< default baud rate for UART1
-
-// buffer memory allocation defines
-// buffer sizes
-#ifndef UART0_TX_BUFFER_SIZE
-#define UART0_TX_BUFFER_SIZE 0x0010 ///< number of bytes for uart0 transmit buffer
-#endif
-#ifndef UART0_RX_BUFFER_SIZE
-#define UART0_RX_BUFFER_SIZE 0x0080 ///< number of bytes for uart0 receive buffer
-#endif
-#ifndef UART1_TX_BUFFER_SIZE
-#define UART1_TX_BUFFER_SIZE 0x0010 ///< number of bytes for uart1 transmit buffer
-#endif
-#ifndef UART1_RX_BUFFER_SIZE
-#define UART1_RX_BUFFER_SIZE 0x0080 ///< number of bytes for uart1 receive buffer
-#endif
-
-// define this key if you wish to use
-// external RAM for the UART buffers
-//#define UART_BUFFER_EXTERNAL_RAM
-#ifdef UART_BUFFER_EXTERNAL_RAM
- // absolute address of uart0 buffers
- #define UART0_TX_BUFFER_ADDR 0x1000
- #define UART0_RX_BUFFER_ADDR 0x1100
- // absolute address of uart1 buffers
- #define UART1_TX_BUFFER_ADDR 0x1200
- #define UART1_RX_BUFFER_ADDR 0x1300
-#endif
-
-// type of interrupt handler to use
-// *do not change unless you know what you're doing
-// Value may be SIGNAL or INTERRUPT
-#ifndef UART_INTERRUPT_HANDLER
-#define UART_INTERRUPT_HANDLER SIGNAL
-#endif
-
-// compatibility for the mega161
-#ifndef RXCIE
- #define RXCIE RXCIE0
- #define TXCIE TXCIE0
- #define UDRIE UDRIE0
- #define RXEN RXEN0
- #define TXEN TXEN0
- #define CHR9 CHR90
- #define RXB8 RXB80
- #define TXB8 TXB80
-#endif
-#ifndef UBRR0L
- #define UBRR0L UBRR0
- #define UBRR1L UBRR1
-#endif
-
-// functions
-
-//! initializes both uarts
-void uartInit(void);
-
-//! initializes UART0 only
-void uart0Init(void);
-
-//! initializes UART1 only
-void uart1Init(void);
-
-//! initializes transmit and receive buffers
-// called from uartInit()
-void uart0InitBuffers(void);
-void uart1InitBuffers(void);
-
-//! redirects received data to a user function
-void uartSetRxHandler(u08 nUart, void (*rx_func)(unsigned char c));
-
-//! sets the uart baud rate
-void uartSetBaudRate(u08 nUart, u32 baudrate);
-
-//! returns pointer to the receive buffer structure
-cBuffer* uartGetRxBuffer(u08 nUart);
-
-//! returns pointer to the transmit buffer structure
-cBuffer* uartGetTxBuffer(u08 nUart);
-
-//! sends a single byte over the uart
-void uartSendByte(u08 nUart, u08 data);
-//! SendByte commands with the UART number hardcoded
-// use this with printfInit() - example: printfInit(uart0SendByte);
-void uart0SendByte(u08 data);
-void uart1SendByte(u08 data);
-
-//! gets a single byte from the uart receive buffer (getchar-style)
-// returns the byte, or -1 if no byte is available
-int uart0GetByte(void);
-int uart1GetByte(void);
-
-//! gets a single byte from the uart receive buffer
-// function returns TRUE if data was available, FALSE if not
-// actual data is returned in variable pointed to by "data"
-// example usage:
-// char myReceivedByte;
-// uartReceiveByte( &myReceivedByte );
-u08 uartReceiveByte(u08 nUart, u08* data);
-
-//! returns TRUE/FALSE if receive buffer is empty/not-empty
-u08 uartReceiveBufferIsEmpty(u08 nUart);
-
-//! flushes (deletes) all data from receive buffer
-void uartFlushReceiveBuffer(u08 nUart);
-
-//! add byte to end of uart Tx buffer
-void uartAddToTxBuffer(u08 nUart, u08 data);
-//! AddToTxBuffer commands with the UART number hardcoded
-// use this with printfInit() - example: printfInit(uart0AddToTxBuffer);
-void uart0AddToTxBuffer(u08 data);
-void uart1AddToTxBuffer(u08 data);
-
-//! begins transmission of the transmit buffer under interrupt control
-void uartSendTxBuffer(u08 nUart);
-
-//! sends a buffer of length nBytes via the uart using interrupt control
-u08 uartSendBuffer(u08 nUart, char *buffer, u16 nBytes);
-
-//! interrupt service handlers
-void uartTransmitService(u08 nUart);
-void uartReceiveService(u08 nUart);
-
-#endif
-
diff --git a/build/shared/lib/avrlib/uartsw.c b/build/shared/lib/avrlib/uartsw.c
deleted file mode 100755
index 95ba7628c..000000000
--- a/build/shared/lib/avrlib/uartsw.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*! \file uartsw.c \brief Software Interrupt-driven UART function library. */
-//*****************************************************************************
-//
-// File Name : 'uartsw.c'
-// Title : Software Interrupt-driven UART function library
-// Author : Pascal Stang - Copyright (C) 2002-2004
-// Created : 7/20/2002
-// Revised : 4/27/2004
-// Version : 0.1
-// Target MCU : Atmel AVR Series (intended for the ATmega16 and ATmega32)
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "global.h"
-#include "timer.h"
-#include "uartsw.h"
-
-// Program ROM constants
-
-// Global variables
-
-// uartsw transmit status and data variables
-static volatile u08 UartswTxBusy;
-static volatile u08 UartswTxData;
-static volatile u08 UartswTxBitNum;
-
-// baud rate common to transmit and receive
-static volatile u16 UartswBaudRateDiv;
-
-// uartsw receive status and data variables
-static volatile u08 UartswRxBusy;
-static volatile u08 UartswRxData;
-static volatile u08 UartswRxBitNum;
-// receive buffer
-static cBuffer uartswRxBuffer; ///< uartsw receive buffer
-// automatically allocate space in ram for each buffer
-static char uartswRxData[UARTSW_RX_BUFFER_SIZE];
-
-// functions
-
-//! enable and initialize the software uart
-void uartswInit(void)
-{
- // initialize the buffers
- uartswInitBuffers();
- // initialize the ports
- sbi(UARTSW_TX_DDR, UARTSW_TX_PIN);
- cbi(UARTSW_RX_DDR, UARTSW_RX_PIN);
- cbi(UARTSW_RX_PORT, UARTSW_RX_PIN);
- // initialize baud rate
- uartswSetBaudRate(9600);
-
- // setup the transmitter
- UartswTxBusy = FALSE;
- // disable OC1A interrupt
- cbi(TIMSK, OCIE1A);
- // attach TxBit service routine to OC1A
- timerAttach(TIMER1OUTCOMPAREA_INT, uartswTxBitService);
-
- // setup the receiver
- UartswRxBusy = FALSE;
- // disable OC1B interrupt
- cbi(TIMSK, OCIE1B);
- // attach RxBit service routine to OC1B
- timerAttach(TIMER1OUTCOMPAREB_INT, uartswRxBitService);
- // attach RxBit service routine to ICP
- timerAttach(TIMER1INPUTCAPTURE_INT, uartswRxBitService);
- // trigger on rising edge
- sbi(TCCR1B, ICES1);
- // enable ICP interrupt
- sbi(TIMSK, TICIE1);
-
- // turn on interrupts
- sei();
-}
-
-//! create and initialize the uart buffers
-void uartswInitBuffers(void)
-{
- // initialize the UART receive buffer
- bufferInit(&uartswRxBuffer, uartswRxData, UARTSW_RX_BUFFER_SIZE);
-}
-
-//! turns off software UART
-void uartswOff(void)
-{
- // disable interrupts
- cbi(TIMSK, OCIE1A);
- cbi(TIMSK, OCIE1B);
- cbi(TIMSK, TICIE1);
- // detach the service routines
- timerDetach(TIMER1OUTCOMPAREA_INT);
- timerDetach(TIMER1OUTCOMPAREB_INT);
- timerDetach(TIMER1INPUTCAPTURE_INT);
-}
-
-void uartswSetBaudRate(u32 baudrate)
-{
- // set timer prescaler
- timer1SetPrescaler(TIMER_CLK_DIV1);
- // calculate division factor for requested baud rate, and set it
- UartswBaudRateDiv = (u16)((F_CPU+(baudrate/2L))/(baudrate*1L));
-}
-
-//! returns the receive buffer structure
-cBuffer* uartswGetRxBuffer(void)
-{
- // return rx buffer pointer
- return &uartswRxBuffer;
-}
-
-void uartswSendByte(u08 data)
-{
- // wait until uart is ready
- while(UartswTxBusy);
- // set busy flag
- UartswTxBusy = TRUE;
- // save data
- UartswTxData = data;
- // set number of bits (+1 for stop bit)
- UartswTxBitNum = 9;
-
- // set the start bit
- #ifdef UARTSW_INVERT
- sbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- #else
- cbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- #endif
-
- // schedule the next bit
- outw(OCR1A, inw(TCNT1) + UartswBaudRateDiv);
- // enable OC1A interrupt
- sbi(TIMSK, OCIE1A);
-}
-
-//! gets a byte (if available) from the uart receive buffer
-u08 uartswReceiveByte(u08* rxData)
-{
- // make sure we have a receive buffer
- if(uartswRxBuffer.size)
- {
- // make sure we have data
- if(uartswRxBuffer.datalength)
- {
- // get byte from beginning of buffer
- *rxData = bufferGetFromFront(&uartswRxBuffer);
- return TRUE;
- }
- else
- {
- // no data
- return FALSE;
- }
- }
- else
- {
- // no buffer
- return FALSE;
- }
-}
-
-void uartswTxBitService(void)
-{
- if(UartswTxBitNum)
- {
- // there are bits still waiting to be transmitted
- if(UartswTxBitNum > 1)
- {
- // transmit data bits (inverted, LSB first)
- #ifdef UARTSW_INVERT
- if( !(UartswTxData & 0x01) )
- #else
- if( (UartswTxData & 0x01) )
- #endif
- sbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- else
- cbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- // shift bits down
- UartswTxData = UartswTxData>>1;
- }
- else
- {
- // transmit stop bit
- #ifdef UARTSW_INVERT
- cbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- #else
- sbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- #endif
- }
- // schedule the next bit
- outw(OCR1A, inw(OCR1A) + UartswBaudRateDiv);
- // count down
- UartswTxBitNum--;
- }
- else
- {
- // transmission is done
- // clear busy flag
- UartswTxBusy = FALSE;
- }
-}
-
-void uartswRxBitService(void)
-{
- // this function runs on either:
- // - a rising edge interrupt
- // - OC1B
- if(!UartswRxBusy)
- {
- // this is a start bit
- // disable ICP interrupt
- cbi(TIMSK, TICIE1);
- // schedule data bit sampling 1.5 bit periods from now
- outw(OCR1B, inw(TCNT1) + UartswBaudRateDiv + UartswBaudRateDiv/2);
- // clear OC1B interrupt flag
- sbi(TIFR, OCF1B);
- // enable OC1B interrupt
- sbi(TIMSK, OCIE1B);
- // set start bit flag
- UartswRxBusy = TRUE;
- // reset bit counter
- UartswRxBitNum = 0;
- // reset data
- UartswRxData = 0;
- }
- else
- {
- // start bit has already been received
- // we're in the data bits
-
- // shift data byte to make room for new bit
- UartswRxData = UartswRxData>>1;
-
- // sample the data line
- #ifdef UARTSW_INVERT
- if( !(inb(UARTSW_RX_PORTIN) & (1<= 8)
- {
- // save data in receive buffer
- bufferAddToEnd(&uartswRxBuffer, UartswRxData);
- // disable OC1B interrupt
- cbi(TIMSK, OCIE1B);
- // clear ICP interrupt flag
- sbi(TIFR, ICF1);
- // enable ICP interrupt
- sbi(TIMSK, TICIE1);
- // clear start bit flag
- UartswRxBusy = FALSE;
- }
- }
-}
-
-/*
-void uartswRxBitService(void)
-{
- u16 thisBitTime;
- u08 bitperiods;
- u08 i;
-
- // bit transition was detected
- // record bit's edge time
- thisBitTime = inw(ICR1);
-
- cbi(PORTB, 0);
-
- if(!UartswRxStartBit)
- {
- // this is a start bit
- // switch to falling-edge trigger
- cbi(TCCR1B, ICES1);
- // record bit time
- UartswRxBitTime = thisBitTime;
- // set start bit flag
- UartswRxStartBit = TRUE;
- // reset bit counter
- UartswRxBitNum = 0;
- // reset data
- UartswRxData = 0;
- }
- else
- {
- // start bit has already been received
- // we're in the data bits
-
- // how many bit periods since last edge?
- bitperiods = (thisBitTime - UartswRxBitTime + UartswBaudRateDiv/2)/UartswBaudRateDiv;
- // set last edge time
- UartswRxBitTime = thisBitTime;
-
- if(bitperiods > 10)
- {
- // switch to trigger on rising edge
- sbi(TCCR1B, ICES1);
- // clear start bit flag
- UartswRxStartBit = FALSE;
- }
- else
- {
-
-
- if( inb(TCCR1B) & (1< 8)
- {
- // save data in receive buffer
- bufferAddToEnd(&uartswRxBuffer, UartswRxData);
- // switch to trigger on rising edge
- sbi(TCCR1B, ICES1);
- // clear start bit flag
- UartswRxStartBit = FALSE;
- }
- }
- }
-
- // turn off debug LEDs
- delay(10);
- sbi(PORTB, 0);
- sbi(PORTB, 1);
-}
-*/
diff --git a/build/shared/lib/avrlib/uartsw.h b/build/shared/lib/avrlib/uartsw.h
deleted file mode 100755
index 7bb8e39c9..000000000
--- a/build/shared/lib/avrlib/uartsw.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*! \file uartsw.h \brief Interrupt-driven Software UART Driver. */
-//*****************************************************************************
-//
-// File Name : 'uartsw.h'
-// Title : Interrupt-driven Software UART Driver
-// Author : Pascal Stang - Copyright (C) 2002-2004
-// Created : 7/20/2002
-// Revised : 4/27/2004
-// Version : 0.1
-// Target MCU : Atmel AVR Series (intended for the ATmega16 and ATmega32)
-// Editor Tabs : 4
-//
-// Description :
-// This uart library emulates the operation of a UART (serial port) using
-// the AVR's hardware timers, I/O pins, and some software.
-//
-// Specifically, this code uses:
-// -Timer 1 Output Compare A for transmit timing
-// -Timer 1 Output Compare B for receive timing
-// -Timer 1 Input Capture for receive triggering
-//
-// The above resources cannot be used for other purposes while this software
-// UART is enabled. The overflow interrupt from Timer1 can still be used for
-// other timing, but the prescaler for Timer1 must not be changed.
-//
-// Serial output from this UART can be routed to any I/O pin. Serial input
-// for this UART must come from the Timer1 Input Capture (IC1) I/O pin.
-// These options should be configured by editing your local copy of
-// "uartswconf.h".
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef UARTSW_H
-#define UARTSW_H
-
-#include "global.h"
-#include "buffer.h"
-
-// include configuration
-#include "uartswconf.h"
-
-// constants/macros/typdefs
-
-// functions
-
-//! enable and initialize the software uart
-void uartswInit(void);
-//! create and initialize the uart buffers
-void uartswInitBuffers(void);
-//! turns off software UART
-void uartswOff(void);
-//! returns the receive buffer structure
-cBuffer* uartswGetRxBuffer(void);
-//! sets the uart baud rate
-void uartswSetBaudRate(u32 baudrate);
-//! sends a single byte over the uart
-void uartswSendByte(u08 data);
-
-//! gets a single byte from the uart receive buffer
-// Function returns TRUE if data was available, FALSE if not.
-// Actual data is returned in variable pointed to by "data".
-// example usage:
-// char myReceivedByte;
-// uartswReceiveByte( &myReceivedByte );
-u08 uartswReceiveByte(u08* rxData);
-
-//! internal transmit bit handler
-void uartswTxBitService(void);
-//! internal receive bit handler
-void uartswRxBitService(void);
-
-#endif
diff --git a/build/shared/lib/avrlib/uartsw2.c b/build/shared/lib/avrlib/uartsw2.c
deleted file mode 100755
index 777a8d5b9..000000000
--- a/build/shared/lib/avrlib/uartsw2.c
+++ /dev/null
@@ -1,309 +0,0 @@
-/*! \file uartsw2.c \brief Interrupt-driven Software UART Driver. */
-//*****************************************************************************
-//
-// File Name : 'uartsw2.c'
-// Title : Interrupt-driven Software UART Driver
-// Author : Pascal Stang - Copyright (C) 2002-2004
-// Created : 7/20/2002
-// Revised : 4/27/2004
-// Version : 0.6
-// Target MCU : Atmel AVR Series (intended for the ATmega16 and ATmega32)
-// Editor Tabs : 4
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#include
-#include
-#include
-
-#include "global.h"
-#include "timer.h"
-#include "uartsw2.h"
-
-// Program ROM constants
-
-// Global variables
-
-// uartsw transmit status and data variables
-static volatile u08 UartswTxBusy;
-static volatile u08 UartswTxData;
-static volatile u08 UartswTxBitNum;
-
-// baud rate common to transmit and receive
-static volatile u08 UartswBaudRateDiv;
-
-// uartsw receive status and data variables
-static volatile u08 UartswRxBusy;
-static volatile u08 UartswRxData;
-static volatile u08 UartswRxBitNum;
-// receive buffer
-static cBuffer uartswRxBuffer; ///< uartsw receive buffer
-// automatically allocate space in ram for each buffer
-static char uartswRxData[UARTSW_RX_BUFFER_SIZE];
-
-// functions
-
-//! enable and initialize the software uart
-void uartswInit(void)
-{
- // initialize the buffers
- uartswInitBuffers();
- // initialize the ports
- sbi(UARTSW_TX_DDR, UARTSW_TX_PIN);
- #ifdef UARTSW_INVERT
- cbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- #else
- sbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- #endif
- cbi(UARTSW_RX_DDR, UARTSW_RX_PIN);
- cbi(UARTSW_RX_PORT, UARTSW_RX_PIN);
- // initialize baud rate
- uartswSetBaudRate(9600);
-
- // setup the transmitter
- UartswTxBusy = FALSE;
- // disable OC2 interrupt
- cbi(TIMSK, OCIE2);
- // attach TxBit service routine to OC2
- timerAttach(TIMER2OUTCOMPARE_INT, uartswTxBitService);
-
- // setup the receiver
- UartswRxBusy = FALSE;
- // disable OC0 interrupt
- cbi(TIMSK, OCIE0);
- // attach RxBit service routine to OC0
- timerAttach(TIMER0OUTCOMPARE_INT, uartswRxBitService);
- // INT2 trigger on rising/falling edge
- #ifdef UARTSW_INVERT
- sbi(MCUCSR, ISC2); // rising edge
- #else
- cbi(MCUCSR, ISC2); // falling edge
- #endif
- // enable INT2 interrupt
- sbi(GICR, INT2);
-
- // turn on interrupts
- sei();
-}
-
-//! create and initialize the uart buffers
-void uartswInitBuffers(void)
-{
- // initialize the UART receive buffer
- bufferInit(&uartswRxBuffer, uartswRxData, UARTSW_RX_BUFFER_SIZE);
-}
-
-//! turns off software UART
-void uartswOff(void)
-{
- // disable interrupts
- cbi(TIMSK, OCIE2);
- cbi(TIMSK, OCIE0);
- cbi(GICR, INT2);
- // detach the service routines
- timerDetach(TIMER2OUTCOMPARE_INT);
- timerDetach(TIMER0OUTCOMPARE_INT);
-}
-
-void uartswSetBaudRate(u32 baudrate)
-{
- u16 div;
-
- // set timer prescaler
- if( baudrate > (F_CPU/64L*256L) )
- {
- // if the requested baud rate is high,
- // set timer prescalers to div-by-64
- timer2SetPrescaler(TIMERRTC_CLK_DIV64);
- timer0SetPrescaler(TIMER_CLK_DIV64);
- div = 64;
- }
- else
- {
- // if the requested baud rate is low,
- // set timer prescalers to div-by-256
- timer2SetPrescaler(TIMERRTC_CLK_DIV256);
- timer0SetPrescaler(TIMER_CLK_DIV256);
- div = 256;
- }
-
- // calculate division factor for requested baud rate, and set it
- //UartswBaudRateDiv = (u08)(((F_CPU/64L)+(baudrate/2L))/(baudrate*1L));
- //UartswBaudRateDiv = (u08)(((F_CPU/256L)+(baudrate/2L))/(baudrate*1L));
- UartswBaudRateDiv = (u08)(((F_CPU/div)+(baudrate/2L))/(baudrate*1L));
-}
-
-//! returns the receive buffer structure
-cBuffer* uartswGetRxBuffer(void)
-{
- // return rx buffer pointer
- return &uartswRxBuffer;
-}
-
-void uartswSendByte(u08 data)
-{
- // wait until uart is ready
- while(UartswTxBusy);
- // set busy flag
- UartswTxBusy = TRUE;
- // save data
- UartswTxData = data;
- // set number of bits (+1 for stop bit)
- UartswTxBitNum = 9;
-
- // set the start bit
- #ifdef UARTSW_INVERT
- sbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- #else
- cbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- #endif
- // schedule the next bit
- outb(OCR2, inb(TCNT2) + UartswBaudRateDiv);
- // enable OC2 interrupt
- sbi(TIMSK, OCIE2);
-}
-
-//! gets a byte (if available) from the uart receive buffer
-u08 uartswReceiveByte(u08* rxData)
-{
- // make sure we have a receive buffer
- if(uartswRxBuffer.size)
- {
- // make sure we have data
- if(uartswRxBuffer.datalength)
- {
- // get byte from beginning of buffer
- *rxData = bufferGetFromFront(&uartswRxBuffer);
- return TRUE;
- }
- else
- {
- // no data
- return FALSE;
- }
- }
- else
- {
- // no buffer
- return FALSE;
- }
-}
-
-void uartswTxBitService(void)
-{
- if(UartswTxBitNum)
- {
- // there are bits still waiting to be transmitted
- if(UartswTxBitNum > 1)
- {
- // transmit data bits (inverted, LSB first)
- #ifdef UARTSW_INVERT
- if( !(UartswTxData & 0x01) )
- #else
- if( (UartswTxData & 0x01) )
- #endif
- sbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- else
- cbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- // shift bits down
- UartswTxData = UartswTxData>>1;
- }
- else
- {
- // transmit stop bit
- #ifdef UARTSW_INVERT
- cbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- #else
- sbi(UARTSW_TX_PORT, UARTSW_TX_PIN);
- #endif
- }
- // schedule the next bit
- outb(OCR2, inb(OCR2) + UartswBaudRateDiv);
- // count down
- UartswTxBitNum--;
- }
- else
- {
- // transmission is done
- // clear busy flag
- UartswTxBusy = FALSE;
- // disable OC2 interrupt
- cbi(TIMSK, OCIE2);
- }
-}
-
-void uartswRxBitService(void)
-{
- // this function runs on either:
- // - a rising edge interrupt
- // - Timer 0 output compare
- if(!UartswRxBusy)
- {
- // UART was not previously busy,
- // this must be is a start bit
-
- // disable INT2 interrupt
- cbi(GICR, INT2);
- // schedule data bit sampling 1.5 bit periods from now
- outb(OCR0, inb(TCNT0) + UartswBaudRateDiv + UartswBaudRateDiv/2);
- // clear OC0 interrupt flag
- sbi(TIFR, OCF0);
- // enable OC0 interrupt
- sbi(TIMSK, OCIE0);
- // set busy flag
- UartswRxBusy = TRUE;
- // reset bit counter
- UartswRxBitNum = 0;
- // reset data
- UartswRxData = 0;
- }
- else
- {
- // start bit has already been received
- // we're in the data bits
-
- // shift data byte to make room for new bit
- UartswRxData = UartswRxData>>1;
-
- // sample the data line
- #ifdef UARTSW_INVERT
- if( !(inb(UARTSW_RX_PORTIN) & (1<= 8)
- {
- // save data in receive buffer
- bufferAddToEnd(&uartswRxBuffer, UartswRxData);
- // disable OC0 interrupt
- cbi(TIMSK, OCIE0);
- // clear INT2 interrupt flag
- sbi(GIFR, INTF2);
- // enable INT interrupt
- sbi(GICR, INT2);
- // clear busy flag
- UartswRxBusy = FALSE;
- }
- }
-}
-
-SIGNAL(SIG_INTERRUPT2)
-{
- // run RxBit service routine
- uartswRxBitService();
-}
diff --git a/build/shared/lib/avrlib/uartsw2.h b/build/shared/lib/avrlib/uartsw2.h
deleted file mode 100755
index a0fd43c6c..000000000
--- a/build/shared/lib/avrlib/uartsw2.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*! \file uartsw2.h \brief Interrupt-driven Software UART Driver. */
-//*****************************************************************************
-//
-// File Name : 'uartsw2.h'
-// Title : Interrupt-driven Software UART Driver
-// Author : Pascal Stang - Copyright (C) 2002-2003
-// Created : 7/20/2002
-// Revised : 4/27/2004
-// Version : 0.6
-// Target MCU : Atmel AVR Series (intended for the ATmega16 and ATmega32)
-// Editor Tabs : 4
-//
-// Description :
-// This uart library emulates the operation of a UART (serial port) using
-// the AVR's hardware timers, I/O pins, and some software.
-//
-// Specifically, this code uses:
-// -Timer 2 Output Capture for transmit timing
-// -Timer 0 Output Capture for receive timing
-// -External Interrupt 2 for receive triggering
-//
-// The above resources cannot be used for other purposes while this software
-// UART is enabled. The overflow interrupts from Timer0 and Timer2 can still
-// be used for other timing, but the prescalers for these timers must not be
-// changed.
-//
-// Serial output from this UART can be routed to any I/O pin. Serial input
-// for this UART must come from the External Interrupt 2 (INT2) I/O pin.
-// These options should be configured by editing your local copy of
-// "uartsw2conf.h".
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef UARTSW2_H
-#define UARTSW2_H
-
-#include "global.h"
-#include "buffer.h"
-
-// include configuration
-#include "uartsw2conf.h"
-
-// constants/macros/typdefs
-
-// functions
-
-//! enable and initialize the software uart
-void uartswInit(void);
-//! create and initialize the uart buffers
-void uartswInitBuffers(void);
-//! turns off software UART
-void uartswOff(void);
-//! returns the receive buffer structure
-cBuffer* uartswGetRxBuffer(void);
-//! sets the uart baud rate
-void uartswSetBaudRate(u32 baudrate);
-//! sends a single byte over the uart
-void uartswSendByte(u08 data);
-
-//! gets a single byte from the uart receive buffer
-// Function returns TRUE if data was available, FALSE if not.
-// Actual data is returned in variable pointed to by "data".
-// example usage:
-// char myReceivedByte;
-// uartswReceiveByte( &myReceivedByte );
-u08 uartswReceiveByte(u08* rxData);
-
-//! internal transmit bit handler
-void uartswTxBitService(void);
-//! internal receive bit handler
-void uartswRxBitService(void);
-
-#endif
diff --git a/build/shared/lib/avrlib/vt100.c b/build/shared/lib/avrlib/vt100.c
deleted file mode 100755
index 8a1322142..000000000
--- a/build/shared/lib/avrlib/vt100.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*! \file vt100.c \brief VT100 terminal function library. */
-//*****************************************************************************
-//
-// File Name : 'vt100.c'
-// Title : VT100 terminal function library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 2002.08.27
-// Revised : 2002.08.27
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef WIN32
- #include
- #include
- #include
- #include
-#endif
-
-#include "global.h"
-#include "rprintf.h"
-#include "vt100.h"
-
-// Program ROM constants
-
-// Global variables
-
-// Functions
-void vt100Init(void)
-{
- // initializes terminal to "power-on" settings
- // ESC c
- rprintfProgStrM("\x1B\x63");
-}
-
-void vt100ClearScreen(void)
-{
- // ESC [ 2 J
- rprintfProgStrM("\x1B[2J");
-}
-
-void vt100SetAttr(u08 attr)
-{
- // ESC [ Ps m
- rprintf("\x1B[%dm",attr);
-}
-
-void vt100SetCursorMode(u08 visible)
-{
- if(visible)
- // ESC [ ? 25 h
- rprintf("\x1B[?25h");
- else
- // ESC [ ? 25 l
- rprintf("\x1B[?25l");
-}
-
-void vt100SetCursorPos(u08 line, u08 col)
-{
- // ESC [ Pl ; Pc H
- rprintf("\x1B[%d;%dH",line,col);
-}
-
diff --git a/build/shared/lib/avrlib/vt100.h b/build/shared/lib/avrlib/vt100.h
deleted file mode 100755
index 9f483cdaf..000000000
--- a/build/shared/lib/avrlib/vt100.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*! \file vt100.h \brief VT100 terminal function library. */
-//*****************************************************************************
-//
-// File Name : 'vt100.h'
-// Title : VT100 terminal function library
-// Author : Pascal Stang - Copyright (C) 2002
-// Created : 2002.08.27
-// Revised : 2002.08.27
-// Version : 0.1
-// Target MCU : Atmel AVR Series
-// Editor Tabs : 4
-//
-// NOTE: This code is currently below version 1.0, and therefore is considered
-// to be lacking in some functionality or documentation, or may not be fully
-// tested. Nonetheless, you can expect most functions to work.
-//
-// This code is distributed under the GNU Public License
-// which can be found at http://www.gnu.org/licenses/gpl.txt
-//
-//*****************************************************************************
-
-#ifndef VT100_H
-#define VT100_H
-
-#include "global.h"
-
-// constants/macros/typdefs
-// text attributes
-#define VT100_ATTR_OFF 0
-#define VT100_BOLD 1
-#define VT100_USCORE 4
-#define VT100_BLINK 5
-#define VT100_REVERSE 7
-#define VT100_BOLD_OFF 21
-#define VT100_USCORE_OFF 24
-#define VT100_BLINK_OFF 25
-#define VT100_REVERSE_OFF 27
-
-// functions
-
-// vt100Init() initializes terminal and vt100 library
-// Run this init routine once before using any other vt100 function.
-void vt100Init(void);
-
-// vt100ClearScreen() clears the terminal screen
-void vt100ClearScreen(void);
-
-// vt100SetAttr() sets the text attributes like BOLD or REVERSE
-// Text written to the terminal after this function is called will have
-// the desired attribuutes.
-void vt100SetAttr(u08 attr);
-
-// vt100SetCursorMode() sets the cursor to visible or invisible
-void vt100SetCursorMode(u08 visible);
-
-// vt100SetCursorPos() sets the cursor position
-// All text which is written to the terminal after a SetCursorPos command
-// will begin at the new location of the cursor.
-void vt100SetCursorPos(u08 line, u08 col);
-
-#endif