/*
 * This file is part of GreatFET
 */

#ifndef LPC43XX_EVENTROUTER_H
#define LPC43XX_EVENTROUTER_H

/**@{*/

#include <libopencm3/cm3/common.h>
#include <libopencm3/lpc43xx/memorymap.h>

#ifdef __cplusplus
extern "C" {
#endif

/* --- Event Router registers ---------------------------------------------- */

/* Level configuration register */
#define EVENTROUTER_HILO                MMIO32(EVENTROUTER_BASE + 0x000)

/* Edge configuration */
#define EVENTROUTER_EDGE                MMIO32(EVENTROUTER_BASE + 0x004)

/* Clear event enable register */
#define EVENTROUTER_CLR_EN              MMIO32(EVENTROUTER_BASE + 0xFD8)

/* Set event enable register */
#define EVENTROUTER_SET_EN              MMIO32(EVENTROUTER_BASE + 0xFDC)

/* Event Status register */
#define EVENTROUTER_STATUS              MMIO32(EVENTROUTER_BASE + 0xFE0)

/* Event Enable register */
#define EVENTROUTER_ENABLE              MMIO32(EVENTROUTER_BASE + 0xFE4)

/* Clear event status register */
#define EVENTROUTER_CLR_STAT            MMIO32(EVENTROUTER_BASE + 0xFE8)

/* Set event status register */
#define EVENTROUTER_SET_STAT            MMIO32(EVENTROUTER_BASE + 0xFEC)

/* --- Event Router HILO values -------------------------------------------- */

/* WAKEUP0_L: ... */
#define EVENTROUTER_HILO_WAKEUP0L_SHIFT (0)
#define EVENTROUTER_HILO_WAKEUP0L (1 << EVENTROUTER_HILO_WAKEUP0L_SHIFT)

/* WAKEUP1_L: ... */
#define EVENTROUTER_HILO_WAKEUP1L_SHIFT (1)
#define EVENTROUTER_HILO_WAKEUP1L (1 << EVENTROUTER_HILO_WAKEUP1L_SHIFT)

/* WAKEUP2_L: ... */
#define EVENTROUTER_HILO_WAKEUP2L_SHIFT (2)
#define EVENTROUTER_HILO_WAKEUP2L (1 << EVENTROUTER_HILO_WAKEUP2L_SHIFT)

/* WAKEUP3_L: ... */
#define EVENTROUTER_HILO_WAKEUP3L_SHIFT (3)
#define EVENTROUTER_HILO_WAKEUP3L (1 << EVENTROUTER_HILO_WAKEUP3L_SHIFT)

/* ATIMER_L: ... */
#define EVENTROUTER_HILO_ATIMERL_SHIFT (4)
#define EVENTROUTER_HILO_ATIMERL (1 << EVENTROUTER_HILO_ATIMERL_SHIFT)

/* RTC_L: ... */
#define EVENTROUTER_HILO_RTCL_SHIFT (5)
#define EVENTROUTER_HILO_RTCL (1 << EVENTROUTER_HILO_RTCL_SHIFT)

/* BOD_L: ... */
#define EVENTROUTER_HILO_BODL_SHIFT (6)
#define EVENTROUTER_HILO_BODL (1 << EVENTROUTER_HILO_BODL_SHIFT)

/* WWDT_L: ... */
#define EVENTROUTER_HILO_WWDTL_SHIFT (7)
#define EVENTROUTER_HILO_WWDTL (1 << EVENTROUTER_HILO_WWDTL_SHIFT)

/* ETH_L: ... */
#define EVENTROUTER_HILO_ETHL_SHIFT (8)
#define EVENTROUTER_HILO_ETHL (1 << EVENTROUTER_HILO_ETHL_SHIFT)

/* USB0_L: ... */
#define EVENTROUTER_HILO_USB0L_SHIFT (9)
#define EVENTROUTER_HILO_USB0L (1 << EVENTROUTER_HILO_USB0L_SHIFT)

/* USB1_L: ... */
#define EVENTROUTER_HILO_USB1L_SHIFT (10)
#define EVENTROUTER_HILO_USB1L (1 << EVENTROUTER_HILO_USB1L_SHIFT)

/* SDMMC_L: ... */
#define EVENTROUTER_HILO_SDMMCL_SHIFT (11)
#define EVENTROUTER_HILO_SDMMCL (1 << EVENTROUTER_HILO_SDMMCL_SHIFT)

/* CAN_L: ... */
#define EVENTROUTER_HILO_CANL_SHIFT (12)
#define EVENTROUTER_HILO_CANL (1 << EVENTROUTER_HILO_CANL_SHIFT)

/* TIM2_L: ... */
#define EVENTROUTER_HILO_TIM2L_SHIFT (13)
#define EVENTROUTER_HILO_TIM2L (1 << EVENTROUTER_HILO_TIM2L_SHIFT)

/* TIM6_L: ... */
#define EVENTROUTER_HILO_TIM6L_SHIFT (14)
#define EVENTROUTER_HILO_TIM6L (1 << EVENTROUTER_HILO_TIM6L_SHIFT)

/* QEI_L: ... */
#define EVENTROUTER_HILO_QEIL_SHIFT (15)
#define EVENTROUTER_HILO_QEIL (1 << EVENTROUTER_HILO_QEIL_SHIFT)

/* TIM14_L: ... */
#define EVENTROUTER_HILO_TIM14L_SHIFT (16)
#define EVENTROUTER_HILO_TIM14L (1 << EVENTROUTER_HILO_TIM14L_SHIFT)

/* RESET_L: ... */
#define EVENTROUTER_HILO_RESETL_SHIFT (19)
#define EVENTROUTER_HILO_RESETL (1 << EVENTROUTER_HILO_RESETL_SHIFT)

/* BOD_RESET_L: ... */
#define EVENTROUTER_HILO_BODRESETL_SHIFT (20)
#define EVENTROUTER_HILO_BODRESETL (1 << EVENTROUTER_HILO_BODRESETL_SHIFT)

/* DPD_RESET_L: ... */
#define EVENTROUTER_HILO_DPDRESETL_SHIFT (21)
#define EVENTROUTER_HILO_DPDRESETL (1 << EVENTROUTER_HILO_DPDRESETL_SHIFT)

/* --- Event Router EDGE values -------------------------------------------- */

/* WAKEUP0_E: ... */
#define EVENTROUTER_EDGE_WAKEUP0E_SHIFT (0)
#define EVENTROUTER_EDGE_WAKEUP0E (1 << EVENTROUTER_EDGE_WAKEUP0E_SHIFT)

/* WAKEUP1_E: ... */
#define EVENTROUTER_EDGE_WAKEUP1E_SHIFT (1)
#define EVENTROUTER_EDGE_WAKEUP1E (1 << EVENTROUTER_EDGE_WAKEUP1E_SHIFT)

/* WAKEUP2_E: ... */
#define EVENTROUTER_EDGE_WAKEUP2E_SHIFT (2)
#define EVENTROUTER_EDGE_WAKEUP2E (1 << EVENTROUTER_EDGE_WAKEUP2E_SHIFT)

/* WAKEUP3_E: ... */
#define EVENTROUTER_EDGE_WAKEUP3E_SHIFT (3)
#define EVENTROUTER_EDGE_WAKEUP3E (1 << EVENTROUTER_EDGE_WAKEUP3E_SHIFT)

/* ATIMER_E: ... */
#define EVENTROUTER_EDGE_ATIMERE_SHIFT (4)
#define EVENTROUTER_EDGE_ATIMERE (1 << EVENTROUTER_EDGE_ATIMERE_SHIFT)

/* RTC_E: ... */
#define EVENTROUTER_EDGE_RTCE_SHIFT (5)
#define EVENTROUTER_EDGE_RTCE (1 << EVENTROUTER_EDGE_RTCE_SHIFT)

/* BOD_E: ... */
#define EVENTROUTER_EDGE_BODE_SHIFT (6)
#define EVENTROUTER_EDGE_BODE (1 << EVENTROUTER_EDGE_BODE_SHIFT)

/* WWDT_E: ... */
#define EVENTROUTER_EDGE_WWDTE_SHIFT (7)
#define EVENTROUTER_EDGE_WWDTE (1 << EVENTROUTER_EDGE_WWDTE_SHIFT)

/* ETH_E: ... */
#define EVENTROUTER_EDGE_ETHE_SHIFT (8)
#define EVENTROUTER_EDGE_ETHE (1 << EVENTROUTER_EDGE_ETHE_SHIFT)

/* USB0_E: ... */
#define EVENTROUTER_EDGE_USB0E_SHIFT (9)
#define EVENTROUTER_EDGE_USB0E (1 << EVENTROUTER_EDGE_USB0E_SHIFT)

/* USB1_E: ... */
#define EVENTROUTER_EDGE_USB1E_SHIFT (10)
#define EVENTROUTER_EDGE_USB1E (1 << EVENTROUTER_EDGE_USB1E_SHIFT)

/* SDMMC_E: ... */
#define EVENTROUTER_EDGE_SDMMCE_SHIFT (11)
#define EVENTROUTER_EDGE_SDMMCE (1 << EVENTROUTER_EDGE_SDMMCE_SHIFT)

/* CAN_E: ... */
#define EVENTROUTER_EDGE_CANE_SHIFT (12)
#define EVENTROUTER_EDGE_CANE (1 << EVENTROUTER_EDGE_CANE_SHIFT)

/* TIM2_E: ... */
#define EVENTROUTER_EDGE_TIM2E_SHIFT (13)
#define EVENTROUTER_EDGE_TIM2E (1 << EVENTROUTER_EDGE_TIM2E_SHIFT)

/* TIM6_E: ... */
#define EVENTROUTER_EDGE_TIM6E_SHIFT (14)
#define EVENTROUTER_EDGE_TIM6E (1 << EVENTROUTER_EDGE_TIM6E_SHIFT)

/* QEI_E: ... */
#define EVENTROUTER_EDGE_QEIE_SHIFT (15)
#define EVENTROUTER_EDGE_QEIE (1 << EVENTROUTER_EDGE_QEIE_SHIFT)

/* TIM14_E: ... */
#define EVENTROUTER_EDGE_TIM14E_SHIFT (16)
#define EVENTROUTER_EDGE_TIM14E (1 << EVENTROUTER_EDGE_TIM14E_SHIFT)

/* RESET_E: ... */
#define EVENTROUTER_EDGE_RESETE_SHIFT (19)
#define EVENTROUTER_EDGE_RESETE (1 << EVENTROUTER_EDGE_RESETE_SHIFT)

/* BOD_RESET_E: ... */
#define EVENTROUTER_EDGE_BODRESETE_SHIFT (20)
#define EVENTROUTER_EDGE_BODRESETE (1 << EVENTROUTER_EDGE_BODRESETE_SHIFT)

/* DPD_RESET_E: ... */
#define EVENTROUTER_EDGE_DPDRESETE_SHIFT (21)
#define EVENTROUTER_EDGE_DPDRESETE (1 << EVENTROUTER_EDGE_DPDRESETE_SHIFT)

/* --- Event Router CLR_EN values ------------------------------------------ */

/* WAKEUP0_CLREN: ... */
#define EVENTROUTER_CLR_EN_WAKEUP0_CLREN_SHIFT (0)
#define EVENTROUTER_CLR_EN_WAKEUP0_CLREN (1 << EVENTROUTER_CLR_EN_WAKEUP0_CLREN_SHIFT)

/* WAKEUP1_CLREN: ... */
#define EVENTROUTER_CLR_EN_WAKEUP1_CLREN_SHIFT (1)
#define EVENTROUTER_CLR_EN_WAKEUP1_CLREN (1 << EVENTROUTER_CLR_EN_WAKEUP1_CLREN_SHIFT)

/* WAKEUP2_CLREN: ... */
#define EVENTROUTER_CLR_EN_WAKEUP2_CLREN_SHIFT (2)
#define EVENTROUTER_CLR_EN_WAKEUP2_CLREN (1 << EVENTROUTER_CLR_EN_WAKEUP2_CLREN_SHIFT)

/* WAKEUP3_CLREN: ... */
#define EVENTROUTER_CLR_EN_WAKEUP3_CLREN_SHIFT (3)
#define EVENTROUTER_CLR_EN_WAKEUP3_CLREN (1 << EVENTROUTER_CLR_EN_WAKEUP3_CLREN_SHIFT)

/* ATIMER_CLREN: ... */
#define EVENTROUTER_CLR_EN_ATIMER_CLREN_SHIFT (4)
#define EVENTROUTER_CLR_EN_ATIMER_CLREN (1 << EVENTROUTER_CLR_EN_ATIMER_CLREN_SHIFT)

/* RTC_CLREN: ... */
#define EVENTROUTER_CLR_EN_RTC_CLREN_SHIFT (5)
#define EVENTROUTER_CLR_EN_RTC_CLREN (1 << EVENTROUTER_CLR_EN_RTC_CLREN_SHIFT)

/* BOD_CLREN: ... */
#define EVENTROUTER_CLR_EN_BOD_CLREN_SHIFT (6)
#define EVENTROUTER_CLR_EN_BOD_CLREN (1 << EVENTROUTER_CLR_EN_BOD_CLREN_SHIFT)

/* WWDT_CLREN: ... */
#define EVENTROUTER_CLR_EN_WWDT_CLREN_SHIFT (7)
#define EVENTROUTER_CLR_EN_WWDT_CLREN (1 << EVENTROUTER_CLR_EN_WWDT_CLREN_SHIFT)

/* ETH_CLREN: ... */
#define EVENTROUTER_CLR_EN_ETH_CLREN_SHIFT (8)
#define EVENTROUTER_CLR_EN_ETH_CLREN (1 << EVENTROUTER_CLR_EN_ETH_CLREN_SHIFT)

/* USB0_CLREN: ... */
#define EVENTROUTER_CLR_EN_USB0_CLREN_SHIFT (9)
#define EVENTROUTER_CLR_EN_USB0_CLREN (1 << EVENTROUTER_CLR_EN_USB0_CLREN_SHIFT)

/* USB1_CLREN: ... */
#define EVENTROUTER_CLR_EN_USB1_CLREN_SHIFT (10)
#define EVENTROUTER_CLR_EN_USB1_CLREN (1 << EVENTROUTER_CLR_EN_USB1_CLREN_SHIFT)

/* SDMMC_CLREN: ... */
#define EVENTROUTER_CLR_EN_SDMMC_CLREN_SHIFT (11)
#define EVENTROUTER_CLR_EN_SDMMC_CLREN (1 << EVENTROUTER_CLR_EN_SDMMC_CLREN_SHIFT)

/* CAN_CLREN: ... */
#define EVENTROUTER_CLR_EN_CAN_CLREN_SHIFT (12)
#define EVENTROUTER_CLR_EN_CAN_CLREN (1 << EVENTROUTER_CLR_EN_CAN_CLREN_SHIFT)

/* TIM2_CLREN: ... */
#define EVENTROUTER_CLR_EN_TIM2_CLREN_SHIFT (13)
#define EVENTROUTER_CLR_EN_TIM2_CLREN (1 << EVENTROUTER_CLR_EN_TIM2_CLREN_SHIFT)

/* TIM6_CLREN: ... */
#define EVENTROUTER_CLR_EN_TIM6_CLREN_SHIFT (14)
#define EVENTROUTER_CLR_EN_TIM6_CLREN (1 << EVENTROUTER_CLR_EN_TIM6_CLREN_SHIFT)

/* QEI_CLREN: ... */
#define EVENTROUTER_CLR_EN_QEI_CLREN_SHIFT (15)
#define EVENTROUTER_CLR_EN_QEI_CLREN (1 << EVENTROUTER_CLR_EN_QEI_CLREN_SHIFT)

/* TIM14_CLREN: ... */
#define EVENTROUTER_CLR_EN_TIM14_CLREN_SHIFT (16)
#define EVENTROUTER_CLR_EN_TIM14_CLREN (1 << EVENTROUTER_CLR_EN_TIM14_CLREN_SHIFT)

/* RESET_CLREN: ... */
#define EVENTROUTER_CLR_EN_RESET_CLREN_SHIFT (19)
#define EVENTROUTER_CLR_EN_RESET_CLREN (1 << EVENTROUTER_CLR_EN_RESET_CLREN_SHIFT)

/* BODRESET_CLREN: ... */
#define EVENTROUTER_CLR_EN_BODRESET_CLREN_SHIFT (20)
#define EVENTROUTER_CLR_EN_BODRESET_CLREN (1 << EVENTROUTER_CLR_EN_BODRESET_CLREN_SHIFT)

/* DPDRESET_CLREN: ... */
#define EVENTROUTER_CLR_EN_DPDRESET_CLREN_SHIFT (21)
#define EVENTROUTER_CLR_EN_DPDRESET_CLREN (1 << EVENTROUTER_CLR_EN_DPDRESET_CLREN_SHIFT)

/* --- Event Router SET_EN values ------------------------------------------ */

/* WAKEUP0_SETEN: ... */
#define EVENTROUTER_SET_EN_WAKEUP0_SETEN_SHIFT (0)
#define EVENTROUTER_SET_EN_WAKEUP0_SETEN (1 << EVENTROUTER_SET_EN_WAKEUP0_SETEN_SHIFT)

/* WAKEUP1_SETEN: ... */
#define EVENTROUTER_SET_EN_WAKEUP1_SETEN_SHIFT (1)
#define EVENTROUTER_SET_EN_WAKEUP1_SETEN (1 << EVENTROUTER_SET_EN_WAKEUP1_SETEN_SHIFT)

/* WAKEUP2_SETEN: ... */
#define EVENTROUTER_SET_EN_WAKEUP2_SETEN_SHIFT (2)
#define EVENTROUTER_SET_EN_WAKEUP2_SETEN (1 << EVENTROUTER_SET_EN_WAKEUP2_SETEN_SHIFT)

/* WAKEUP3_SETEN: ... */
#define EVENTROUTER_SET_EN_WAKEUP3_SETEN_SHIFT (3)
#define EVENTROUTER_SET_EN_WAKEUP3_SETEN (1 << EVENTROUTER_SET_EN_WAKEUP3_SETEN_SHIFT)

/* ATIMER_SETEN: ... */
#define EVENTROUTER_SET_EN_ATIMER_SETEN_SHIFT (4)
#define EVENTROUTER_SET_EN_ATIMER_SETEN (1 << EVENTROUTER_SET_EN_ATIMER_SETEN_SHIFT)

/* RTC_SETEN: ... */
#define EVENTROUTER_SET_EN_RTC_SETEN_SHIFT (5)
#define EVENTROUTER_SET_EN_RTC_SETEN (1 << EVENTROUTER_SET_EN_RTC_SETEN_SHIFT)

/* BOD_SETEN: ... */
#define EVENTROUTER_SET_EN_BOD_SETEN_SHIFT (6)
#define EVENTROUTER_SET_EN_BOD_SETEN (1 << EVENTROUTER_SET_EN_BOD_SETEN_SHIFT)

/* WWDT_SETEN: ... */
#define EVENTROUTER_SET_EN_WWDT_SETEN_SHIFT (7)
#define EVENTROUTER_SET_EN_WWDT_SETEN (1 << EVENTROUTER_SET_EN_WWDT_SETEN_SHIFT)

/* ETH_SETEN: ... */
#define EVENTROUTER_SET_EN_ETH_SETEN_SHIFT (8)
#define EVENTROUTER_SET_EN_ETH_SETEN (1 << EVENTROUTER_SET_EN_ETH_SETEN_SHIFT)

/* USB0_SETEN: ... */
#define EVENTROUTER_SET_EN_USB0_SETEN_SHIFT (9)
#define EVENTROUTER_SET_EN_USB0_SETEN (1 << EVENTROUTER_SET_EN_USB0_SETEN_SHIFT)

/* USB1_SETEN: ... */
#define EVENTROUTER_SET_EN_USB1_SETEN_SHIFT (10)
#define EVENTROUTER_SET_EN_USB1_SETEN (1 << EVENTROUTER_SET_EN_USB1_SETEN_SHIFT)

/* SDMMC_SETEN: ... */
#define EVENTROUTER_SET_EN_SDMMC_SETEN_SHIFT (11)
#define EVENTROUTER_SET_EN_SDMMC_SETEN (1 << EVENTROUTER_SET_EN_SDMMC_SETEN_SHIFT)

/* CAN_SETEN: ... */
#define EVENTROUTER_SET_EN_CAN_SETEN_SHIFT (12)
#define EVENTROUTER_SET_EN_CAN_SETEN (1 << EVENTROUTER_SET_EN_CAN_SETEN_SHIFT)

/* TIM2_SETEN: ... */
#define EVENTROUTER_SET_EN_TIM2_SETEN_SHIFT (13)
#define EVENTROUTER_SET_EN_TIM2_SETEN (1 << EVENTROUTER_SET_EN_TIM2_SETEN_SHIFT)

/* TIM6_SETEN: ... */
#define EVENTROUTER_SET_EN_TIM6_SETEN_SHIFT (14)
#define EVENTROUTER_SET_EN_TIM6_SETEN (1 << EVENTROUTER_SET_EN_TIM6_SETEN_SHIFT)

/* QEI_SETEN: ... */
#define EVENTROUTER_SET_EN_QEI_SETEN_SHIFT (15)
#define EVENTROUTER_SET_EN_QEI_SETEN (1 << EVENTROUTER_SET_EN_QEI_SETEN_SHIFT)

/* TIM14_SETEN: ... */
#define EVENTROUTER_SET_EN_TIM14_SETEN_SHIFT (16)
#define EVENTROUTER_SET_EN_TIM14_SETEN (1 << EVENTROUTER_SET_EN_TIM14_SETEN_SHIFT)

/* RESET_SETEN: ... */
#define EVENTROUTER_SET_EN_RESET_SETEN_SHIFT (19)
#define EVENTROUTER_SET_EN_RESET_SETEN (1 << EVENTROUTER_SET_EN_RESET_SETEN_SHIFT)

/* BODRESET_SETEN: ... */
#define EVENTROUTER_SET_EN_BODRESET_SETEN_SHIFT (20)
#define EVENTROUTER_SET_EN_BODRESET_SETEN (1 << EVENTROUTER_SET_EN_BODRESET_SETEN_SHIFT)

/* DPDRESET_SETEN: ... */
#define EVENTROUTER_SET_EN_DPDRESET_SETEN_SHIFT (21)
#define EVENTROUTER_SET_EN_DPDRESET_SETEN (1 << EVENTROUTER_SET_EN_DPDRESET_SETEN_SHIFT)

/* --- Event Router STATUS values ------------------------------------------ */

/* WAKEUP0_ST: ... */
#define EVENTROUTER_STATUS_WAKEUP0_ST_SHIFT (0)
#define EVENTROUTER_STATUS_WAKEUP0_ST (1 << EVENTROUTER_STATUS_WAKEUP0_ST_SHIFT)

/* WAKEUP1_ST: ... */
#define EVENTROUTER_STATUS_WAKEUP1_ST_SHIFT (1)
#define EVENTROUTER_STATUS_WAKEUP1_ST (1 << EVENTROUTER_STATUS_WAKEUP1_ST_SHIFT)

/* WAKEUP2_ST: ... */
#define EVENTROUTER_STATUS_WAKEUP2_ST_SHIFT (2)
#define EVENTROUTER_STATUS_WAKEUP2_ST (1 << EVENTROUTER_STATUS_WAKEUP2_ST_SHIFT)

/* WAKEUP3_ST: ... */
#define EVENTROUTER_STATUS_WAKEUP3_ST_SHIFT (3)
#define EVENTROUTER_STATUS_WAKEUP3_ST (1 << EVENTROUTER_STATUS_WAKEUP3_ST_SHIFT)

/* ATIMER_ST: ... */
#define EVENTROUTER_STATUS_ATIMER_ST_SHIFT (4)
#define EVENTROUTER_STATUS_ATIMER_ST (1 << EVENTROUTER_STATUS_ATIMER_ST_SHIFT)

/* RTC_ST: ... */
#define EVENTROUTER_STATUS_RTC_ST_SHIFT (5)
#define EVENTROUTER_STATUS_RTC_ST (1 << EVENTROUTER_STATUS_RTC_ST_SHIFT)

/* BOD_ST: ... */
#define EVENTROUTER_STATUS_BOD_ST_SHIFT (6)
#define EVENTROUTER_STATUS_BOD_ST (1 << EVENTROUTER_STATUS_BOD_ST_SHIFT)

/* WWDT_ST: ... */
#define EVENTROUTER_STATUS_WWDT_ST_SHIFT (7)
#define EVENTROUTER_STATUS_WWDT_ST (1 << EVENTROUTER_STATUS_WWDT_ST_SHIFT)

/* ETH_ST: ... */
#define EVENTROUTER_STATUS_ETH_ST_SHIFT (8)
#define EVENTROUTER_STATUS_ETH_ST (1 << EVENTROUTER_STATUS_ETH_ST_SHIFT)

/* USB0_ST: ... */
#define EVENTROUTER_STATUS_USB0_ST_SHIFT (9)
#define EVENTROUTER_STATUS_USB0_ST (1 << EVENTROUTER_STATUS_USB0_ST_SHIFT)

/* USB1_ST: ... */
#define EVENTROUTER_STATUS_USB1_ST_SHIFT (10)
#define EVENTROUTER_STATUS_USB1_ST (1 << EVENTROUTER_STATUS_USB1_ST_SHIFT)

/* SDMMC_ST: ... */
#define EVENTROUTER_STATUS_SDMMC_ST_SHIFT (11)
#define EVENTROUTER_STATUS_SDMMC_ST (1 << EVENTROUTER_STATUS_SDMMC_ST_SHIFT)

/* CAN_ST: ... */
#define EVENTROUTER_STATUS_CAN_ST_SHIFT (12)
#define EVENTROUTER_STATUS_CAN_ST (1 << EVENTROUTER_STATUS_CAN_ST_SHIFT)

/* TIM2_ST: ... */
#define EVENTROUTER_STATUS_TIM2_ST_SHIFT (13)
#define EVENTROUTER_STATUS_TIM2_ST (1 << EVENTROUTER_STATUS_TIM2_ST_SHIFT)

/* TIM6_ST: ... */
#define EVENTROUTER_STATUS_TIM6_ST_SHIFT (14)
#define EVENTROUTER_STATUS_TIM6_ST (1 << EVENTROUTER_STATUS_TIM6_ST_SHIFT)

/* QEI_ST: ... */
#define EVENTROUTER_STATUS_QEI_ST_SHIFT (15)
#define EVENTROUTER_STATUS_QEI_ST (1 << EVENTROUTER_STATUS_QEI_ST_SHIFT)

/* TIM14_ST: ... */
#define EVENTROUTER_STATUS_TIM14_ST_SHIFT (16)
#define EVENTROUTER_STATUS_TIM14_ST (1 << EVENTROUTER_STATUS_TIM14_ST_SHIFT)

/* RESET_ST: ... */
#define EVENTROUTER_STATUS_RESET_ST_SHIFT (19)
#define EVENTROUTER_STATUS_RESET_ST (1 << EVENTROUTER_STATUS_RESET_ST_SHIFT)

/* BODRESET_ST: ... */
#define EVENTROUTER_STATUS_BODRESET_ST_SHIFT (20)
#define EVENTROUTER_STATUS_BODRESET_ST (1 << EVENTROUTER_STATUS_BODRESET_ST_SHIFT)

/* DPDRESET_ST: ... */
#define EVENTROUTER_STATUS_DPDRESET_ST_SHIFT (21)
#define EVENTROUTER_STATUS_DPDRESET_ST (1 << EVENTROUTER_STATUS_DPDRESET_ST_SHIFT)

/* --- Event Router ENABLE values ------------------------------------------ */

/* WAKEUP0_EN: ... */
#define EVENTROUTER_ENABLE_WAKEUP0_EN_SHIFT (0)
#define EVENTROUTER_ENABLE_WAKEUP0_EN (1 << EVENTROUTER_ENABLE_WAKEUP0_EN_SHIFT)

/* WAKEUP1_EN: ... */
#define EVENTROUTER_ENABLE_WAKEUP1_EN_SHIFT (1)
#define EVENTROUTER_ENABLE_WAKEUP1_EN (1 << EVENTROUTER_ENABLE_WAKEUP1_EN_SHIFT)

/* WAKEUP2_EN: ... */
#define EVENTROUTER_ENABLE_WAKEUP2_EN_SHIFT (2)
#define EVENTROUTER_ENABLE_WAKEUP2_EN (1 << EVENTROUTER_ENABLE_WAKEUP2_EN_SHIFT)

/* WAKEUP3_EN: ... */
#define EVENTROUTER_ENABLE_WAKEUP3_EN_SHIFT (3)
#define EVENTROUTER_ENABLE_WAKEUP3_EN (1 << EVENTROUTER_ENABLE_WAKEUP3_EN_SHIFT)

/* ATIMER_EN: ... */
#define EVENTROUTER_ENABLE_ATIMER_EN_SHIFT (4)
#define EVENTROUTER_ENABLE_ATIMER_EN (1 << EVENTROUTER_ENABLE_ATIMER_EN_SHIFT)

/* RTC_EN: ... */
#define EVENTROUTER_ENABLE_RTC_EN_SHIFT (5)
#define EVENTROUTER_ENABLE_RTC_EN (1 << EVENTROUTER_ENABLE_RTC_EN_SHIFT)

/* BOD_EN: ... */
#define EVENTROUTER_ENABLE_BOD_EN_SHIFT (6)
#define EVENTROUTER_ENABLE_BOD_EN (1 << EVENTROUTER_ENABLE_BOD_EN_SHIFT)

/* WWDT_EN: ... */
#define EVENTROUTER_ENABLE_WWDT_EN_SHIFT (7)
#define EVENTROUTER_ENABLE_WWDT_EN (1 << EVENTROUTER_ENABLE_WWDT_EN_SHIFT)

/* ETH_EN: ... */
#define EVENTROUTER_ENABLE_ETH_EN_SHIFT (8)
#define EVENTROUTER_ENABLE_ETH_EN (1 << EVENTROUTER_ENABLE_ETH_EN_SHIFT)

/* USB0_EN: ... */
#define EVENTROUTER_ENABLE_USB0_EN_SHIFT (9)
#define EVENTROUTER_ENABLE_USB0_EN (1 << EVENTROUTER_ENABLE_USB0_EN_SHIFT)

/* USB1_EN: ... */
#define EVENTROUTER_ENABLE_USB1_EN_SHIFT (10)
#define EVENTROUTER_ENABLE_USB1_EN (1 << EVENTROUTER_ENABLE_USB1_EN_SHIFT)

/* SDMMC_EN: ... */
#define EVENTROUTER_ENABLE_SDMMC_EN_SHIFT (11)
#define EVENTROUTER_ENABLE_SDMMC_EN (1 << EVENTROUTER_ENABLE_SDMMC_EN_SHIFT)

/* CAN_EN: ... */
#define EVENTROUTER_ENABLE_CAN_EN_SHIFT (12)
#define EVENTROUTER_ENABLE_CAN_EN (1 << EVENTROUTER_ENABLE_CAN_EN_SHIFT)

/* TIM2_EN: ... */
#define EVENTROUTER_ENABLE_TIM2_EN_SHIFT (13)
#define EVENTROUTER_ENABLE_TIM2_EN (1 << EVENTROUTER_ENABLE_TIM2_EN_SHIFT)

/* TIM6_EN: ... */
#define EVENTROUTER_ENABLE_TIM6_EN_SHIFT (14)
#define EVENTROUTER_ENABLE_TIM6_EN (1 << EVENTROUTER_ENABLE_TIM6_EN_SHIFT)

/* QEI_EN: ... */
#define EVENTROUTER_ENABLE_QEI_EN_SHIFT (15)
#define EVENTROUTER_ENABLE_QEI_EN (1 << EVENTROUTER_ENABLE_QEI_EN_SHIFT)

/* TIM14_EN: ... */
#define EVENTROUTER_ENABLE_TIM14_EN_SHIFT (16)
#define EVENTROUTER_ENABLE_TIM14_EN (1 << EVENTROUTER_ENABLE_TIM14_EN_SHIFT)

/* RESET_EN: ... */
#define EVENTROUTER_ENABLE_RESET_EN_SHIFT (19)
#define EVENTROUTER_ENABLE_RESET_EN (1 << EVENTROUTER_ENABLE_RESET_EN_SHIFT)

/* BODRESET_EN: ... */
#define EVENTROUTER_ENABLE_BODRESET_EN_SHIFT (20)
#define EVENTROUTER_ENABLE_BODRESET_EN (1 << EVENTROUTER_ENABLE_BODRESET_EN_SHIFT)

/* DPDRESET_EN: ... */
#define EVENTROUTER_ENABLE_DPDRESET_EN_SHIFT (21)
#define EVENTROUTER_ENABLE_DPDRESET_EN (1 << EVENTROUTER_ENABLE_DPDRESET_EN_SHIFT)

/* --- Event Router CLR_STAT values ------------------------------------------ */

/* WAKEUP0_CLRST: ... */
#define EVENTROUTER_CLRSTAT_WAKEUP0_CLRST_SHIFT (0)
#define EVENTROUTER_CLRSTAT_WAKEUP0_CLRST (1 << EVENTROUTER_CLRSTAT_WAKEUP0_CLRST_SHIFT)

/* WAKEUP1_CLRST: ... */
#define EVENTROUTER_CLRSTAT_WAKEUP1_CLRST_SHIFT (1)
#define EVENTROUTER_CLRSTAT_WAKEUP1_CLRST (1 << EVENTROUTER_CLRSTAT_WAKEUP1_CLRST_SHIFT)

/* WAKEUP2_CLRST: ... */
#define EVENTROUTER_CLRSTAT_WAKEUP2_CLRST_SHIFT (2)
#define EVENTROUTER_CLRSTAT_WAKEUP2_CLRST (1 << EVENTROUTER_CLRSTAT_WAKEUP2_CLRST_SHIFT)

/* WAKEUP3_CLRST: ... */
#define EVENTROUTER_CLRSTAT_WAKEUP3_CLRST_SHIFT (3)
#define EVENTROUTER_CLRSTAT_WAKEUP3_CLRST (1 << EVENTROUTER_CLRSTAT_WAKEUP3_CLRST_SHIFT)

/* ATIMER_CLRST: ... */
#define EVENTROUTER_CLRSTAT_ATIMER_CLRST_SHIFT (4)
#define EVENTROUTER_CLRSTAT_ATIMER_CLRST (1 << EVENTROUTER_CLRSTAT_ATIMER_CLRST_SHIFT)

/* RTC_CLRST: ... */
#define EVENTROUTER_CLRSTAT_RTC_CLRST_SHIFT (5)
#define EVENTROUTER_CLRSTAT_RTC_CLRST (1 << EVENTROUTER_CLRSTAT_RTC_CLRST_SHIFT)

/* BOD_CLRST: ... */
#define EVENTROUTER_CLRSTAT_BOD_CLRST_SHIFT (6)
#define EVENTROUTER_CLRSTAT_BOD_CLRST (1 << EVENTROUTER_CLRSTAT_BOD_CLRST_SHIFT)

/* WWDT_CLRST: ... */
#define EVENTROUTER_CLRSTAT_WWDT_CLRST_SHIFT (7)
#define EVENTROUTER_CLRSTAT_WWDT_CLRST (1 << EVENTROUTER_CLRSTAT_WWDT_CLRST_SHIFT)

/* ETH_CLRST: ... */
#define EVENTROUTER_CLRSTAT_ETH_CLRST_SHIFT (8)
#define EVENTROUTER_CLRSTAT_ETH_CLRST (1 << EVENTROUTER_CLRSTAT_ETH_CLRST_SHIFT)

/* USB0_CLRST: ... */
#define EVENTROUTER_CLRSTAT_USB0_CLRST_SHIFT (9)
#define EVENTROUTER_CLRSTAT_USB0_CLRST (1 << EVENTROUTER_CLRSTAT_USB0_CLRST_SHIFT)

/* USB1_CLRST: ... */
#define EVENTROUTER_CLRSTAT_USB1_CLRST_SHIFT (10)
#define EVENTROUTER_CLRSTAT_USB1_CLRST (1 << EVENTROUTER_CLRSTAT_USB1_CLRST_SHIFT)

/* SDMMC_CLRST: ... */
#define EVENTROUTER_CLRSTAT_SDMMC_CLRST_SHIFT (11)
#define EVENTROUTER_CLRSTAT_SDMMC_CLRST (1 << EVENTROUTER_CLRSTAT_SDMMC_CLRST_SHIFT)

/* CAN_CLRST: ... */
#define EVENTROUTER_CLRSTAT_CAN_CLRST_SHIFT (12)
#define EVENTROUTER_CLRSTAT_CAN_CLRST (1 << EVENTROUTER_CLRSTAT_CAN_CLRST_SHIFT)

/* TIM2_CLRST: ... */
#define EVENTROUTER_CLRSTAT_TIM2_CLRST_SHIFT (13)
#define EVENTROUTER_CLRSTAT_TIM2_CLRST (1 << EVENTROUTER_CLRSTAT_TIM2_CLRST_SHIFT)

/* TIM6_CLRST: ... */
#define EVENTROUTER_CLRSTAT_TIM6_CLRST_SHIFT (14)
#define EVENTROUTER_CLRSTAT_TIM6_CLRST (1 << EVENTROUTER_CLRSTAT_TIM6_CLRST_SHIFT)

/* QEI_CLRST: ... */
#define EVENTROUTER_CLRSTAT_QEI_CLRST_SHIFT (15)
#define EVENTROUTER_CLRSTAT_QEI_CLRST (1 << EVENTROUTER_CLRSTAT_QEI_CLRST_SHIFT)

/* TIM14_CLRST: ... */
#define EVENTROUTER_CLRSTAT_TIM14_CLRST_SHIFT (16)
#define EVENTROUTER_CLRSTAT_TIM14_CLRST (1 << EVENTROUTER_CLRSTAT_TIM14_CLRST_SHIFT)

/* RESET_CLRST: ... */
#define EVENTROUTER_CLRSTAT_RESET_CLRST_SHIFT (19)
#define EVENTROUTER_CLRSTAT_RESET_CLRST (1 << EVENTROUTER_CLRSTAT_RESET_CLRST_SHIFT)

/* BODRESET_CLRST: ... */
#define EVENTROUTER_CLRSTAT_BODRESET_CLRST_SHIFT (20)
#define EVENTROUTER_CLRSTAT_BODRESET_CLRST (1 << EVENTROUTER_CLRSTAT_BODRESET_CLRST_SHIFT)

/* DPDRESET_CLRST: ... */
#define EVENTROUTER_CLRSTAT_DPDRESET_CLRST_SHIFT (21)
#define EVENTROUTER_CLRSTAT_DPDRESET_CLRST (1 << EVENTROUTER_CLRSTAT_DPDRESET_CLRST_SHIFT)

/* --- Event Router SET_STAT values ------------------------------------------ */

/* WAKEUP0_SETST: ... */
#define EVENTROUTER_SETSTAT_WAKEUP0_SETST_SHIFT (0)
#define EVENTROUTER_SETSTAT_WAKEUP0_SETST (1 << EVENTROUTER_SETSTAT_WAKEUP0_SETST_SHIFT)

/* WAKEUP1_SETST: ... */
#define EVENTROUTER_SETSTAT_WAKEUP1_SETST_SHIFT (1)
#define EVENTROUTER_SETSTAT_WAKEUP1_SETST (1 << EVENTROUTER_SETSTAT_WAKEUP1_SETST_SHIFT)

/* WAKEUP2_SETST: ... */
#define EVENTROUTER_SETSTAT_WAKEUP2_SETST_SHIFT (2)
#define EVENTROUTER_SETSTAT_WAKEUP2_SETST (1 << EVENTROUTER_SETSTAT_WAKEUP2_SETST_SHIFT)

/* WAKEUP3_SETST: ... */
#define EVENTROUTER_SETSTAT_WAKEUP3_SETST_SHIFT (3)
#define EVENTROUTER_SETSTAT_WAKEUP3_SETST (1 << EVENTROUTER_SETSTAT_WAKEUP3_SETST_SHIFT)

/* ATIMER_SETST: ... */
#define EVENTROUTER_SETSTAT_ATIMER_SETST_SHIFT (4)
#define EVENTROUTER_SETSTAT_ATIMER_SETST (1 << EVENTROUTER_SETSTAT_ATIMER_SETST_SHIFT)

/* RTC_SETST: ... */
#define EVENTROUTER_SETSTAT_RTC_SETST_SHIFT (5)
#define EVENTROUTER_SETSTAT_RTC_SETST (1 << EVENTROUTER_SETSTAT_RTC_SETST_SHIFT)

/* BOD_SETST: ... */
#define EVENTROUTER_SETSTAT_BOD_SETST_SHIFT (6)
#define EVENTROUTER_SETSTAT_BOD_SETST (1 << EVENTROUTER_SETSTAT_BOD_SETST_SHIFT)

/* WWDT_SETST: ... */
#define EVENTROUTER_SETSTAT_WWDT_SETST_SHIFT (7)
#define EVENTROUTER_SETSTAT_WWDT_SETST (1 << EVENTROUTER_SETSTAT_WWDT_SETST_SHIFT)

/* ETH_SETST: ... */
#define EVENTROUTER_SETSTAT_ETH_SETST_SHIFT (8)
#define EVENTROUTER_SETSTAT_ETH_SETST (1 << EVENTROUTER_SETSTAT_ETH_SETST_SHIFT)

/* USB0_SETST: ... */
#define EVENTROUTER_SETSTAT_USB0_SETST_SHIFT (9)
#define EVENTROUTER_SETSTAT_USB0_SETST (1 << EVENTROUTER_SETSTAT_USB0_SETST_SHIFT)

/* USB1_SETST: ... */
#define EVENTROUTER_SETSTAT_USB1_SETST_SHIFT (10)
#define EVENTROUTER_SETSTAT_USB1_SETST (1 << EVENTROUTER_SETSTAT_USB1_SETST_SHIFT)

/* SDMMC_SETST: ... */
#define EVENTROUTER_SETSTAT_SDMMC_SETST_SHIFT (11)
#define EVENTROUTER_SETSTAT_SDMMC_SETST (1 << EVENTROUTER_SETSTAT_SDMMC_SETST_SHIFT)

/* CAN_SETST: ... */
#define EVENTROUTER_SETSTAT_CAN_SETST_SHIFT (12)
#define EVENTROUTER_SETSTAT_CAN_SETST (1 << EVENTROUTER_SETSTAT_CAN_SETST_SHIFT)

/* TIM2_SETST: ... */
#define EVENTROUTER_SETSTAT_TIM2_SETST_SHIFT (13)
#define EVENTROUTER_SETSTAT_TIM2_SETST (1 << EVENTROUTER_SETSTAT_TIM2_SETST_SHIFT)

/* TIM6_SETST: ... */
#define EVENTROUTER_SETSTAT_TIM6_SETST_SHIFT (14)
#define EVENTROUTER_SETSTAT_TIM6_SETST (1 << EVENTROUTER_SETSTAT_TIM6_SETST_SHIFT)

/* QEI_SETST: ... */
#define EVENTROUTER_SETSTAT_QEI_SETST_SHIFT (15)
#define EVENTROUTER_SETSTAT_QEI_SETST (1 << EVENTROUTER_SETSTAT_QEI_SETST_SHIFT)

/* TIM14_SETST: ... */
#define EVENTROUTER_SETSTAT_TIM14_SETST_SHIFT (16)
#define EVENTROUTER_SETSTAT_TIM14_SETST (1 << EVENTROUTER_SETSTAT_TIM14_SETST_SHIFT)

/* RESET_SETST: ... */
#define EVENTROUTER_SETSTAT_RESET_SETST_SHIFT (19)
#define EVENTROUTER_SETSTAT_RESET_SETST (1 << EVENTROUTER_SETSTAT_RESET_SETST_SHIFT)

/* BODRESET_SETST: ... */
#define EVENTROUTER_SETSTAT_BODRESET_SETST_SHIFT (20)
#define EVENTROUTER_SETSTAT_BODRESET_SETST (1 << EVENTROUTER_SETSTAT_BODRESET_SETST_SHIFT)

/* DPDRESET_SETST: ... */
#define EVENTROUTER_SETSTAT_DPDRESET_SETST_SHIFT (21)
#define EVENTROUTER_SETSTAT_DPDRESET_SETST (1 << EVENTROUTER_SETSTAT_DPDRESET_SETST_SHIFT)

/**@}*/

#ifdef __cplusplus
}
#endif

#endif
