From f1baf12fae61a13e6d8e88655d709d74977322b5 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Thu, 3 Dec 2009 08:35:32 +0000 Subject: [PATCH] Auto-configure AVRISP programmer configuration when built for the XPLAIN board to match the XPLAIN hardware connections. --- Projects/AVRISP/AVRISP.txt | 19 +++++++++++------- Projects/AVRISP/Lib/ISPProtocol.h | 6 ++++++ Projects/AVRISP/Lib/ISPTarget.h | 6 ++++++ Projects/AVRISP/Lib/PDIProtocol.h | 6 ++++++ Projects/AVRISP/Lib/PDITarget.h | 33 +++++++++++++++++++++++-------- Projects/AVRISP/Lib/V2Protocol.h | 6 ++++++ 6 files changed, 61 insertions(+), 15 deletions(-) diff --git a/Projects/AVRISP/AVRISP.txt b/Projects/AVRISP/AVRISP.txt index c533af7251..bed0a7a627 100644 --- a/Projects/AVRISP/AVRISP.txt +++ b/Projects/AVRISP/AVRISP.txt @@ -61,7 +61,11 @@ * set to an appropriate ADC channel number in the project makefile for VTARGET detection to operate correctly. On models * without an ADC converter, VTARGET will report at a fixed 5V level. * - * Connections to the device are simple for SPI programming: + * When compiled for the XPLAIN board target, this will automatically configure itself for the correct connections to the + * XPLAIN's XMEGA AVR, and will enable only PDI programming support. + * + * + * Connections to the device for SPI programming (when enabled): * * * @@ -105,7 +109,7 @@ * 2See \ref SSec_Options section * * - * Connections to the device are simple for SPI programming: + * Connections to the device for PDI programming (when enabled): * *
* @@ -158,19 +162,20 @@ * * * - * + * * * * * - * + * * * * * * + * pin is configured as an input. When in PDI programming mode, this is the target clock pin. + * Ignored when compiled for the XPLAIN board. * * * @@ -180,12 +185,12 @@ * * * - * + * * * * * - * + * * *
RESET_LINE_PORTMakefile CDEFSPORT register for the programmer's target RESET line.PORT register for the programmer's target RESET line. Ignored when compiled for the XPLAIN board.
RESET_LINE_DDRMakefile CDEFSDDR register for the programmer's target RESET line.DDR register for the programmer's target RESET line. Ignored when compiled for the XPLAIN board.
RESET_LINE_MASKMakefile CDEFSMask for the programmer's target RESET line on the chosen port. Must not be the AVR's /SS pin, as the * target pins are tri-stated when not in use, and low signals on the /SS pin will force SPI slave mode when the - * pin is configured as an input. When in PDI programming mode, this is the target clock pin.
VTARGET_ADC_CHANNEL
ENABLE_SPI_PROTOCOLMakefile CDEFSDefine to enable SPI programming protocol support.Define to enable SPI programming protocol support. Ignored when compiled for the XPLAIN board.
ENABLE_XPROG_PROTOCOLMakefile CDEFSDefine to enable XMEGA PDI programming protocol support.Define to enable XMEGA PDI programming protocol support. Ignored when compiled for the XPLAIN board.
*/ diff --git a/Projects/AVRISP/Lib/ISPProtocol.h b/Projects/AVRISP/Lib/ISPProtocol.h index 5a91f59e39..5a144c4f72 100644 --- a/Projects/AVRISP/Lib/ISPProtocol.h +++ b/Projects/AVRISP/Lib/ISPProtocol.h @@ -40,6 +40,12 @@ #include #include "V2Protocol.h" + + /* Preprocessor Checks: */ + #if BOARD == BOARD_XPLAIN + #undef ENABLE_SPI_PROTOCOL + #define ENABLE_PDI_PROTOCOL + #endif /* Macros: */ /** Mask for the reading or writing of the high byte in a FLASH word when issuing a low-level programming command */ diff --git a/Projects/AVRISP/Lib/ISPTarget.h b/Projects/AVRISP/Lib/ISPTarget.h index 121d7893fe..4c4b891d16 100644 --- a/Projects/AVRISP/Lib/ISPTarget.h +++ b/Projects/AVRISP/Lib/ISPTarget.h @@ -47,6 +47,12 @@ #include "V2ProtocolConstants.h" #include "V2ProtocolParams.h" + /* Preprocessor Checks: */ + #if BOARD == BOARD_XPLAIN + #undef ENABLE_SPI_PROTOCOL + #define ENABLE_PDI_PROTOCOL + #endif + /* Macros: */ /** Total number of allowable ISP programming speeds supported by the device */ #define TOTAL_ISP_PROGRAMMING_SPEEDS 7 diff --git a/Projects/AVRISP/Lib/PDIProtocol.h b/Projects/AVRISP/Lib/PDIProtocol.h index 406ba27322..6ac3eb209b 100644 --- a/Projects/AVRISP/Lib/PDIProtocol.h +++ b/Projects/AVRISP/Lib/PDIProtocol.h @@ -43,6 +43,12 @@ #include "V2Protocol.h" #include "PDITarget.h" + /* Preprocessor Checks: */ + #if BOARD == BOARD_XPLAIN + #undef ENABLE_SPI_PROTOCOL + #define ENABLE_PDI_PROTOCOL + #endif + /* Macros: */ #define XPRG_CMD_ENTER_PROGMODE 0x01 #define XPRG_CMD_LEAVE_PROGMODE 0x02 diff --git a/Projects/AVRISP/Lib/PDITarget.h b/Projects/AVRISP/Lib/PDITarget.h index 55a1a95622..f2281fe11b 100644 --- a/Projects/AVRISP/Lib/PDITarget.h +++ b/Projects/AVRISP/Lib/PDITarget.h @@ -42,16 +42,33 @@ #include + /* Preprocessor Checks: */ + #if BOARD == BOARD_XPLAIN + #undef ENABLE_SPI_PROTOCOL + #define ENABLE_PDI_PROTOCOL + #endif + /* Defines: */ - #define PDIDATA_LINE_PORT PORTB - #define PDIDATA_LINE_DDR DDRB - #define PDIDATA_LINE_PIN PINB - #define PDIDATA_LINE_MASK (1 << 2) + #if BOARD == BOARD_XPLAIN + #define PDIDATA_LINE_PORT PORTD + #define PDIDATA_LINE_DDR DDRD + #define PDIDATA_LINE_PIN PIND + #define PDIDATA_LINE_MASK (1 << 2) + + #define PDICLOCK_LINE_PORT PORTD + #define PDICLOCK_LINE_DDR DDRD + #define PDICLOCK_LINE_MASK (1 << 5) + #else + #define PDIDATA_LINE_PORT PORTB + #define PDIDATA_LINE_DDR DDRB + #define PDIDATA_LINE_PIN PINB + #define PDIDATA_LINE_MASK (1 << 2) + + #define PDICLOCK_LINE_PORT RESET_LINE_PORT + #define PDICLOCK_LINE_DDR RESET_LINE_DDR + #define PDICLOCK_LINE_MASK RESET_LINE_MASK + #endif - #define PDICLOCK_LINE_PORT RESET_LINE_PORT - #define PDICLOCK_LINE_DDR RESET_LINE_DDR - #define PDICLOCK_LINE_MASK RESET_LINE_MASK - #define PDI_CMD_LDS 0x00 #define PDI_CMD_LD 0x20 #define PDI_CMD_STS 0x40 diff --git a/Projects/AVRISP/Lib/V2Protocol.h b/Projects/AVRISP/Lib/V2Protocol.h index 7a181e32be..f65a57c06a 100644 --- a/Projects/AVRISP/Lib/V2Protocol.h +++ b/Projects/AVRISP/Lib/V2Protocol.h @@ -45,6 +45,12 @@ #include "V2ProtocolParams.h" #include "ISPProtocol.h" #include "PDIProtocol.h" + + /* Preprocessor Checks: */ + #if BOARD == BOARD_XPLAIN + #undef ENABLE_SPI_PROTOCOL + #define ENABLE_PDI_PROTOCOL + #endif /* Macros: */ /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */