3      Copyright (C) Dean Camera, 2011. 
   5   dean [at] fourwalledcubicle [dot] com 
  10   Copyright 2011  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 TINYNVM.c. 
  41                 #include <avr/interrupt.h> 
  44                 #include <LUFA/Common/Common.h> 
  46                 #include "XPROGProtocol.h" 
  47                 #include "XPROGTarget.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                 #define TINY_NVM_CMD_NOOP              0x00 
  60                 #define TINY_NVM_CMD_CHIPERASE         0x10 
  61                 #define TINY_NVM_CMD_SECTIONERASE      0x14 
  62                 #define TINY_NVM_CMD_WORDWRITE         0x1D 
  64         /* Function Prototypes: */ 
  65                 bool TINYNVM_WaitWhileNVMBusBusy(void); 
  66                 bool TINYNVM_WaitWhileNVMControllerBusy(void); 
  67                 bool TINYNVM_EnableTPI(void); 
  68                 void TINYNVM_DisableTPI(void); 
  69                 bool TINYNVM_ReadMemory(const uint16_t ReadAddress
, 
  72                 bool TINYNVM_WriteMemory(const uint16_t WriteAddress
, 
  74                                          uint16_t WriteLength
); 
  75                 bool TINYNVM_EraseMemory(const uint8_t EraseCommand
, 
  76                                          const uint16_t Address
); 
  78                 #if (defined(INCLUDE_FROM_TINYNVM_C) && defined(ENABLE_XPROG_PROTOCOL)) 
  79                         static void TINYNVM_SendReadNVMRegister(const uint8_t Address
); 
  80                         static void TINYNVM_SendWriteNVMRegister(const uint8_t Address
); 
  81                         static void TINYNVM_SendPointerAddress(const uint16_t AbsoluteAddress
);