am_reg_systick.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //*****************************************************************************
  2. //
  3. // am_reg_systick.h
  4. //! @file
  5. //!
  6. //! @brief Register macros for the SYSTICK module
  7. //
  8. //*****************************************************************************
  9. //*****************************************************************************
  10. //
  11. // Copyright (c) 2017, Ambiq Micro
  12. // All rights reserved.
  13. //
  14. // Redistribution and use in source and binary forms, with or without
  15. // modification, are permitted provided that the following conditions are met:
  16. //
  17. // 1. Redistributions of source code must retain the above copyright notice,
  18. // this list of conditions and the following disclaimer.
  19. //
  20. // 2. Redistributions in binary form must reproduce the above copyright
  21. // notice, this list of conditions and the following disclaimer in the
  22. // documentation and/or other materials provided with the distribution.
  23. //
  24. // 3. Neither the name of the copyright holder nor the names of its
  25. // contributors may be used to endorse or promote products derived from this
  26. // software without specific prior written permission.
  27. //
  28. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  29. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  30. // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  31. // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  32. // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  34. // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  35. // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  36. // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  37. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  38. // POSSIBILITY OF SUCH DAMAGE.
  39. //
  40. // This is part of revision 1.2.11 of the AmbiqSuite Development Package.
  41. //
  42. //*****************************************************************************
  43. #ifndef AM_REG_SYSTICK_H
  44. #define AM_REG_SYSTICK_H
  45. //*****************************************************************************
  46. //
  47. // Instance finder. (1 instance(s) available)
  48. //
  49. //*****************************************************************************
  50. #define AM_REG_SYSTICK_NUM_MODULES 1
  51. #define AM_REG_SYSTICKn(n) \
  52. (REG_SYSTICK_BASEADDR + 0x00000000 * n)
  53. //*****************************************************************************
  54. //
  55. // Register offsets.
  56. //
  57. //*****************************************************************************
  58. #define AM_REG_SYSTICK_SYSTCSR_O 0xE000E010
  59. #define AM_REG_SYSTICK_SYSTRVR_O 0xE000E014
  60. #define AM_REG_SYSTICK_SYSTCVR_O 0xE000E018
  61. #define AM_REG_SYSTICK_SYSTCALIB_O 0xE000E01C
  62. //*****************************************************************************
  63. //
  64. // SYSTICK_SYSTCSR - SysTick Control and Status Register.
  65. //
  66. //*****************************************************************************
  67. // Returns 1 if timer counted to 0 since last time this was read.
  68. #define AM_REG_SYSTICK_SYSTCSR_COUNTFLAG_S 16
  69. #define AM_REG_SYSTICK_SYSTCSR_COUNTFLAG_M 0x00010000
  70. #define AM_REG_SYSTICK_SYSTCSR_COUNTFLAG(n) (((uint32_t)(n) << 16) & 0x00010000)
  71. // Enables SysTick exception request. Software can use COUNTFLAG to determine if
  72. // SysTick has ever counted to zero. 0 = counting down to zero does not assert
  73. // the SysTick exception request; 1 = counting down to zero asserts the SysTick
  74. // exception request.
  75. #define AM_REG_SYSTICK_SYSTCSR_TICKINT_S 1
  76. #define AM_REG_SYSTICK_SYSTCSR_TICKINT_M 0x00000002
  77. #define AM_REG_SYSTICK_SYSTCSR_TICKINT(n) (((uint32_t)(n) << 1) & 0x00000002)
  78. // Enables the counter. 0 = counter disabled; 1 = counter enabled.
  79. #define AM_REG_SYSTICK_SYSTCSR_ENABLE_S 0
  80. #define AM_REG_SYSTICK_SYSTCSR_ENABLE_M 0x00000001
  81. #define AM_REG_SYSTICK_SYSTCSR_ENABLE(n) (((uint32_t)(n) << 0) & 0x00000001)
  82. //*****************************************************************************
  83. //
  84. // SYSTICK_SYSTRVR - SysTick Reload Value Register.
  85. //
  86. //*****************************************************************************
  87. // Value to load into the SYSTCVR register when the counter is enabled and when
  88. // it reaches 0.
  89. #define AM_REG_SYSTICK_SYSTRVR_RELOAD_S 0
  90. #define AM_REG_SYSTICK_SYSTRVR_RELOAD_M 0x00FFFFFF
  91. #define AM_REG_SYSTICK_SYSTRVR_RELOAD(n) (((uint32_t)(n) << 0) & 0x00FFFFFF)
  92. //*****************************************************************************
  93. //
  94. // SYSTICK_SYSTCVR - SysTick Current Value Register.
  95. //
  96. //*****************************************************************************
  97. // Reads return the current value of the SysTick counter. A write of any value
  98. // clears the field to 0, and also clears the SYSTCSR COUNTFLAG bit to 0.
  99. #define AM_REG_SYSTICK_SYSTCVR_CURRENT_S 0
  100. #define AM_REG_SYSTICK_SYSTCVR_CURRENT_M 0x00FFFFFF
  101. #define AM_REG_SYSTICK_SYSTCVR_CURRENT(n) (((uint32_t)(n) << 0) & 0x00FFFFFF)
  102. //*****************************************************************************
  103. //
  104. // SYSTICK_SYSTCALIB - SysTick Calibration Value Register.
  105. //
  106. //*****************************************************************************
  107. // Indicates whether the device provides a reference clock to the processor. 0 =
  108. // reference clock provided; 1 = no reference clock provided. If your device
  109. // does not provide a reference clock, the SYST_CSR.CLKSOURCE bit reads-as-one
  110. // and ignores writes.
  111. #define AM_REG_SYSTICK_SYSTCALIB_NOREF_S 31
  112. #define AM_REG_SYSTICK_SYSTCALIB_NOREF_M 0x80000000
  113. #define AM_REG_SYSTICK_SYSTCALIB_NOREF(n) (((uint32_t)(n) << 31) & 0x80000000)
  114. // Indicates whether the TENMS value is exact. 0 = TENMS value is exact; 1 =
  115. // TENMS value is inexact, or not given. An inexact TENMS value can affect the
  116. // suitability of SysTick as a software real time clock.
  117. #define AM_REG_SYSTICK_SYSTCALIB_SKEW_S 30
  118. #define AM_REG_SYSTICK_SYSTCALIB_SKEW_M 0x40000000
  119. #define AM_REG_SYSTICK_SYSTCALIB_SKEW(n) (((uint32_t)(n) << 30) & 0x40000000)
  120. // Reload value for 10ms (100Hz) timing, subject to system clock skew errors. If
  121. // the value reads as zero, the calibration value is not known.
  122. #define AM_REG_SYSTICK_SYSTCALIB_TENMS_S 0
  123. #define AM_REG_SYSTICK_SYSTCALIB_TENMS_M 0x00FFFFFF
  124. #define AM_REG_SYSTICK_SYSTCALIB_TENMS(n) (((uint32_t)(n) << 0) & 0x00FFFFFF)
  125. #endif // AM_REG_SYSTICK_H