1 /**
2  * @file    tmr_regs.h
3  * @brief   Registers, Bit Masks and Bit Positions for the TMR Peripheral Module.
4  */
5 
6 /* ****************************************************************************
7  * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
23  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name of Maxim Integrated
28  * Products, Inc. shall not be used except as stated in the Maxim Integrated
29  * Products, Inc. Branding Policy.
30  *
31  * The mere transfer of this software does not imply any licenses
32  * of trade secrets, proprietary technology, copyrights, patents,
33  * trademarks, maskwork rights, or any other form of intellectual
34  * property whatsoever. Maxim Integrated Products, Inc. retains all
35  * ownership rights.
36  *
37  *
38  *************************************************************************** */
39 
40 #ifndef _TMR_REGS_H_
41 #define _TMR_REGS_H_
42 
43 /* **** Includes **** */
44 #include <stdint.h>
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 #if defined (__ICCARM__)
51   #pragma system_include
52 #endif
53 
54 #if defined (__CC_ARM)
55   #pragma anon_unions
56 #endif
57 /// @cond
58 /*
59     If types are not defined elsewhere (CMSIS) define them here
60 */
61 #ifndef __IO
62 #define __IO volatile
63 #endif
64 #ifndef __I
65 #define __I  volatile const
66 #endif
67 #ifndef __O
68 #define __O  volatile
69 #endif
70 #ifndef __R
71 #define __R  volatile const
72 #endif
73 /// @endcond
74 
75 /* **** Definitions **** */
76 
77 /**
78  * @ingroup     tmr
79  * @defgroup    tmr_registers TMR_Registers
80  * @brief       Registers, Bit Masks and Bit Positions for the TMR Peripheral Module.
81  * @details 32-bit reloadable timer that can be used for timing and event counting.
82  */
83 
84 /**
85  * @ingroup tmr_registers
86  * Structure type to access the TMR Registers.
87  */
88 typedef struct {
89     __IO uint32_t cnt;                  /**< <tt>\b 0x00:</tt> TMR CNT Register */
90     __IO uint32_t cmp;                  /**< <tt>\b 0x04:</tt> TMR CMP Register */
91     __IO uint32_t pwm;                  /**< <tt>\b 0x08:</tt> TMR PWM Register */
92     __IO uint32_t intr;                 /**< <tt>\b 0x0C:</tt> TMR INTR Register */
93     __IO uint32_t cn;                   /**< <tt>\b 0x10:</tt> TMR CN Register */
94     __IO uint32_t nolcmp;               /**< <tt>\b 0x14:</tt> TMR NOLCMP Register */
95 } mxc_tmr_regs_t;
96 
97 /* Register offsets for module TMR */
98 /**
99  * @ingroup    tmr_registers
100  * @defgroup   TMR_Register_Offsets Register Offsets
101  * @brief      TMR Peripheral Register Offsets from the TMR Base Peripheral Address.
102  * @{
103  */
104  #define MXC_R_TMR_CNT                      ((uint32_t)0x00000000UL) /**< Offset from TMR Base Address: <tt> 0x0000</tt> */
105  #define MXC_R_TMR_CMP                      ((uint32_t)0x00000004UL) /**< Offset from TMR Base Address: <tt> 0x0004</tt> */
106  #define MXC_R_TMR_PWM                      ((uint32_t)0x00000008UL) /**< Offset from TMR Base Address: <tt> 0x0008</tt> */
107  #define MXC_R_TMR_INTR                     ((uint32_t)0x0000000CUL) /**< Offset from TMR Base Address: <tt> 0x000C</tt> */
108  #define MXC_R_TMR_CN                       ((uint32_t)0x00000010UL) /**< Offset from TMR Base Address: <tt> 0x0010</tt> */
109  #define MXC_R_TMR_NOLCMP                   ((uint32_t)0x00000014UL) /**< Offset from TMR Base Address: <tt> 0x0014</tt> */
110 /**@} end of group tmr_registers */
111 
112 /**
113  * @ingroup  tmr_registers
114  * @defgroup TMR_INTR TMR_INTR
115  * @brief    Clear Interrupt. Writing a value (0 or 1) to a bit in this register clears the
116  *           associated interrupt.
117  * @{
118  */
119  #define MXC_F_TMR_INTR_IRQ_CLR_POS                     0 /**< INTR_IRQ_CLR Position */
120  #define MXC_F_TMR_INTR_IRQ_CLR                         ((uint32_t)(0x1UL << MXC_F_TMR_INTR_IRQ_CLR_POS)) /**< INTR_IRQ_CLR Mask */
121 
122 /**@} end of group TMR_INTR_Register */
123 
124 /**
125  * @ingroup  tmr_registers
126  * @defgroup TMR_CN TMR_CN
127  * @brief    Timer Control Register.
128  * @{
129  */
130  #define MXC_F_TMR_CN_TMODE_POS                         0 /**< CN_TMODE Position */
131  #define MXC_F_TMR_CN_TMODE                             ((uint32_t)(0x7UL << MXC_F_TMR_CN_TMODE_POS)) /**< CN_TMODE Mask */
132  #define MXC_V_TMR_CN_TMODE_ONESHOT                     ((uint32_t)0x0UL) /**< CN_TMODE_ONESHOT Value */
133  #define MXC_S_TMR_CN_TMODE_ONESHOT                     (MXC_V_TMR_CN_TMODE_ONESHOT << MXC_F_TMR_CN_TMODE_POS) /**< CN_TMODE_ONESHOT Setting */
134  #define MXC_V_TMR_CN_TMODE_CONTINUOUS                  ((uint32_t)0x1UL) /**< CN_TMODE_CONTINUOUS Value */
135  #define MXC_S_TMR_CN_TMODE_CONTINUOUS                  (MXC_V_TMR_CN_TMODE_CONTINUOUS << MXC_F_TMR_CN_TMODE_POS) /**< CN_TMODE_CONTINUOUS Setting */
136  #define MXC_V_TMR_CN_TMODE_COUNTER                     ((uint32_t)0x2UL) /**< CN_TMODE_COUNTER Value */
137  #define MXC_S_TMR_CN_TMODE_COUNTER                     (MXC_V_TMR_CN_TMODE_COUNTER << MXC_F_TMR_CN_TMODE_POS) /**< CN_TMODE_COUNTER Setting */
138  #define MXC_V_TMR_CN_TMODE_PWM                         ((uint32_t)0x3UL) /**< CN_TMODE_PWM Value */
139  #define MXC_S_TMR_CN_TMODE_PWM                         (MXC_V_TMR_CN_TMODE_PWM << MXC_F_TMR_CN_TMODE_POS) /**< CN_TMODE_PWM Setting */
140  #define MXC_V_TMR_CN_TMODE_CAPTURE                     ((uint32_t)0x4UL) /**< CN_TMODE_CAPTURE Value */
141  #define MXC_S_TMR_CN_TMODE_CAPTURE                     (MXC_V_TMR_CN_TMODE_CAPTURE << MXC_F_TMR_CN_TMODE_POS) /**< CN_TMODE_CAPTURE Setting */
142  #define MXC_V_TMR_CN_TMODE_COMPARE                     ((uint32_t)0x5UL) /**< CN_TMODE_COMPARE Value */
143  #define MXC_S_TMR_CN_TMODE_COMPARE                     (MXC_V_TMR_CN_TMODE_COMPARE << MXC_F_TMR_CN_TMODE_POS) /**< CN_TMODE_COMPARE Setting */
144  #define MXC_V_TMR_CN_TMODE_GATED                       ((uint32_t)0x6UL) /**< CN_TMODE_GATED Value */
145  #define MXC_S_TMR_CN_TMODE_GATED                       (MXC_V_TMR_CN_TMODE_GATED << MXC_F_TMR_CN_TMODE_POS) /**< CN_TMODE_GATED Setting */
146  #define MXC_V_TMR_CN_TMODE_CAPTURECOMPARE              ((uint32_t)0x7UL) /**< CN_TMODE_CAPTURECOMPARE Value */
147  #define MXC_S_TMR_CN_TMODE_CAPTURECOMPARE              (MXC_V_TMR_CN_TMODE_CAPTURECOMPARE << MXC_F_TMR_CN_TMODE_POS) /**< CN_TMODE_CAPTURECOMPARE Setting */
148 
149  #define MXC_F_TMR_CN_PRES_POS                          3 /**< CN_PRES Position */
150  #define MXC_F_TMR_CN_PRES                              ((uint32_t)(0x7UL << MXC_F_TMR_CN_PRES_POS)) /**< CN_PRES Mask */
151  #define MXC_V_TMR_CN_PRES_DIV1                         ((uint32_t)0x0UL) /**< CN_PRES_DIV1 Value */
152  #define MXC_S_TMR_CN_PRES_DIV1                         (MXC_V_TMR_CN_PRES_DIV1 << MXC_F_TMR_CN_PRES_POS) /**< CN_PRES_DIV1 Setting */
153  #define MXC_V_TMR_CN_PRES_DIV2                         ((uint32_t)0x1UL) /**< CN_PRES_DIV2 Value */
154  #define MXC_S_TMR_CN_PRES_DIV2                         (MXC_V_TMR_CN_PRES_DIV2 << MXC_F_TMR_CN_PRES_POS) /**< CN_PRES_DIV2 Setting */
155  #define MXC_V_TMR_CN_PRES_DIV4                         ((uint32_t)0x2UL) /**< CN_PRES_DIV4 Value */
156  #define MXC_S_TMR_CN_PRES_DIV4                         (MXC_V_TMR_CN_PRES_DIV4 << MXC_F_TMR_CN_PRES_POS) /**< CN_PRES_DIV4 Setting */
157  #define MXC_V_TMR_CN_PRES_DIV8                         ((uint32_t)0x3UL) /**< CN_PRES_DIV8 Value */
158  #define MXC_S_TMR_CN_PRES_DIV8                         (MXC_V_TMR_CN_PRES_DIV8 << MXC_F_TMR_CN_PRES_POS) /**< CN_PRES_DIV8 Setting */
159  #define MXC_V_TMR_CN_PRES_DIV16                        ((uint32_t)0x4UL) /**< CN_PRES_DIV16 Value */
160  #define MXC_S_TMR_CN_PRES_DIV16                        (MXC_V_TMR_CN_PRES_DIV16 << MXC_F_TMR_CN_PRES_POS) /**< CN_PRES_DIV16 Setting */
161  #define MXC_V_TMR_CN_PRES_DIV32                        ((uint32_t)0x5UL) /**< CN_PRES_DIV32 Value */
162  #define MXC_S_TMR_CN_PRES_DIV32                        (MXC_V_TMR_CN_PRES_DIV32 << MXC_F_TMR_CN_PRES_POS) /**< CN_PRES_DIV32 Setting */
163  #define MXC_V_TMR_CN_PRES_DIV64                        ((uint32_t)0x6UL) /**< CN_PRES_DIV64 Value */
164  #define MXC_S_TMR_CN_PRES_DIV64                        (MXC_V_TMR_CN_PRES_DIV64 << MXC_F_TMR_CN_PRES_POS) /**< CN_PRES_DIV64 Setting */
165  #define MXC_V_TMR_CN_PRES_DIV128                       ((uint32_t)0x7UL) /**< CN_PRES_DIV128 Value */
166  #define MXC_S_TMR_CN_PRES_DIV128                       (MXC_V_TMR_CN_PRES_DIV128 << MXC_F_TMR_CN_PRES_POS) /**< CN_PRES_DIV128 Setting */
167 
168  #define MXC_F_TMR_CN_TPOL_POS                          6 /**< CN_TPOL Position */
169  #define MXC_F_TMR_CN_TPOL                              ((uint32_t)(0x1UL << MXC_F_TMR_CN_TPOL_POS)) /**< CN_TPOL Mask */
170  #define MXC_V_TMR_CN_TPOL_ACTIVEHI                     ((uint32_t)0x0UL) /**< CN_TPOL_ACTIVEHI Value */
171  #define MXC_S_TMR_CN_TPOL_ACTIVEHI                     (MXC_V_TMR_CN_TPOL_ACTIVEHI << MXC_F_TMR_CN_TPOL_POS) /**< CN_TPOL_ACTIVEHI Setting */
172  #define MXC_V_TMR_CN_TPOL_ACTIVELO                     ((uint32_t)0x1UL) /**< CN_TPOL_ACTIVELO Value */
173  #define MXC_S_TMR_CN_TPOL_ACTIVELO                     (MXC_V_TMR_CN_TPOL_ACTIVELO << MXC_F_TMR_CN_TPOL_POS) /**< CN_TPOL_ACTIVELO Setting */
174 
175  #define MXC_F_TMR_CN_TEN_POS                           7 /**< CN_TEN Position */
176  #define MXC_F_TMR_CN_TEN                               ((uint32_t)(0x1UL << MXC_F_TMR_CN_TEN_POS)) /**< CN_TEN Mask */
177  #define MXC_V_TMR_CN_TEN_DIS                           ((uint32_t)0x0UL) /**< CN_TEN_DIS Value */
178  #define MXC_S_TMR_CN_TEN_DIS                           (MXC_V_TMR_CN_TEN_DIS << MXC_F_TMR_CN_TEN_POS) /**< CN_TEN_DIS Setting */
179  #define MXC_V_TMR_CN_TEN_EN                            ((uint32_t)0x1UL) /**< CN_TEN_EN Value */
180  #define MXC_S_TMR_CN_TEN_EN                            (MXC_V_TMR_CN_TEN_EN << MXC_F_TMR_CN_TEN_POS) /**< CN_TEN_EN Setting */
181 
182  #define MXC_F_TMR_CN_PRES3_POS                         8 /**< CN_PRES3 Position */
183  #define MXC_F_TMR_CN_PRES3                             ((uint32_t)(0x1UL << MXC_F_TMR_CN_PRES3_POS)) /**< CN_PRES3 Mask */
184 
185  #define MXC_F_TMR_CN_PWMSYNC_POS                       9 /**< CN_PWMSYNC Position */
186  #define MXC_F_TMR_CN_PWMSYNC                           ((uint32_t)(0x1UL << MXC_F_TMR_CN_PWMSYNC_POS)) /**< CN_PWMSYNC Mask */
187  #define MXC_V_TMR_CN_PWMSYNC_DIS                       ((uint32_t)0x0UL) /**< CN_PWMSYNC_DIS Value */
188  #define MXC_S_TMR_CN_PWMSYNC_DIS                       (MXC_V_TMR_CN_PWMSYNC_DIS << MXC_F_TMR_CN_PWMSYNC_POS) /**< CN_PWMSYNC_DIS Setting */
189  #define MXC_V_TMR_CN_PWMSYNC_EN                        ((uint32_t)0x1UL) /**< CN_PWMSYNC_EN Value */
190  #define MXC_S_TMR_CN_PWMSYNC_EN                        (MXC_V_TMR_CN_PWMSYNC_EN << MXC_F_TMR_CN_PWMSYNC_POS) /**< CN_PWMSYNC_EN Setting */
191 
192  #define MXC_F_TMR_CN_NOLHPOL_POS                       10 /**< CN_NOLHPOL Position */
193  #define MXC_F_TMR_CN_NOLHPOL                           ((uint32_t)(0x1UL << MXC_F_TMR_CN_NOLHPOL_POS)) /**< CN_NOLHPOL Mask */
194  #define MXC_V_TMR_CN_NOLHPOL_DIS                       ((uint32_t)0x0UL) /**< CN_NOLHPOL_DIS Value */
195  #define MXC_S_TMR_CN_NOLHPOL_DIS                       (MXC_V_TMR_CN_NOLHPOL_DIS << MXC_F_TMR_CN_NOLHPOL_POS) /**< CN_NOLHPOL_DIS Setting */
196  #define MXC_V_TMR_CN_NOLHPOL_EN                        ((uint32_t)0x1UL) /**< CN_NOLHPOL_EN Value */
197  #define MXC_S_TMR_CN_NOLHPOL_EN                        (MXC_V_TMR_CN_NOLHPOL_EN << MXC_F_TMR_CN_NOLHPOL_POS) /**< CN_NOLHPOL_EN Setting */
198 
199  #define MXC_F_TMR_CN_NOLLPOL_POS                       11 /**< CN_NOLLPOL Position */
200  #define MXC_F_TMR_CN_NOLLPOL                           ((uint32_t)(0x1UL << MXC_F_TMR_CN_NOLLPOL_POS)) /**< CN_NOLLPOL Mask */
201  #define MXC_V_TMR_CN_NOLLPOL_DIS                       ((uint32_t)0x0UL) /**< CN_NOLLPOL_DIS Value */
202  #define MXC_S_TMR_CN_NOLLPOL_DIS                       (MXC_V_TMR_CN_NOLLPOL_DIS << MXC_F_TMR_CN_NOLLPOL_POS) /**< CN_NOLLPOL_DIS Setting */
203  #define MXC_V_TMR_CN_NOLLPOL_EN                        ((uint32_t)0x1UL) /**< CN_NOLLPOL_EN Value */
204  #define MXC_S_TMR_CN_NOLLPOL_EN                        (MXC_V_TMR_CN_NOLLPOL_EN << MXC_F_TMR_CN_NOLLPOL_POS) /**< CN_NOLLPOL_EN Setting */
205 
206  #define MXC_F_TMR_CN_PWMCKBD_POS                       12 /**< CN_PWMCKBD Position */
207  #define MXC_F_TMR_CN_PWMCKBD                           ((uint32_t)(0x1UL << MXC_F_TMR_CN_PWMCKBD_POS)) /**< CN_PWMCKBD Mask */
208  #define MXC_V_TMR_CN_PWMCKBD_DIS                       ((uint32_t)0x1UL) /**< CN_PWMCKBD_DIS Value */
209  #define MXC_S_TMR_CN_PWMCKBD_DIS                       (MXC_V_TMR_CN_PWMCKBD_DIS << MXC_F_TMR_CN_PWMCKBD_POS) /**< CN_PWMCKBD_DIS Setting */
210  #define MXC_V_TMR_CN_PWMCKBD_EN                        ((uint32_t)0x0UL) /**< CN_PWMCKBD_EN Value */
211  #define MXC_S_TMR_CN_PWMCKBD_EN                        (MXC_V_TMR_CN_PWMCKBD_EN << MXC_F_TMR_CN_PWMCKBD_POS) /**< CN_PWMCKBD_EN Setting */
212 
213 /**@} end of group TMR_CN_Register */
214 
215 /**
216  * @ingroup  tmr_registers
217  * @defgroup TMR_NOLCMP TMR_NOLCMP
218  * @brief    Timer Non-Overlapping Compare Register.
219  * @{
220  */
221  #define MXC_F_TMR_NOLCMP_NOLLCMP_POS                   0 /**< NOLCMP_NOLLCMP Position */
222  #define MXC_F_TMR_NOLCMP_NOLLCMP                       ((uint32_t)(0xFFUL << MXC_F_TMR_NOLCMP_NOLLCMP_POS)) /**< NOLCMP_NOLLCMP Mask */
223 
224  #define MXC_F_TMR_NOLCMP_NOLHCMP_POS                   8 /**< NOLCMP_NOLHCMP Position */
225  #define MXC_F_TMR_NOLCMP_NOLHCMP                       ((uint32_t)(0xFFUL << MXC_F_TMR_NOLCMP_NOLHCMP_POS)) /**< NOLCMP_NOLHCMP Mask */
226 
227 /**@} end of group TMR_NOLCMP_Register */
228 
229 #ifdef __cplusplus
230 }
231 #endif
232 
233 #endif /* _TMR_REGS_H_ */
234