3 Copyright (C) Dean Camera, 2009.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 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 "ISPProtocol.h"
47 #include "PDIProtocol.h"
49 /* Preprocessor Checks: */
50 #if (BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1)
51 #undef ENABLE_ISP_PROTOCOL
53 #if !defined(ENABLE_PDI_PROTOCOL)
54 #define ENABLE_PDI_PROTOCOL
59 /** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing */
60 #define PROGRAMMER_ID "AVRISP_MK2"
62 /** Timeout in milliseconds of target busy-wait loops waiting for a command to complete */
63 #define TARGET_BUSY_TIMEOUT_MS 240
65 /* Inline Functions: */
66 /** Blocking delay for a given number of milliseconds, via a hardware timer.
68 * \param[in] DelayMS Number of milliseconds to delay for
70 static inline void V2Protocol_DelayMS(uint8_t DelayMS
)
73 while (TCNT0
< DelayMS
);
76 /* External Variables: */
77 extern uint32_t CurrentAddress
;
78 extern bool MustSetAddress
;
80 /* Function Prototypes: */
81 void V2Protocol_ProcessCommand(void);
83 #if defined(INCLUDE_FROM_V2PROTOCOL_C)
84 static void V2Protocol_UnknownCommand(uint8_t V2Command
);
85 static void V2Protocol_SignOn(void);
86 static void V2Protocol_GetSetParam(uint8_t V2Command
);
87 static void V2Protocol_ResetProtection(void);
88 static void V2Protocol_LoadAddress(void);