LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mrt_8xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC8xx Multi-Rate Timer (MRT) registers and driver 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 __MRT_8XX_H_
33 #define __MRT_8XX_H_
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
50 #define LPC_8XX_MRT_CHANNELS (4)
51 #define LPC_MRT_NO_IDLE_CHANNEL (0x40)
52 
56 typedef struct {
58  uint32_t unused[45];
61 } LPC_MRT_T;
62 
65 
66 #define LPC_MRT_CH0 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[0])
67 #define LPC_MRT_CH1 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[1])
68 #define LPC_MRT_CH2 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[2])
69 #define LPC_MRT_CH3 ((IP_MRT_001_T *) &LPC_MRT->CHANNEL[3])
70 
71 #define MRT0_INTFLAG (1)
72 #define MRT1_INTFLAG (2)
73 #define MRT2_INTFLAG (4)
74 #define MRT3_INTFLAG (8)
75 
81 {
82  /* Enable the clock to the register interface */
84 
85  /* Reset MRT */
87 
88  IP_MRT_Init();
89 }
90 
96 {
97  IP_MRT_DeInit();
98 
99  /* Disable the clock to the MRT */
101 }
102 
108 STATIC INLINE uint32_t Chip_MRT_GetInterval(LPC_MRT_CHANNEL_T *pMRT)
109 {
110  return IP_MRT_GetInterval(pMRT);
111 }
112 
122 STATIC INLINE void Chip_MRT_SetInterval(LPC_MRT_CHANNEL_T *pMRT, uint32_t interval)
123 {
124  IP_MRT_SetInterval(pMRT, interval);
125 }
126 
132 STATIC INLINE uint32_t Chip_MRT_GetTimer(LPC_MRT_CHANNEL_T *pMRT)
133 {
134  return IP_MRT_GetTimer(pMRT);
135 }
136 
142 STATIC INLINE bool Chip_MRT_GetEnabled(LPC_MRT_CHANNEL_T *pMRT)
143 {
144  return IP_MRT_GetEnabled(pMRT);
145 }
146 
152 STATIC INLINE void Chip_MRT_SetEnabled(LPC_MRT_CHANNEL_T *pMRT)
153 {
154  IP_MRT_SetEnabled(pMRT);
155 }
156 
162 STATIC INLINE LPC_MRT_MODE_T Chip_MRT_GetMode(LPC_MRT_CHANNEL_T *pMRT)
163 {
164  return (LPC_MRT_MODE_T) IP_MRT_GetMode(pMRT);
165 }
166 
173 STATIC INLINE void Chip_MRT_SetMode(LPC_MRT_CHANNEL_T *pMRT, LPC_MRT_MODE_T mode)
174 {
175  IP_MRT_SetMode(pMRT, (IP_MRT_001_MODE_T) mode);
176 }
177 
183 STATIC INLINE bool Chip_MRT_IsRepeatMode(LPC_MRT_CHANNEL_T *pMRT)
184 {
185  return IP_MRT_IsRepeatMode(pMRT);
186 }
187 
193 STATIC INLINE bool Chip_MRT_IsOneShotMode(LPC_MRT_CHANNEL_T *pMRT)
194 {
195  return IP_MRT_IsOneShotMode(pMRT);
196 }
197 
203 STATIC INLINE bool Chip_MRT_IntPending(LPC_MRT_CHANNEL_T *pMRT)
204 {
205  return IP_MRT_IntPending(pMRT);
206 }
207 
213 STATIC INLINE void Chip_MRT_IntClear(LPC_MRT_CHANNEL_T *pMRT)
214 {
215  IP_MRT_IntClear(pMRT);
216 }
217 
223 STATIC INLINE bool Chip_MRT_Running(LPC_MRT_CHANNEL_T *pMRT)
224 {
225  return IP_MRT_Running(pMRT);
226 }
227 
233 {
234  return (uint8_t) (LPC_MRT->IDLE_CH);
235 }
236 
242 {
243  return LPC_MRT->IRQ_FLAG;
244 }
245 
250 #ifdef __cplusplus
251 }
252 #endif
253 
254 #endif /* __MRT_8XX_H_ */