]> git.gir.st - tmk_keyboard.git/blob - protocol/lufa/LUFA-git/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h
Squashed 'tmk_core/' changes from caca2c0..dc0e46e
[tmk_keyboard.git] / protocol / lufa / LUFA-git / Projects / AVRISP-MKII / Lib / ISP / ISPProtocol.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2014.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7 */
8
9 /*
10 Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
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.
20
21 The author disclaims 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
28 this software.
29 */
30
31 /** \file
32 *
33 * Header file for ISPProtocol.c.
34 */
35
36 #ifndef _ISP_PROTOCOL_
37 #define _ISP_PROTOCOL_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <util/delay.h>
42
43 #include <LUFA/Drivers/USB/USB.h>
44
45 #include "../V2Protocol.h"
46 #include "Config/AppConfig.h"
47
48 /* Preprocessor Checks: */
49 #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
50 #undef ENABLE_ISP_PROTOCOL
51
52 #if !defined(ENABLE_XPROG_PROTOCOL)
53 #define ENABLE_XPROG_PROTOCOL
54 #endif
55 #endif
56
57 /* Macros: */
58 /** Mask for the reading or writing of the high byte in a FLASH word when issuing a low-level programming command. */
59 #define READ_WRITE_HIGH_BYTE_MASK (1 << 3)
60
61 #define PROG_MODE_PAGED_WRITES_MASK (1 << 0)
62 #define PROG_MODE_WORD_TIMEDELAY_MASK (1 << 1)
63 #define PROG_MODE_WORD_VALUE_MASK (1 << 2)
64 #define PROG_MODE_WORD_READYBUSY_MASK (1 << 3)
65 #define PROG_MODE_PAGED_TIMEDELAY_MASK (1 << 4)
66 #define PROG_MODE_PAGED_VALUE_MASK (1 << 5)
67 #define PROG_MODE_PAGED_READYBUSY_MASK (1 << 6)
68 #define PROG_MODE_COMMIT_PAGE_MASK (1 << 7)
69
70 /* Function Prototypes: */
71 void ISPProtocol_EnterISPMode(void);
72 void ISPProtocol_LeaveISPMode(void);
73 void ISPProtocol_ProgramMemory(const uint8_t V2Command);
74 void ISPProtocol_ReadMemory(const uint8_t V2Command);
75 void ISPProtocol_ChipErase(void);
76 void ISPProtocol_ReadFuseLockSigOSCCAL(const uint8_t V2Command);
77 void ISPProtocol_WriteFuseLock(const uint8_t V2Command);
78 void ISPProtocol_SPIMulti(void);
79 void ISPProtocol_DelayMS(uint8_t DelayMS);
80 #endif
81
Imprint / Impressum