snvs.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Copyright (c) 2011-2012, Freescale Semiconductor, Inc.
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without modification,
  6. * are permitted provided that the following conditions are met:
  7. *
  8. * o Redistributions of source code must retain the above copyright notice, this list
  9. * of conditions and the following disclaimer.
  10. *
  11. * o Redistributions in binary form must reproduce the above copyright notice, this
  12. * list of conditions and the following disclaimer in the documentation and/or
  13. * other materials provided with the distribution.
  14. *
  15. * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
  16. * contributors may be used to endorse or promote products derived from this
  17. * software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  22. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
  23. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  25. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  26. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  28. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. /*!
  31. * @file snvs.h
  32. * @brief SNVS driver header file.
  33. */
  34. #ifndef __SNVS_H__
  35. #define __SNVS_H__
  36. #include "sdk.h"
  37. //! @addtogroup diag_snvs
  38. //! @{
  39. ////////////////////////////////////////////////////////////////////////////////
  40. // API
  41. ////////////////////////////////////////////////////////////////////////////////
  42. #if defined(__cplusplus)
  43. extern "C" {
  44. #endif
  45. /*!
  46. * @brief Presently nothing to do as part of snvs initialization
  47. *
  48. */
  49. void snvs_init(void);
  50. /*!
  51. * @brief Presently nothing to do as part of snvs deinit
  52. *
  53. */
  54. void snvs_deinit(void);
  55. /*!
  56. * @brief Enable or disable non-secured real time counter
  57. *
  58. * @param state True to enable the counter and false to disable it.
  59. */
  60. void snvs_rtc_counter(uint8_t state);
  61. /*!
  62. * @brief Enable or disable non-secured time alarm
  63. *
  64. * @param state True to enable the alarm and false to disable it.
  65. */
  66. void snvs_rtc_alarm(uint8_t state);
  67. /*!
  68. * @brief Enable or disable non-secured periodic interrupt
  69. *
  70. * @param freq Frequence for periodic interrupt, valid values 0 to 15,
  71. * a value greater than 15 will be regarded as 15.
  72. * @param state True to enable the alarm and false to disable it.
  73. */
  74. void snvs_rtc_periodic_interrupt(uint8_t freq, uint8_t state);
  75. /*!
  76. * @brief Enable or disable secure real time counter
  77. *
  78. * @param state 1 to enable the counter and any other value to disable it.
  79. */
  80. void snvs_srtc_counter(uint8_t state);
  81. /*!
  82. * @brief Enable or disable secure time alarm
  83. *
  84. * @param state 1 to enable the alarm and any other value to disable it.
  85. */
  86. void snvs_srtc_alarm(uint8_t state);
  87. /*!
  88. * @brief Programs non-secured real time counter
  89. *
  90. * @param count 64-bit integer to program into 47-bit RTC counter register;
  91. * only 47-bit LSB will be used
  92. */
  93. void snvs_rtc_set_counter(uint64_t count);
  94. /*!
  95. * @brief Sets non-secured RTC time alarm register
  96. *
  97. * @param timeout 64-bit integer to program into 47-bit time alarm register;
  98. * only 47-bit LSB will be used
  99. */
  100. void snvs_rtc_set_alarm_timeout(uint64_t timeout);
  101. /*!
  102. * @brief Programs secure real time counter
  103. *
  104. * @param count 64-bit integer to program into 47-bit SRTC counter register;
  105. * only 47-bit LSB will be used
  106. */
  107. void snvs_srtc_set_counter(uint64_t count);
  108. /*!
  109. * @brief Set secured RTC time alarm register
  110. *
  111. * @param timeout 32-bit integer to program into 32-bit time alarm register;
  112. */
  113. void snvs_srtc_set_alarm_timeout(uint32_t timeout);
  114. #if defined(__cplusplus)
  115. }
  116. #endif
  117. //! @}
  118. #endif //__SNVS_H__
  119. ////////////////////////////////////////////////////////////////////////////////
  120. // EOF
  121. ////////////////////////////////////////////////////////////////////////////////