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