flash.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //*****************************************************************************
  2. //
  3. // flash.h - Prototypes for the flash driver.
  4. //
  5. // Copyright (c) 2005-2010 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 6459 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. //*****************************************************************************
  58. //
  59. // Prototypes for the APIs.
  60. //
  61. //*****************************************************************************
  62. extern unsigned long FlashUsecGet(void);
  63. extern void FlashUsecSet(unsigned long ulClocks);
  64. extern long FlashErase(unsigned long ulAddress);
  65. extern long FlashProgram(unsigned long *pulData, unsigned long ulAddress,
  66. unsigned long ulCount);
  67. extern tFlashProtection FlashProtectGet(unsigned long ulAddress);
  68. extern long FlashProtectSet(unsigned long ulAddress,
  69. tFlashProtection eProtect);
  70. extern long FlashProtectSave(void);
  71. extern long FlashUserGet(unsigned long *pulUser0, unsigned long *pulUser1);
  72. extern long FlashUserSet(unsigned long ulUser0, unsigned long ulUser1);
  73. extern long FlashUserSave(void);
  74. extern void FlashIntRegister(void (*pfnHandler)(void));
  75. extern void FlashIntUnregister(void);
  76. extern void FlashIntEnable(unsigned long ulIntFlags);
  77. extern void FlashIntDisable(unsigned long ulIntFlags);
  78. extern unsigned long FlashIntStatus(tBoolean bMasked);
  79. extern void FlashIntClear(unsigned long ulIntFlags);
  80. //*****************************************************************************
  81. //
  82. // Deprecated function names. These definitions ensure backwards compatibility
  83. // but new code should avoid using deprecated function names since these will
  84. // be removed at some point in the future.
  85. //
  86. //*****************************************************************************
  87. #ifndef DEPRECATED
  88. #define FlashIntGetStatus FlashIntStatus
  89. #endif
  90. //*****************************************************************************
  91. //
  92. // Mark the end of the C bindings section for C++ compilers.
  93. //
  94. //*****************************************************************************
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif // __FLASH_H__