3 Copyright (C) Dean Camera, 2021.
5 dean [at] fourwalledcubicle [dot] com
10 Copyright 2021 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 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
33 * Header file for TINYNVM.c.
41 #include <avr/interrupt.h>
44 #include <LUFA/Common/Common.h>
46 #include "XPROGProtocol.h"
47 #include "XPROGTarget.h"
48 #include "Config/AppConfig.h"
50 /* Preprocessor Checks: */
51 #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
52 #undef ENABLE_ISP_PROTOCOL
54 #if !defined(ENABLE_XPROG_PROTOCOL)
55 #define ENABLE_XPROG_PROTOCOL
60 #define TINY_NVM_CMD_NOOP 0x00
61 #define TINY_NVM_CMD_CHIPERASE 0x10
62 #define TINY_NVM_CMD_SECTIONERASE 0x14
63 #define TINY_NVM_CMD_WORDWRITE 0x1D
65 /* Function Prototypes: */
66 bool TINYNVM_WaitWhileNVMBusBusy(void);
67 bool TINYNVM_WaitWhileNVMControllerBusy(void);
68 bool TINYNVM_EnableTPI(void);
69 void TINYNVM_DisableTPI(void);
70 bool TINYNVM_ReadMemory(const uint16_t ReadAddress
,
73 bool TINYNVM_WriteMemory(const uint16_t WriteAddress
,
75 uint16_t WriteLength
);
76 bool TINYNVM_EraseMemory(const uint8_t EraseCommand
,
77 const uint16_t Address
);
79 #if (defined(INCLUDE_FROM_TINYNVM_C) && defined(ENABLE_XPROG_PROTOCOL))
80 static void TINYNVM_SendReadNVMRegister(const uint8_t Address
);
81 static void TINYNVM_SendWriteNVMRegister(const uint8_t Address
);
82 static void TINYNVM_SendPointerAddress(const uint16_t AbsoluteAddress
);