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 ISPTarget.c.
41 #include <avr/pgmspace.h>
42 #include <util/delay.h>
44 #include <LUFA/Drivers/USB/USB.h>
45 #include <LUFA/Drivers/Peripheral/SPI.h>
47 #include "../V2ProtocolParams.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 /** Total number of allowable ISP programming speeds supported by the device. */
60 #define TOTAL_ISP_PROGRAMMING_SPEEDS 7
62 /** Low level device command to issue an extended FLASH address, for devices with other 128KB of FLASH. */
63 #define LOAD_EXTENDED_ADDRESS_CMD 0x4D
65 /* Function Prototypes: */
66 uint8_t ISPTarget_GetSPIPrescalerMask(void);
67 void ISPTarget_ChangeTargetResetLine(const bool ResetTarget
);
68 uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode
, const uint16_t PollAddress
,
69 const uint8_t PollValue
, const uint8_t DelayMS
,
70 const uint8_t ReadMemCommand
);
71 uint8_t ISPTarget_WaitWhileTargetBusy(void);
72 void ISPTarget_LoadExtendedAddress(void);