2 * @brief Repetitive Interrupt Timer registers and control functions
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * All rights reserved.
\r
9 * Software that is described herein is for illustrative purposes only
\r
10 * which provides customers with programming information regarding the
\r
11 * LPC products. This software is supplied "AS IS" without any warranties of
\r
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
13 * all warranties, express or implied, including all implied warranties of
\r
14 * merchantability, fitness for a particular purpose and non-infringement of
\r
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
16 * or liability for the use of the software, conveys no license or rights under any
\r
17 * patent, copyright, mask work right, or any other intellectual property rights in
\r
18 * or to any products. NXP Semiconductors reserves the right to make changes
\r
19 * in the software without notification. NXP Semiconductors also makes no
\r
20 * representation or warranty that such application will be suitable for the
\r
21 * specified use without further testing or modification.
\r
24 * Permission to use, copy, modify, and distribute this software and its
\r
25 * documentation is hereby granted, under NXP Semiconductors' and its
\r
26 * licensor's relevant copyrights in the software, without fee, provided that it
\r
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
28 * copyright, permission, and disclaimer notice must appear in all copies of
\r
32 #ifndef __RITIMER_001_H_
\r
33 #define __RITIMER_001_H_
\r
35 #include "sys_config.h"
\r
42 /** @defgroup IP_RITIMER_001 IP: RITimer register block and driver
\r
43 * @ingroup IP_Drivers
\r
44 * Repetitive Interrupt Timer
\r
49 * @brief Repetitive Interrupt Timer register block structure
\r
51 typedef struct { /*!< RITIMER Structure */
\r
52 __IO uint32_t COMPVAL; /*!< Compare register */
\r
53 __IO uint32_t MASK; /*!< Mask register. This register holds the 32-bit mask value. A 1 written to any bit will force a compare on the corresponding bit of the counter and compare register. */
\r
54 __IO uint32_t CTRL; /*!< Control register. */
\r
55 __IO uint32_t COUNTER; /*!< 32-bit counter */
\r
56 #if defined(CHIP_LPC1347)
\r
57 __IO uint32_t COMPVAL_H; /*!< Compare upper register */
\r
58 __IO uint32_t MASK_H; /*!< Mask upper register */
\r
59 __I uint32_t RESERVED0[1];
\r
60 __IO uint32_t COUNTER_H; /*!< Counter upper register */
\r
65 * @brief RITIMER register support bitfields and mask
\r
69 * RIT control register
\r
71 /** Set by H/W when the counter value equals the masked compare value */
\r
72 #define RIT_CTRL_INT ((uint32_t) (1))
\r
73 /** Set timer enable clear to 0 when the counter value equals the masked compare value */
\r
74 #define RIT_CTRL_ENCLR ((uint32_t) _BIT(1))
\r
75 /** Set timer enable on debug */
\r
76 #define RIT_CTRL_ENBR ((uint32_t) _BIT(2))
\r
77 /** Set timer enable */
\r
78 #define RIT_CTRL_TEN ((uint32_t) _BIT(3))
\r
81 * @brief Initialize the RIT
\r
82 * @param pRITimer : RIT peripheral selected
\r
85 void IP_RIT_Init(IP_RITIMER_001_T *pRITimer);
\r
88 * @brief DeInitialize the RIT
\r
89 * @param pRITimer : RIT peripheral selected
\r
92 void IP_RIT_DeInit(IP_RITIMER_001_T *pRITimer);
\r
95 * @brief Enable Timer
\r
96 * @param pRITimer : RIT peripheral selected
\r
99 STATIC INLINE void IP_RIT_Enable(IP_RITIMER_001_T *pRITimer)
\r
101 pRITimer->CTRL |= RIT_CTRL_TEN;
\r
105 * @brief Disable Timer
\r
106 * @param pRITimer : RIT peripheral selected
\r
109 STATIC INLINE void IP_RIT_Disable(IP_RITIMER_001_T *pRITimer)
\r
111 pRITimer->CTRL &= ~RIT_CTRL_TEN;
\r
116 * @brief Timer Enable on debug
\r
117 * @param pRITimer : RIT peripheral selected
\r
120 STATIC INLINE void IP_RIT_TimerDebugEnable(IP_RITIMER_001_T *pRITimer)
\r
122 pRITimer->CTRL |= RIT_CTRL_ENBR;
\r
126 * @brief Timer Disable on debug
\r
127 * @param pRITimer : RIT peripheral selected
\r
130 STATIC INLINE void IP_RIT_TimerDebugDisable(IP_RITIMER_001_T *pRITimer)
\r
132 pRITimer->CTRL &= ~RIT_CTRL_ENBR;
\r
137 * @brief Check whether interrupt flag is set or not
\r
138 * @param pRITimer : RIT peripheral selected
\r
139 * @return Current interrupt status, could be SET or UNSET
\r
141 IntStatus IP_RIT_GetIntStatus(IP_RITIMER_001_T *pRITimer);
\r
144 * @brief Set a tick value for the interrupt to time out
\r
145 * @param pRITimer : RIT peripheral selected
\r
146 * @param val : value (in ticks) of the interrupt to be set
\r
149 STATIC INLINE void IP_RIT_SetCOMPVAL(IP_RITIMER_001_T *pRITimer, uint32_t val)
\r
151 pRITimer->COMPVAL = val;
\r
155 * @brief Enables or clears the RIT or interrupt
\r
156 * @param pRITimer : RIT peripheral selected
\r
157 * @param val : RIT to be set, one or more RIT_CTRL_* values
\r
160 STATIC INLINE void IP_RIT_EnableCTRL(IP_RITIMER_001_T *pRITimer, uint32_t val)
\r
162 pRITimer->CTRL |= val;
\r
166 * @brief Get the RIT Counter value
\r
167 * @param pRITimer : RIT peripheral selected
\r
168 * @return the counter value
\r
170 STATIC INLINE uint32_t IP_RIT_GetCounter(IP_RITIMER_001_T *pRITimer)
\r
172 return pRITimer->COUNTER;
\r
183 #endif /* __RITIMER_001_H_ */
\r