Fix MIT license language to make its intent clearer.
[pub/USBasp.git] / Projects / AVRISP-MKII / Lib / XPROG / TINYNVM.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 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 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
28 this software.
29 */
30
31 /** \file
32 *
33 * Header file for TINYNVM.c.
34 */
35
36 #ifndef _TINY_NVM_
37 #define _TINY_NVM_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <avr/interrupt.h>
42 #include <stdbool.h>
43
44 #include <LUFA/Common/Common.h>
45
46 #include "XPROGProtocol.h"
47 #include "XPROGTarget.h"
48
49 /* Preprocessor Checks: */
50 #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
51 #undef ENABLE_ISP_PROTOCOL
52
53 #if !defined(ENABLE_XPROG_PROTOCOL)
54 #define ENABLE_XPROG_PROTOCOL
55 #endif
56 #endif
57
58 /* Defines: */
59 #define TINY_NVM_REG_NVMCSR 0x32
60 #define TINY_NVM_REG_NVMCMD 0x33
61
62 #define TINY_NVM_CMD_NOOP 0x00
63 #define TINY_NVM_CMD_CHIPERASE 0x10
64 #define TINY_NVM_CMD_SECTIONERASE 0x14
65 #define TINY_NVM_CMD_WORDWRITE 0x1D
66
67 /* Function Prototypes: */
68 bool TINYNVM_WaitWhileNVMBusBusy(void);
69 bool TINYNVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, const uint16_t ReadSize);
70 bool TINYNVM_WriteMemory(const uint8_t WriteCommand, const uint32_t WriteAddress, const uint8_t* WriteBuffer);
71 bool TINYNVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address);
72
73 #endif