flash.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //*****************************************************************************
  2. //
  3. // flash.h - Prototypes for the flash driver.
  4. //
  5. // Copyright (c) 2005-2011 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Texas Instruments (TI) is supplying this software for use solely and
  9. // exclusively on TI's microcontroller products. The software is owned by
  10. // TI and/or its suppliers, and is protected under applicable copyright
  11. // laws. You may not combine this software with "viral" open-source
  12. // software in order to form a larger program.
  13. //
  14. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  15. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  16. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  18. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  19. // DAMAGES, FOR ANY REASON WHATSOEVER.
  20. //
  21. // This is part of revision 8264 of the Stellaris Peripheral Driver Library.
  22. //
  23. //*****************************************************************************
  24. #ifndef __FLASH_H__
  25. #define __FLASH_H__
  26. //*****************************************************************************
  27. //
  28. // If building with a C++ compiler, make all of the definitions in this header
  29. // have a C binding.
  30. //
  31. //*****************************************************************************
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. //*****************************************************************************
  37. //
  38. // Values that can be passed to FlashProtectSet(), and returned by
  39. // FlashProtectGet().
  40. //
  41. //*****************************************************************************
  42. typedef enum
  43. {
  44. FlashReadWrite, // Flash can be read and written
  45. FlashReadOnly, // Flash can only be read
  46. FlashExecuteOnly // Flash can only be executed
  47. }
  48. tFlashProtection;
  49. //*****************************************************************************
  50. //
  51. // Values passed to FlashIntEnable(), FlashIntDisable() and FlashIntClear() and
  52. // returned from FlashIntStatus().
  53. //
  54. //*****************************************************************************
  55. #define FLASH_INT_PROGRAM 0x00000002 // Programming Interrupt Mask
  56. #define FLASH_INT_ACCESS 0x00000001 // Access Interrupt Mask
  57. #define FLASH_INT_EEPROM 0x00000004 // EEPROM Interrupt Mask
  58. #define FLASH_INT_VOLTAGE_ERR 0x00000200 // Voltage Error Interrupt Mask
  59. #define FLASH_INT_DATA_ERR 0x00000400 // Invalid Data Interrupt Mask
  60. #define FLASH_INT_ERASE_ERR 0x00000800 // Erase Error Interrupt Mask
  61. #define FLASH_INT_PROGRAM_ERR 0x00002000 // Program Verify Error Interrupt Mask
  62. //*****************************************************************************
  63. //
  64. // Prototypes for the APIs.
  65. //
  66. //*****************************************************************************
  67. extern unsigned long FlashUsecGet(void);
  68. extern void FlashUsecSet(unsigned long ulClocks);
  69. extern long FlashErase(unsigned long ulAddress);
  70. extern long FlashProgram(unsigned long *pulData, unsigned long ulAddress,
  71. unsigned long ulCount);
  72. extern tFlashProtection FlashProtectGet(unsigned long ulAddress);
  73. extern long FlashProtectSet(unsigned long ulAddress,
  74. tFlashProtection eProtect);
  75. extern long FlashProtectSave(void);
  76. extern long FlashUserGet(unsigned long *pulUser0, unsigned long *pulUser1);
  77. extern long FlashUserSet(unsigned long ulUser0, unsigned long ulUser1);
  78. extern long FlashUserSave(void);
  79. extern void FlashIntRegister(void (*pfnHandler)(void));
  80. extern void FlashIntUnregister(void);
  81. extern void FlashIntEnable(unsigned long ulIntFlags);
  82. extern void FlashIntDisable(unsigned long ulIntFlags);
  83. extern unsigned long FlashIntStatus(tBoolean bMasked);
  84. extern void FlashIntClear(unsigned long ulIntFlags);
  85. //*****************************************************************************
  86. //
  87. // Deprecated function names. These definitions ensure backwards compatibility
  88. // but new code should avoid using deprecated function names since these will
  89. // be removed at some point in the future.
  90. //
  91. //*****************************************************************************
  92. #ifndef DEPRECATED
  93. #define FlashIntGetStatus FlashIntStatus
  94. #endif
  95. //*****************************************************************************
  96. //
  97. // Mark the end of the C bindings section for C++ compilers.
  98. //
  99. //*****************************************************************************
  100. #ifdef __cplusplus
  101. }
  102. #endif
  103. #endif // __FLASH_H__