hibernate.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //*****************************************************************************
  2. //
  3. // hibernate.h - API definition for the Hibernation module.
  4. //
  5. // Copyright (c) 2007-2009 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 __HIBERNATE_H__
  28. #define __HIBERNATE_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. // Macros needed for selecting the clock source for HibernateClockSelect()
  42. //
  43. //*****************************************************************************
  44. #define HIBERNATE_CLOCK_SEL_RAW 0x04
  45. #define HIBERNATE_CLOCK_SEL_DIV128 0x00
  46. //*****************************************************************************
  47. //
  48. // Macros need to configure wake events for HibernateWakeSet()
  49. //
  50. //*****************************************************************************
  51. #define HIBERNATE_WAKE_PIN 0x10
  52. #define HIBERNATE_WAKE_RTC 0x08
  53. //*****************************************************************************
  54. //
  55. // Macros needed to configure low battery detect for HibernateLowBatSet()
  56. //
  57. //*****************************************************************************
  58. #define HIBERNATE_LOW_BAT_DETECT 0x20
  59. #define HIBERNATE_LOW_BAT_ABORT 0xA0
  60. //*****************************************************************************
  61. //
  62. // Macros defining interrupt source bits for the interrupt functions.
  63. //
  64. //*****************************************************************************
  65. #define HIBERNATE_INT_PIN_WAKE 0x08
  66. #define HIBERNATE_INT_LOW_BAT 0x04
  67. #define HIBERNATE_INT_RTC_MATCH_0 0x01
  68. #define HIBERNATE_INT_RTC_MATCH_1 0x02
  69. //*****************************************************************************
  70. //
  71. // API Function prototypes
  72. //
  73. //*****************************************************************************
  74. extern void HibernateEnableExpClk(unsigned long ulHibClk);
  75. extern void HibernateDisable(void);
  76. extern void HibernateClockSelect(unsigned long ulClockInput);
  77. extern void HibernateRTCEnable(void);
  78. extern void HibernateRTCDisable(void);
  79. extern void HibernateWakeSet(unsigned long ulWakeFlags);
  80. extern unsigned long HibernateWakeGet(void);
  81. extern void HibernateLowBatSet(unsigned long ulLowBatFlags);
  82. extern unsigned long HibernateLowBatGet(void);
  83. extern void HibernateRTCSet(unsigned long ulRTCValue);
  84. extern unsigned long HibernateRTCGet(void);
  85. extern void HibernateRTCMatch0Set(unsigned long ulMatch);
  86. extern unsigned long HibernateRTCMatch0Get(void);
  87. extern void HibernateRTCMatch1Set(unsigned long ulMatch);
  88. extern unsigned long HibernateRTCMatch1Get(void);
  89. extern void HibernateRTCTrimSet(unsigned long ulTrim);
  90. extern unsigned long HibernateRTCTrimGet(void);
  91. extern void HibernateDataSet(unsigned long *pulData, unsigned long ulCount);
  92. extern void HibernateDataGet(unsigned long *pulData, unsigned long ulCount);
  93. extern void HibernateRequest(void);
  94. extern void HibernateIntEnable(unsigned long ulIntFlags);
  95. extern void HibernateIntDisable(unsigned long ulIntFlags);
  96. extern void HibernateIntRegister(void (*pfnHandler)(void));
  97. extern void HibernateIntUnregister(void);
  98. extern unsigned long HibernateIntStatus(tBoolean bMasked);
  99. extern void HibernateIntClear(unsigned long ulIntFlags);
  100. extern unsigned int HibernateIsActive(void);
  101. //*****************************************************************************
  102. //
  103. // Several Hibernate module APIs have been renamed, with the original function
  104. // name being deprecated. These defines provide backward compatibility.
  105. //
  106. //*****************************************************************************
  107. #ifndef DEPRECATED
  108. #include "driverlib/sysctl.h"
  109. #define HibernateEnable(a) \
  110. HibernateEnableExpClk(a, SysCtlClockGet())
  111. #endif
  112. //*****************************************************************************
  113. //
  114. // Mark the end of the C bindings section for C++ compilers.
  115. //
  116. //*****************************************************************************
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif // __HIBERNATE_H__