flash.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //*****************************************************************************
  2. //
  3. // flash.h - Prototypes for the flash driver.
  4. //
  5. // Copyright (c) 2005-2007 Luminary Micro, Inc. All rights reserved
  6. // Software License Agreement
  7. //
  8. // Luminary Micro, Inc. (LMI) is supplying this software for use solely and
  9. // exclusively on LMI's microcontroller products.
  10. //
  11. // The software is owned by LMI and/or its suppliers, and is protected under
  12. // applicable copyright laws. All rights are reserved. You may not combine
  13. // this software with "viral" open-source software in order to form a larger
  14. // program. Any use in violation of the foregoing restrictions may subject
  15. // the user to criminal sanctions under applicable laws, as well as to civil
  16. // liability for the breach of the terms and conditions of this license.
  17. //
  18. // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
  19. // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
  20. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
  21. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
  22. // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
  23. //
  24. // This is part of revision 4694 of the Stellaris Peripheral Driver Library.
  25. //
  26. //*****************************************************************************
  27. #ifndef __FLASH_H__
  28. #define __FLASH_H__
  29. //*****************************************************************************
  30. //
  31. // If building with a C++ compiler, make all of the definitions in this header
  32. // have a C binding.
  33. //
  34. //*****************************************************************************
  35. #ifdef __cplusplus
  36. extern "C"
  37. {
  38. #endif
  39. //*****************************************************************************
  40. //
  41. // Values that can be passed to FlashProtectSet(), and returned by
  42. // FlashProtectGet().
  43. //
  44. //*****************************************************************************
  45. typedef enum
  46. {
  47. FlashReadWrite, // Flash can be read and written
  48. FlashReadOnly, // Flash can only be read
  49. FlashExecuteOnly // Flash can only be executed
  50. }
  51. tFlashProtection;
  52. //*****************************************************************************
  53. //
  54. // Prototypes for the APIs.
  55. //
  56. //*****************************************************************************
  57. extern unsigned long FlashUsecGet(void);
  58. extern void FlashUsecSet(unsigned long ulClocks);
  59. extern long FlashErase(unsigned long ulAddress);
  60. extern long FlashProgram(unsigned long *pulData, unsigned long ulAddress,
  61. unsigned long ulCount);
  62. extern tFlashProtection FlashProtectGet(unsigned long ulAddress);
  63. extern long FlashProtectSet(unsigned long ulAddress,
  64. tFlashProtection eProtect);
  65. extern long FlashProtectSave(void);
  66. extern long FlashUserGet(unsigned long *pulUser0, unsigned long *pulUser1);
  67. extern long FlashUserSet(unsigned long ulUser0, unsigned long ulUser1);
  68. extern long FlashUserSave(void);
  69. extern void FlashIntRegister(void (*pfnHandler)(void));
  70. extern void FlashIntUnregister(void);
  71. extern void FlashIntEnable(unsigned long ulIntFlags);
  72. extern void FlashIntDisable(unsigned long ulIntFlags);
  73. extern unsigned long FlashIntGetStatus(tBoolean bMasked);
  74. extern void FlashIntClear(unsigned long ulIntFlags);
  75. //*****************************************************************************
  76. //
  77. // Mark the end of the C bindings section for C++ compilers.
  78. //
  79. //*****************************************************************************
  80. #ifdef __cplusplus
  81. }
  82. #endif
  83. #endif // __FLASH_H__