srtc.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #ifndef __SRTC_H__
  31. #define __SRTC_H__
  32. //! @addtogroup diag_srtc
  33. //! @{
  34. /*!
  35. * @file srtc.h
  36. * @brief SNVS SRTC driver header file.
  37. */
  38. #include "sdk.h"
  39. ////////////////////////////////////////////////////////////////////////////////
  40. // Definitions
  41. ////////////////////////////////////////////////////////////////////////////////
  42. //! @brief Type for the SRTC timer callback function.
  43. typedef void (*srtc_callback_t)(void * arg);
  44. ////////////////////////////////////////////////////////////////////////////////
  45. // API
  46. ////////////////////////////////////////////////////////////////////////////////
  47. #if defined(__cplusplus)
  48. extern "C" {
  49. #endif
  50. /*!
  51. * @brief Initializes SRTC.
  52. *
  53. * Enables the secure real time counter and disables time alarm. It also calls
  54. * register the interrupt service handler.
  55. */
  56. void srtc_init(void);
  57. /*!
  58. * @brief Disables interrupt, counter and time alarm
  59. */
  60. void srtc_deinit(void);
  61. /*!
  62. * @brief Setup SRTC one-time timer.
  63. *
  64. * @param timeout Set SRTC alarm timeout.
  65. * @param callback Callback function to be called from isr.
  66. * @param arg Arbitrary argument passed to the callacbk function.
  67. */
  68. void srtc_setup_onetime_timer(uint32_t timeout, srtc_callback_t callback, void * arg);
  69. #if defined(__cplusplus)
  70. }
  71. #endif
  72. //! @}
  73. #endif //__SRTC_H__
  74. ////////////////////////////////////////////////////////////////////////////////
  75. // EOF
  76. ////////////////////////////////////////////////////////////////////////////////