]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC/ThirdParty/LPCOpen/lpc_core/lpc_ip/atimer_001.h
Update LPC18xx FreeRTOS+UDP demo to use LPCOpen USB and Ethernet drivers.
[freertos] / FreeRTOS-Plus / Demo / FreeRTOS_Plus_UDP_and_CLI_LPC1830_GCC / ThirdParty / LPCOpen / lpc_core / lpc_ip / atimer_001.h
1 /*\r
2  * @brief Alarm Timer Registers and control functions\r
3  *\r
4  * @note\r
5  * Copyright(C) NXP Semiconductors, 2012\r
6  * All rights reserved.\r
7  *\r
8  * @par\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
22  *\r
23  * @par\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
29  * this code.\r
30  */\r
31 \r
32 #ifndef __ATIMER_001_H_\r
33 #define __ATIMER_001_H_\r
34 \r
35 #include "sys_config.h"\r
36 #include "cmsis.h"\r
37 \r
38 #ifdef __cplusplus\r
39 extern "C" {\r
40 #endif\r
41 \r
42 /** @defgroup IP_ATIMER_001 IP: ATimer register block and driver\r
43  * @ingroup IP_Drivers\r
44  * Alarm timer\r
45  * @{\r
46  */\r
47 \r
48 /**\r
49  * @brief Alarm Timer register block structure\r
50  */\r
51 typedef struct {                                        /*!< ATIMER Structure       */\r
52         __IO uint32_t DOWNCOUNTER;              /*!< Downcounter register   */\r
53         __IO uint32_t PRESET;                   /*!< Preset value register  */\r
54         __I  uint32_t RESERVED0[1012];\r
55         __O  uint32_t CLR_EN;                   /*!< Interrupt clear enable register */\r
56         __O  uint32_t SET_EN;                   /*!< Interrupt set enable register */\r
57         __I  uint32_t STATUS;                   /*!< Status register        */\r
58         __I  uint32_t ENABLE;                   /*!< Enable register        */\r
59         __O  uint32_t CLR_STAT;                 /*!< Clear register         */\r
60         __O  uint32_t SET_STAT;                 /*!< Set register           */\r
61 } IP_ATIMER_001_T;\r
62 \r
63 /**\r
64  * @brief       Close ATIMER device\r
65  * @param       pATimer :  Pointer to timer device\r
66  * @return      None\r
67  * @note        Important: 32KHz clock must be enabled in CREG prior to this call. See\r
68  * the User Manual for more information.\r
69  */\r
70 void IP_ATIMER_DeInit(IP_ATIMER_001_T *pATimer);\r
71 \r
72 /**\r
73  * @brief       Clear ATIMER Interrupt Status\r
74  * @param       pATimer : Pointer to timer device\r
75  * @return      None\r
76  */\r
77 STATIC INLINE void IP_ATIMER_ClearIntStatus(IP_ATIMER_001_T *pATimer)\r
78 {\r
79         pATimer->CLR_STAT = 1;\r
80 }\r
81 \r
82 /**\r
83  * @brief       Set ATIMER Interrupt Status\r
84  * @param       pATimer : Pointer to timer device\r
85  * @return      None\r
86  */\r
87 STATIC INLINE void IP_ATIMER_SetIntStatus(IP_ATIMER_001_T *pATimer)\r
88 {\r
89         pATimer->SET_STAT = 1;\r
90 }\r
91 /**\r
92  * @brief       Enable ATIMER Interrupt\r
93  * @param       pATimer : Pointer to timer device\r
94  * @return      None\r
95  */\r
96 STATIC INLINE void IP_ATIMER_IntEnable(IP_ATIMER_001_T *pATimer)\r
97 {\r
98         pATimer->SET_EN = 1;\r
99 }\r
100 \r
101 /**\r
102  * @brief       Disable ATIMER Interrupt\r
103  * @param       pATimer : Pointer to timer device\r
104  * @return      None\r
105  */\r
106 STATIC INLINE void IP_ATIMER_IntDisable(IP_ATIMER_001_T *pATimer)\r
107 {\r
108         pATimer->CLR_EN = 1;\r
109 }\r
110 \r
111 /**\r
112  * @brief       Update Preset value\r
113  * @param       pATimer : Pointer to timer device\r
114  * @param       PresetValue     updated preset value\r
115  * @return      Nothing\r
116  */\r
117 STATIC INLINE void IP_ATIMER_UpdatePresetValue(IP_ATIMER_001_T *pATimer, uint32_t PresetValue)\r
118 {\r
119         pATimer->PRESET = PresetValue;\r
120 }\r
121 \r
122 /**\r
123  * @brief       Read value of preset register\r
124  * @param       pATimer : Pointer to timer/counter device\r
125  * @return      Value of capture register\r
126  */\r
127 STATIC INLINE uint32_t IP_ATIMER_GetPresetValue(IP_ATIMER_001_T *pATimer)\r
128 {\r
129         return pATimer->PRESET;\r
130 }\r
131 \r
132 /**\r
133  * @brief       Returns enable state of ATimer interrupt\r
134  * @param       pATimer : Pointer to timer/counter device\r
135  * @return      !0 if the ATimer interrupt is enabled, otherwise 0\r
136  */\r
137 STATIC INLINE uint32_t IP_ATIMER_GetIntEnableState(IP_ATIMER_001_T *pATimer)\r
138 {\r
139         return pATimer->ENABLE;\r
140 }\r
141 \r
142 /**\r
143  * @brief       Returns current pending state of ATimer interrupt\r
144  * @param       pATimer : Pointer to timer/counter device\r
145  * @return      !0 if the ATimer interrupt is asserted, otherwise 0\r
146  */\r
147 STATIC INLINE uint32_t IP_ATIMER_GetIntPendingState(IP_ATIMER_001_T *pATimer)\r
148 {\r
149         return pATimer->STATUS;\r
150 }\r
151 \r
152 /**\r
153  * @}\r
154  */\r
155 \r
156 #ifdef __cplusplus\r
157 }\r
158 #endif\r
159 \r
160 #endif /* __ATIMER_001_H_ */\r