43dee1e77c11383f0c8f901cc65119a762d5dc1d
   3      Copyright (C) Dean Camera, 2010. 
   5   dean [at] fourwalledcubicle [dot] com 
   6       www.fourwalledcubicle.com 
  10   Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com) 
  12   Permission to use, copy, modify, distribute, and sell this  
  13   software and its documentation for any purpose is hereby granted 
  14   without fee, provided that the above copyright notice appear in  
  15   all copies and that both that the copyright notice and this 
  16   permission notice and warranty disclaimer appear in supporting  
  17   documentation, and that the name of the author not be used in  
  18   advertising or publicity pertaining to distribution of the  
  19   software without specific, written prior permission. 
  21   The author disclaim all warranties with regard to this 
  22   software, including all implied warranties of merchantability 
  23   and fitness.  In no event shall the author be liable for any 
  24   special, indirect or consequential damages or any damages 
  25   whatsoever resulting from loss of use, data or profits, whether 
  26   in an action of contract, negligence or other tortious action, 
  27   arising out of or in connection with the use or performance of 
  33  *  Header file for V2Protocol.c. 
  40                 #include <LUFA/Drivers/USB/USB.h> 
  41                 #include <LUFA/Drivers/Peripheral/SPI.h> 
  43                 #include "../Descriptors.h" 
  44                 #include "V2ProtocolConstants.h" 
  45                 #include "V2ProtocolParams.h" 
  46                 #include "ISP/ISPProtocol.h" 
  47                 #include "XPROG/XPROGProtocol.h" 
  49         /* Preprocessor Checks: */ 
  50                 #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)) 
  51                         #undef ENABLE_ISP_PROTOCOL 
  53                         #if !defined(ENABLE_XPROG_PROTOCOL) 
  54                                 #define ENABLE_XPROG_PROTOCOL 
  59                 #if !defined(__DOXYGEN__) 
  60                         #define _GETADCMUXMASK2(x, y)       x ## y 
  61                         #define _GETADCMUXMASK(x, y)        _GETADCMUXMASK2(x, y) 
  64                 /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */ 
  65                 #define PROGRAMMER_ID              "AVRISP_MK2" 
  67                 /** Timeout period for each issued command from the host before it is aborted */ 
  68                 #define COMMAND_TIMEOUT_MS         200 
  70                 /** Command timeout counter register, GPIOR for speed */ 
  71                 #define TimeoutMSRemaining         GPIOR0 
  73                 /** MUX mask for the VTARGET ADC channel number */ 
  74                 #define VTARGET_ADC_CHANNEL_MASK   _GETADCMUXMASK(ADC_CHANNEL, VTARGET_ADC_CHANNEL) 
  76                 #if !defined(WIN_AVRDUDE_COMPAT) 
  77                         #define SELECT_DATA_OUT_ENDPOINT() Endpoint_SetEndpointDirection(ENDPOINT_DIR_OUT); 
  79                         #define SELECT_DATA_OUT_ENDPOINT() Endpoint_SelectEndpoint(); 
  82         /* External Variables: */ 
  83                 extern uint32_t CurrentAddress
; 
  84                 extern bool     MustSetAddress
; 
  86         /* Function Prototypes: */ 
  87                 void V2Protocol_Init(void); 
  88                 void V2Protocol_ProcessCommand(void); 
  90                 #if defined(INCLUDE_FROM_V2PROTOCOL_C) 
  91                         static void V2Protocol_UnknownCommand(const uint8_t V2Command
); 
  92                         static void V2Protocol_SignOn(void); 
  93                         static void V2Protocol_GetSetParam(const uint8_t V2Command
); 
  94                         static void V2Protocol_ResetProtection(void); 
  95                         static void V2Protocol_LoadAddress(void);