Auto-configure AVRISP programmer configuration when built for the XPLAIN board to...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 3 Dec 2009 08:35:32 +0000 (08:35 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 3 Dec 2009 08:35:32 +0000 (08:35 +0000)
Projects/AVRISP/AVRISP.txt
Projects/AVRISP/Lib/ISPProtocol.h
Projects/AVRISP/Lib/ISPTarget.h
Projects/AVRISP/Lib/PDIProtocol.h
Projects/AVRISP/Lib/PDITarget.h
Projects/AVRISP/Lib/V2Protocol.h

index c533af7..bed0a7a 100644 (file)
  *  set to an appropriate ADC channel number in the project makefile for VTARGET detection to operate correctly. On models\r
  *  without an ADC converter, VTARGET will report at a fixed 5V level.\r
  *\r
  *  set to an appropriate ADC channel number in the project makefile for VTARGET detection to operate correctly. On models\r
  *  without an ADC converter, VTARGET will report at a fixed 5V level.\r
  *\r
- *  Connections to the device are simple for SPI programming:\r
+ *  When compiled for the XPLAIN board target, this will automatically configure itself for the correct connections to the\r
+ *  XPLAIN's XMEGA AVR, and will enable only PDI programming support.\r
+ *\r
+ *\r
+ *  Connections to the device for SPI programming (when enabled):\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r
  *  <b><sup>2</sup></b> <i>See \ref SSec_Options section</i>\r
  *\r
  *\r
  *  <b><sup>2</sup></b> <i>See \ref SSec_Options section</i>\r
  *\r
  *\r
- *  Connections to the device are simple for SPI programming:\r
+ *  Connections to the device for PDI programming (when enabled):\r
  *\r
  *  <table>\r
  *   <tr>\r
  *\r
  *  <table>\r
  *   <tr>\r
  *   <tr>\r
  *    <td>RESET_LINE_PORT</td>\r
  *    <td>Makefile CDEFS</td>\r
  *   <tr>\r
  *    <td>RESET_LINE_PORT</td>\r
  *    <td>Makefile CDEFS</td>\r
- *    <td>PORT register for the programmer's target RESET line.</td>\r
+ *    <td>PORT register for the programmer's target RESET line. <i>Ignored when compiled for the XPLAIN board.</i></td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>RESET_LINE_DDR</td>\r
  *    <td>Makefile CDEFS</td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>RESET_LINE_DDR</td>\r
  *    <td>Makefile CDEFS</td>\r
- *    <td>DDR register for the programmer's target RESET line.</td>\r
+ *    <td>DDR register for the programmer's target RESET line. <i>Ignored when compiled for the XPLAIN board.</i></td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>RESET_LINE_MASK</td>\r
  *    <td>Makefile CDEFS</td>\r
  *    <td>Mask for the programmer's target RESET line on the chosen port. <b>Must not be the AVR's /SS pin</b>, as the\r
  *        target pins are tri-stated when not in use, and low signals on the /SS pin will force SPI slave mode when the\r
  *   </tr>\r
  *   <tr>\r
  *    <td>RESET_LINE_MASK</td>\r
  *    <td>Makefile CDEFS</td>\r
  *    <td>Mask for the programmer's target RESET line on the chosen port. <b>Must not be the AVR's /SS pin</b>, as the\r
  *        target pins are tri-stated when not in use, and low signals on the /SS pin will force SPI slave mode when the\r
- *        pin is configured as an input. When in PDI programming mode, this is the target clock pin.</td>\r
+ *        pin is configured as an input. When in PDI programming mode, this is the target clock pin.\r
+ *        <i>Ignored when compiled for the XPLAIN board.</i></td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>VTARGET_ADC_CHANNEL</td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>VTARGET_ADC_CHANNEL</td>\r
  *   <tr>\r
  *    <td>ENABLE_SPI_PROTOCOL</td>\r
  *    <td>Makefile CDEFS</td>\r
  *   <tr>\r
  *    <td>ENABLE_SPI_PROTOCOL</td>\r
  *    <td>Makefile CDEFS</td>\r
- *    <td>Define to enable SPI programming protocol support.</td>  \r
+ *    <td>Define to enable SPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></td>  \r
  *   </tr>\r
  *   <tr>\r
  *    <td>ENABLE_XPROG_PROTOCOL</td>\r
  *    <td>Makefile CDEFS</td>\r
  *   </tr>\r
  *   <tr>\r
  *    <td>ENABLE_XPROG_PROTOCOL</td>\r
  *    <td>Makefile CDEFS</td>\r
- *    <td>Define to enable XMEGA PDI programming protocol support.</td>  \r
+ *    <td>Define to enable XMEGA PDI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></td>  \r
  *   </tr>\r
  *  </table>\r
  */\r
  *   </tr>\r
  *  </table>\r
  */\r
index 5a91f59..5a144c4 100644 (file)
                #include <avr/io.h>\r
                \r
                #include "V2Protocol.h"\r
                #include <avr/io.h>\r
                \r
                #include "V2Protocol.h"\r
+               \r
+       /* Preprocessor Checks: */\r
+               #if BOARD == BOARD_XPLAIN\r
+                       #undef  ENABLE_SPI_PROTOCOL\r
+                       #define ENABLE_PDI_PROTOCOL\r
+               #endif\r
 \r
        /* Macros: */\r
                /** Mask for the reading or writing of the high byte in a FLASH word when issuing a low-level programming command */\r
 \r
        /* Macros: */\r
                /** Mask for the reading or writing of the high byte in a FLASH word when issuing a low-level programming command */\r
index 121d789..4c4b891 100644 (file)
                #include "V2ProtocolConstants.h"\r
                #include "V2ProtocolParams.h"\r
 \r
                #include "V2ProtocolConstants.h"\r
                #include "V2ProtocolParams.h"\r
 \r
+       /* Preprocessor Checks: */\r
+               #if BOARD == BOARD_XPLAIN\r
+                       #undef  ENABLE_SPI_PROTOCOL\r
+                       #define ENABLE_PDI_PROTOCOL\r
+               #endif\r
+\r
        /* Macros: */\r
                /** Total number of allowable ISP programming speeds supported by the device */\r
                #define TOTAL_ISP_PROGRAMMING_SPEEDS  7\r
        /* Macros: */\r
                /** Total number of allowable ISP programming speeds supported by the device */\r
                #define TOTAL_ISP_PROGRAMMING_SPEEDS  7\r
index 406ba27..6ac3eb2 100644 (file)
                #include "V2Protocol.h"\r
                #include "PDITarget.h"\r
 \r
                #include "V2Protocol.h"\r
                #include "PDITarget.h"\r
 \r
+       /* Preprocessor Checks: */\r
+               #if BOARD == BOARD_XPLAIN\r
+                       #undef  ENABLE_SPI_PROTOCOL\r
+                       #define ENABLE_PDI_PROTOCOL\r
+               #endif\r
+\r
        /* Macros: */\r
                #define XPRG_CMD_ENTER_PROGMODE             0x01\r
                #define XPRG_CMD_LEAVE_PROGMODE             0x02\r
        /* Macros: */\r
                #define XPRG_CMD_ENTER_PROGMODE             0x01\r
                #define XPRG_CMD_LEAVE_PROGMODE             0x02\r
index 55a1a95..f2281fe 100644 (file)
                \r
                #include <LUFA/Common/Common.h>\r
        \r
                \r
                #include <LUFA/Common/Common.h>\r
        \r
+       /* Preprocessor Checks: */\r
+               #if BOARD == BOARD_XPLAIN\r
+                       #undef  ENABLE_SPI_PROTOCOL\r
+                       #define ENABLE_PDI_PROTOCOL\r
+               #endif\r
+\r
        /* Defines: */\r
        /* Defines: */\r
-               #define PDIDATA_LINE_PORT     PORTB\r
-               #define PDIDATA_LINE_DDR      DDRB\r
-               #define PDIDATA_LINE_PIN      PINB\r
-               #define PDIDATA_LINE_MASK     (1 << 2)\r
+               #if BOARD == BOARD_XPLAIN\r
+                       #define PDIDATA_LINE_PORT     PORTD\r
+                       #define PDIDATA_LINE_DDR      DDRD\r
+                       #define PDIDATA_LINE_PIN      PIND\r
+                       #define PDIDATA_LINE_MASK     (1 << 2)\r
+                       \r
+                       #define PDICLOCK_LINE_PORT    PORTD\r
+                       #define PDICLOCK_LINE_DDR     DDRD\r
+                       #define PDICLOCK_LINE_MASK    (1 << 5)\r
+               #else\r
+                       #define PDIDATA_LINE_PORT     PORTB\r
+                       #define PDIDATA_LINE_DDR      DDRB\r
+                       #define PDIDATA_LINE_PIN      PINB\r
+                       #define PDIDATA_LINE_MASK     (1 << 2)\r
+                       \r
+                       #define PDICLOCK_LINE_PORT    RESET_LINE_PORT\r
+                       #define PDICLOCK_LINE_DDR     RESET_LINE_DDR\r
+                       #define PDICLOCK_LINE_MASK    RESET_LINE_MASK\r
+               #endif\r
                \r
                \r
-               #define PDICLOCK_LINE_PORT    RESET_LINE_PORT\r
-               #define PDICLOCK_LINE_DDR     RESET_LINE_DDR\r
-               #define PDICLOCK_LINE_MASK    RESET_LINE_MASK\r
-\r
                #define PDI_CMD_LDS           0x00\r
                #define PDI_CMD_LD            0x20\r
                #define PDI_CMD_STS           0x40\r
                #define PDI_CMD_LDS           0x00\r
                #define PDI_CMD_LD            0x20\r
                #define PDI_CMD_STS           0x40\r
index 7a181e3..f65a57c 100644 (file)
                #include "V2ProtocolParams.h"
                #include "ISPProtocol.h"\r
                #include "PDIProtocol.h"\r
                #include "V2ProtocolParams.h"
                #include "ISPProtocol.h"\r
                #include "PDIProtocol.h"\r
+\r
+       /* Preprocessor Checks: */\r
+               #if BOARD == BOARD_XPLAIN\r
+                       #undef  ENABLE_SPI_PROTOCOL\r
+                       #define ENABLE_PDI_PROTOCOL\r
+               #endif\r
 
        /* Macros: */\r
                /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */
 
        /* Macros: */\r
                /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */