- #include "ISP/ISPProtocol.h"\r
- #include "XPROG/XPROGProtocol.h"\r
-\r
- /* Preprocessor Checks: */\r
- #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))\r
- #undef ENABLE_ISP_PROTOCOL\r
- \r
- #if !defined(ENABLE_XPROG_PROTOCOL)\r
- #define ENABLE_XPROG_PROTOCOL\r
- #endif\r
- #endif\r
-
- /* Macros: */\r
- /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */
- #define PROGRAMMER_ID "AVRISP_MK2"\r
- \r
- /** Timeout period for each issued command from the host before it is aborted */\r
- #define COMMAND_TIMEOUT_MS 200\r
- \r
- /** Command timeout counter register, GPIOR for speed */\r
- #define TimeoutMSRemaining GPIOR0\r
-\r
- /* External Variables: */\r
- extern uint32_t CurrentAddress;\r
- extern bool MustSetAddress;\r
-\r
- /* Function Prototypes: */\r
- void V2Protocol_ProcessCommand(void);\r
- \r
- #if defined(INCLUDE_FROM_V2PROTOCOL_C)\r
- static void V2Protocol_UnknownCommand(uint8_t V2Command);\r
- static void V2Protocol_SignOn(void);\r
- static void V2Protocol_GetSetParam(uint8_t V2Command);\r
- static void V2Protocol_ResetProtection(void);\r
- static void V2Protocol_LoadAddress(void);\r
+ #include "ISP/ISPProtocol.h"
+ #include "XPROG/XPROGProtocol.h"
+
+ /* Preprocessor Checks: */
+ #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
+ #undef ENABLE_ISP_PROTOCOL
+
+ #if !defined(ENABLE_XPROG_PROTOCOL)
+ #define ENABLE_XPROG_PROTOCOL
+ #endif
+ #endif
+
+ #if defined(USB_SERIES_4_AVR) && ((VTARGET_ADC_CHANNEL == 2) || (VTARGET_ADC_CHANNEL == 3))
+ #error The U4 AVR chips do not contain ADC channels 2 or 3. Please change VTARGET_ADC_CHANNEL or define NO_VTARGET_DETECT in the makefile.
+ #endif
+
+ /* Macros: */
+ /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing. */
+ #define PROGRAMMER_ID "AVRISP_MK2"
+
+ /** Timeout period for each issued command from the host before it is aborted (in 10ms ticks). */
+ #define COMMAND_TIMEOUT_TICKS 100
+
+ /** Command timeout expiration flag, GPIOR for speed. */
+ #define TimeoutExpired GPIOR1
+
+ /** MUX mask for the VTARGET ADC channel number. */
+ #define VTARGET_ADC_CHANNEL_MASK ADC_GET_CHANNEL_MASK(VTARGET_ADC_CHANNEL)
+
+ /* External Variables: */
+ extern uint32_t CurrentAddress;
+ extern bool MustLoadExtendedAddress;
+
+ /* Function Prototypes: */
+ void V2Protocol_Init(void);
+ void V2Protocol_ProcessCommand(void);
+
+ #if defined(INCLUDE_FROM_V2PROTOCOL_C)
+ static void V2Protocol_UnknownCommand(const uint8_t V2Command);
+ static void V2Protocol_SignOn(void);
+ static void V2Protocol_GetSetParam(const uint8_t V2Command);
+ static void V2Protocol_ResetProtection(void);
+ static void V2Protocol_LoadAddress(void);