| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ritimer_001.h
Go to the documentation of this file.
1 /*
2 * @brief Repetitive Interrupt Timer registers and control functions
3 *
4 * @note
5 * Copyright(C) NXP Semiconductors, 2012
6 * All rights reserved.
7 *
8 * @par
9 * Software that is described herein is for illustrative purposes only
10 * which provides customers with programming information regarding the
11 * LPC products. This software is supplied "AS IS" without any warranties of
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
13 * all warranties, express or implied, including all implied warranties of
14 * merchantability, fitness for a particular purpose and non-infringement of
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
16 * or liability for the use of the software, conveys no license or rights under any
17 * patent, copyright, mask work right, or any other intellectual property rights in
18 * or to any products. NXP Semiconductors reserves the right to make changes
19 * in the software without notification. NXP Semiconductors also makes no
20 * representation or warranty that such application will be suitable for the
21 * specified use without further testing or modification.
22 *
23 * @par
24 * Permission to use, copy, modify, and distribute this software and its
25 * documentation is hereby granted, under NXP Semiconductors' and its
26 * licensor's relevant copyrights in the software, without fee, provided that it
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
28 * copyright, permission, and disclaimer notice must appear in all copies of
29 * this code.
30 */
31
32 #ifndef __RITIMER_001_H_
33 #define __RITIMER_001_H_
34
35 #include "sys_config.h"
36 #include "cmsis.h"
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
51 typedef struct {
52 __IO uint32_t COMPVAL;
53 __IO uint32_t MASK;
54 __IO uint32_t CTRL;
55 __IO uint32_t COUNTER;
56 #if defined(CHIP_LPC1347)
57 __IO uint32_t COMPVAL_H;
58 __IO uint32_t MASK_H;
59 __I uint32_t RESERVED0[1];
60 __IO uint32_t COUNTER_H;
61 #endif
62 } IP_RITIMER_001_T;
63
68 /*
69 * RIT control register
70 */
72 #define RIT_CTRL_INT ((uint32_t) (1))
73
74 #define RIT_CTRL_ENCLR ((uint32_t) _BIT(1))
75
76 #define RIT_CTRL_ENBR ((uint32_t) _BIT(2))
77
78 #define RIT_CTRL_TEN ((uint32_t) _BIT(3))
79
85 void IP_RIT_Init(IP_RITIMER_001_T *pRITimer);
86
92 void IP_RIT_DeInit(IP_RITIMER_001_T *pRITimer);
93
99 STATIC INLINE void IP_RIT_Enable(IP_RITIMER_001_T *pRITimer)
100 {
101 pRITimer->CTRL |= RIT_CTRL_TEN;
102 }
103
109 STATIC INLINE void IP_RIT_Disable(IP_RITIMER_001_T *pRITimer)
110 {
111 pRITimer->CTRL &= ~RIT_CTRL_TEN;
112 }
113
114
120 STATIC INLINE void IP_RIT_TimerDebugEnable(IP_RITIMER_001_T *pRITimer)
121 {
122 pRITimer->CTRL |= RIT_CTRL_ENBR;
123 }
124
130 STATIC INLINE void IP_RIT_TimerDebugDisable(IP_RITIMER_001_T *pRITimer)
131 {
132 pRITimer->CTRL &= ~RIT_CTRL_ENBR;
133 }
134
135
141 IntStatus IP_RIT_GetIntStatus(IP_RITIMER_001_T *pRITimer);
142
149 STATIC INLINE void IP_RIT_SetCOMPVAL(IP_RITIMER_001_T *pRITimer, uint32_t val)
150 {
151 pRITimer->COMPVAL = val;
152 }
153
160 STATIC INLINE void IP_RIT_EnableCTRL(IP_RITIMER_001_T *pRITimer, uint32_t val)
161 {
162 pRITimer->CTRL |= val;
163 }
164
170 STATIC INLINE uint32_t IP_RIT_GetCounter(IP_RITIMER_001_T *pRITimer)
171 {
172 return pRITimer->COUNTER;
173 }
174
179 #ifdef __cplusplus
180 }
181 #endif
182
183 #endif /* __RITIMER_001_H_ */