Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ISPProtocol.h 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. LUFA Library
  3. Copyright (C) Dean Camera, 2014.
  4. dean [at] fourwalledcubicle [dot] com
  5. www.lufa-lib.org
  6. */
  7. /*
  8. Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com)
  9. Permission to use, copy, modify, distribute, and sell this
  10. software and its documentation for any purpose is hereby granted
  11. without fee, provided that the above copyright notice appear in
  12. all copies and that both that the copyright notice and this
  13. permission notice and warranty disclaimer appear in supporting
  14. documentation, and that the name of the author not be used in
  15. advertising or publicity pertaining to distribution of the
  16. software without specific, written prior permission.
  17. The author disclaims all warranties with regard to this
  18. software, including all implied warranties of merchantability
  19. and fitness. In no event shall the author be liable for any
  20. special, indirect or consequential damages or any damages
  21. whatsoever resulting from loss of use, data or profits, whether
  22. in an action of contract, negligence or other tortious action,
  23. arising out of or in connection with the use or performance of
  24. this software.
  25. */
  26. /** \file
  27. *
  28. * Header file for ISPProtocol.c.
  29. */
  30. #ifndef _ISP_PROTOCOL_
  31. #define _ISP_PROTOCOL_
  32. /* Includes: */
  33. #include <avr/io.h>
  34. #include <util/delay.h>
  35. #include <LUFA/Drivers/USB/USB.h>
  36. #include "../V2Protocol.h"
  37. #include "Config/AppConfig.h"
  38. /* Preprocessor Checks: */
  39. #if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
  40. #undef ENABLE_ISP_PROTOCOL
  41. #if !defined(ENABLE_XPROG_PROTOCOL)
  42. #define ENABLE_XPROG_PROTOCOL
  43. #endif
  44. #endif
  45. /* Macros: */
  46. /** Mask for the reading or writing of the high byte in a FLASH word when issuing a low-level programming command. */
  47. #define READ_WRITE_HIGH_BYTE_MASK (1 << 3)
  48. #define PROG_MODE_PAGED_WRITES_MASK (1 << 0)
  49. #define PROG_MODE_WORD_TIMEDELAY_MASK (1 << 1)
  50. #define PROG_MODE_WORD_VALUE_MASK (1 << 2)
  51. #define PROG_MODE_WORD_READYBUSY_MASK (1 << 3)
  52. #define PROG_MODE_PAGED_TIMEDELAY_MASK (1 << 4)
  53. #define PROG_MODE_PAGED_VALUE_MASK (1 << 5)
  54. #define PROG_MODE_PAGED_READYBUSY_MASK (1 << 6)
  55. #define PROG_MODE_COMMIT_PAGE_MASK (1 << 7)
  56. /* Function Prototypes: */
  57. void ISPProtocol_EnterISPMode(void);
  58. void ISPProtocol_LeaveISPMode(void);
  59. void ISPProtocol_ProgramMemory(const uint8_t V2Command);
  60. void ISPProtocol_ReadMemory(const uint8_t V2Command);
  61. void ISPProtocol_ChipErase(void);
  62. void ISPProtocol_ReadFuseLockSigOSCCAL(const uint8_t V2Command);
  63. void ISPProtocol_WriteFuseLock(const uint8_t V2Command);
  64. void ISPProtocol_SPIMulti(void);
  65. void ISPProtocol_DelayMS(uint8_t DelayMS);
  66. #endif