2 * @brief LPC18xx/43xx event router driver
\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 __EVRT_18XX_43XX_H_
\r
33 #define __EVRT_18XX_43XX_H_
\r
39 /** @defgroup EVRT_18XX_43XX CHIP: LPC18xx/43xx Event router driver
\r
40 * @ingroup CHIP_18XX_43XX_Drivers
\r
45 * @brief Event Router register structure
\r
47 typedef struct { /*!< EVENTROUTER Structure */
\r
48 __IO uint32_t HILO; /*!< Level configuration register */
\r
49 __IO uint32_t EDGE; /*!< Edge configuration */
\r
50 __I uint32_t RESERVED0[1012];
\r
51 __O uint32_t CLR_EN; /*!< Event clear enable register */
\r
52 __O uint32_t SET_EN; /*!< Event set enable register */
\r
53 __I uint32_t STATUS; /*!< Status register */
\r
54 __I uint32_t ENABLE; /*!< Enable register */
\r
55 __O uint32_t CLR_STAT; /*!< Clear register */
\r
56 __O uint32_t SET_STAT; /*!< Set register */
\r
60 * @brief EVRT input sources
\r
62 typedef enum CHIP_EVRT_SRC {
\r
63 EVRT_SRC_WAKEUP0, /*!< WAKEUP0 event router source */
\r
64 EVRT_SRC_WAKEUP1, /*!< WAKEUP1 event router source */
\r
65 EVRT_SRC_WAKEUP2, /*!< WAKEUP2 event router source */
\r
66 EVRT_SRC_WAKEUP3, /*!< WAKEUP3 event router source */
\r
67 EVRT_SRC_ATIMER, /*!< Alarm timer event router source */
\r
68 EVRT_SRC_RTC, /*!< RTC event router source */
\r
69 EVRT_SRC_BOD1, /*!< BOD event router source */
\r
70 EVRT_SRC_WWDT, /*!< WWDT event router source */
\r
71 EVRT_SRC_ETHERNET, /*!< Ethernet event router source */
\r
72 EVRT_SRC_USB0, /*!< USB0 event router source */
\r
73 EVRT_SRC_USB1, /*!< USB1 event router source */
\r
74 EVRT_SRC_SDIO, /*!< Reserved */
\r
75 EVRT_SRC_CCAN, /*!< C_CAN event router source */
\r
76 EVRT_SRC_COMBINE_TIMER2, /*!< Combined timer 2 event router source */
\r
77 EVRT_SRC_COMBINE_TIMER6, /*!< Combined timer 6 event router source */
\r
78 EVRT_SRC_QEI, /*!< QEI event router source */
\r
79 EVRT_SRC_COMBINE_TIMER14, /*!< Combined timer 14 event router source */
\r
80 EVRT_SRC_RESERVED1, /*!< Reserved */
\r
81 EVRT_SRC_RESERVED2, /*!< Reserved */
\r
82 EVRT_SRC_RESET /*!< Reset event router source */
\r
86 * @brief Macro for checking for a valid EVRT source
\r
88 #define PARAM_EVRT_SOURCE(n) ((n == EVRT_SRC_WAKEUP0) || (n == EVRT_SRC_WAKEUP1) \
\r
89 || (n == EVRT_SRC_WAKEUP2) || (n == EVRT_SRC_WAKEUP3) \
\r
90 || (n == EVRT_SRC_ATIMER) || (n == EVRT_SRC_RTC) \
\r
91 || (n == EVRT_SRC_BOD1) || (n == EVRT_SRC_WWDT) \
\r
92 || (n == EVRT_SRC_ETHERNET) || (n == EVRT_SRC_USB0) \
\r
93 || (n == EVRT_SRC_USB1) || (n == EVRT_SRC_CCAN) || (n == EVRT_SRC_SDIO) \
\r
94 || (n == EVRT_SRC_COMBINE_TIMER2) || (n == EVRT_SRC_COMBINE_TIMER6) \
\r
95 || (n == EVRT_SRC_QEI) || (n == EVRT_SRC_COMBINE_TIMER14) \
\r
96 || (n == EVRT_SRC_RESET)) \
\r
99 * @brief EVRT input state detecting type
\r
101 typedef enum CHIP_EVRT_SRC_ACTIVE {
\r
102 EVRT_SRC_ACTIVE_LOW_LEVEL, /*!< Active low level */
\r
103 EVRT_SRC_ACTIVE_HIGH_LEVEL, /*!< Active high level */
\r
104 EVRT_SRC_ACTIVE_FALLING_EDGE, /*!< Active falling edge */
\r
105 EVRT_SRC_ACTIVE_RISING_EDGE /*!< Active rising edge */
\r
106 } CHIP_EVRT_SRC_ACTIVE_T;
\r
109 * @brief Macro for checking for a valid EVRT state type
\r
111 #define PARAM_EVRT_SOURCE_ACTIVE_TYPE(n) ((n == EVRT_SRC_ACTIVE_LOW_LEVEL) || (n == EVRT_SRC_ACTIVE_HIGH_LEVEL) \
\r
112 || (n == EVRT_SRC_ACTIVE_FALLING_EDGE) || (n == EVRT_SRC_ACTIVE_RISING_EDGE))
\r
115 * @brief Initialize the EVRT
\r
118 void Chip_EVRT_Init (void);
\r
121 * @brief Set up the type of interrupt type for a source to EVRT
\r
122 * @param EVRT_Src : EVRT source, should be one of CHIP_EVRT_SRC_T type
\r
123 * @param type : EVRT type, should be one of CHIP_EVRT_SRC_ACTIVE_T type
\r
126 void Chip_EVRT_ConfigIntSrcActiveType(CHIP_EVRT_SRC_T EVRT_Src, CHIP_EVRT_SRC_ACTIVE_T type);
\r
129 * @brief Check if a source is sending interrupt to EVRT
\r
130 * @param EVRT_Src : EVRT source, should be one of CHIP_EVRT_SRC_T type
\r
131 * @return true if the interrupt from the source is pending, otherwise false
\r
133 IntStatus Chip_EVRT_IsSourceInterrupting(CHIP_EVRT_SRC_T EVRT_Src);
\r
136 * @brief Enable or disable interrupt sources to EVRT
\r
137 * @param EVRT_Src : EVRT source, should be one of CHIP_EVRT_SRC_T type
\r
138 * @param state : ENABLE or DISABLE to enable or disable event router source
\r
141 void Chip_EVRT_SetUpIntSrc(CHIP_EVRT_SRC_T EVRT_Src, FunctionalState state);
\r
144 * @brief De-initializes the EVRT peripheral
\r
147 STATIC INLINE void Chip_EVRT_DeInit(void)
\r
149 LPC_EVRT->CLR_EN = 0xFFFF;
\r
150 LPC_EVRT->CLR_STAT = 0xFFFF;
\r
154 * @brief Clear pending interrupt EVRT source
\r
155 * @param EVRT_Src : EVRT source, should be one of CHIP_EVRT_SRC_T type
\r
158 STATIC INLINE void Chip_EVRT_ClrPendIntSrc(CHIP_EVRT_SRC_T EVRT_Src)
\r
160 LPC_EVRT->CLR_STAT = (1 << (uint8_t) EVRT_Src);
\r
171 #endif /* __EVRT_18XX_43XX_H_ */
\r