mbed.h library with any bug fixes AV finds.

Dependents:   micromouse4_encoder_testing PID_Test Lab1_Test WorkingPID ... more

Committer:
aravindsv
Date:
Mon Nov 02 03:07:12 2015 +0000
Revision:
1:ebce2ad32f95
Parent:
0:ba7650f404af
Changed the RCC timeout value to 500 ms, so total code startup time before program starts running is ~1s. Hopefully no side-effects from lower startup timeouts

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aravindsv 0:ba7650f404af 1 /*******************************************************************************
aravindsv 0:ba7650f404af 2 * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved.
aravindsv 0:ba7650f404af 3 *
aravindsv 0:ba7650f404af 4 * Permission is hereby granted, free of charge, to any person obtaining a
aravindsv 0:ba7650f404af 5 * copy of this software and associated documentation files (the "Software"),
aravindsv 0:ba7650f404af 6 * to deal in the Software without restriction, including without limitation
aravindsv 0:ba7650f404af 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
aravindsv 0:ba7650f404af 8 * and/or sell copies of the Software, and to permit persons to whom the
aravindsv 0:ba7650f404af 9 * Software is furnished to do so, subject to the following conditions:
aravindsv 0:ba7650f404af 10 *
aravindsv 0:ba7650f404af 11 * The above copyright notice and this permission notice shall be included
aravindsv 0:ba7650f404af 12 * in all copies or substantial portions of the Software.
aravindsv 0:ba7650f404af 13 *
aravindsv 0:ba7650f404af 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
aravindsv 0:ba7650f404af 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
aravindsv 0:ba7650f404af 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
aravindsv 0:ba7650f404af 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
aravindsv 0:ba7650f404af 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
aravindsv 0:ba7650f404af 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
aravindsv 0:ba7650f404af 20 * OTHER DEALINGS IN THE SOFTWARE.
aravindsv 0:ba7650f404af 21 *
aravindsv 0:ba7650f404af 22 * Except as contained in this notice, the name of Maxim Integrated
aravindsv 0:ba7650f404af 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
aravindsv 0:ba7650f404af 24 * Products, Inc. Branding Policy.
aravindsv 0:ba7650f404af 25 *
aravindsv 0:ba7650f404af 26 * The mere transfer of this software does not imply any licenses
aravindsv 0:ba7650f404af 27 * of trade secrets, proprietary technology, copyrights, patents,
aravindsv 0:ba7650f404af 28 * trademarks, maskwork rights, or any other form of intellectual
aravindsv 0:ba7650f404af 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
aravindsv 0:ba7650f404af 30 * ownership rights.
aravindsv 0:ba7650f404af 31 *******************************************************************************
aravindsv 0:ba7650f404af 32 */
aravindsv 0:ba7650f404af 33
aravindsv 0:ba7650f404af 34 #ifndef _MAX32610_H_
aravindsv 0:ba7650f404af 35 #define _MAX32610_H_
aravindsv 0:ba7650f404af 36
aravindsv 0:ba7650f404af 37 #include <stdint.h>
aravindsv 0:ba7650f404af 38
aravindsv 0:ba7650f404af 39 typedef enum IRQn_Type {
aravindsv 0:ba7650f404af 40 NonMaskableInt_IRQn = -14,
aravindsv 0:ba7650f404af 41 HardFault_IRQn = -13,
aravindsv 0:ba7650f404af 42 MemoryManagement_IRQn = -12,
aravindsv 0:ba7650f404af 43 BusFault_IRQn = -11,
aravindsv 0:ba7650f404af 44 UsageFault_IRQn = -10,
aravindsv 0:ba7650f404af 45 SVCall_IRQn = -5,
aravindsv 0:ba7650f404af 46 DebugMonitor_IRQn = -4,
aravindsv 0:ba7650f404af 47 PendSV_IRQn = -2,
aravindsv 0:ba7650f404af 48 SysTick_IRQn = -1,
aravindsv 0:ba7650f404af 49
aravindsv 0:ba7650f404af 50 /* Externals interrupts */
aravindsv 0:ba7650f404af 51 UART0_IRQn = 0, /* 16:01 UART0 */
aravindsv 0:ba7650f404af 52 UART1_IRQn, /* 17: 2 UART1 */
aravindsv 0:ba7650f404af 53 I2CM0_IRQn, /* 18: 3 I2C Master 0 */
aravindsv 0:ba7650f404af 54 I2CS_IRQn, /* 19: 4 I2C Slave */
aravindsv 0:ba7650f404af 55 USB_IRQn, /* 20: 5 USB */
aravindsv 0:ba7650f404af 56 PMU_IRQn, /* 21: 6 DMA */
aravindsv 0:ba7650f404af 57 AFE_IRQn, /* 22: 7 AFE */
aravindsv 0:ba7650f404af 58 MAA_IRQn, /* 23: 8 MAA */
aravindsv 0:ba7650f404af 59 AES_IRQn, /* 24: 9 AES */
aravindsv 0:ba7650f404af 60 SPI0_IRQn, /* 25:10 SPI0 */
aravindsv 0:ba7650f404af 61 SPI1_IRQn, /* 26:11 SPI1 */
aravindsv 0:ba7650f404af 62 SPI2_IRQn, /* 27:12 SPI2 */
aravindsv 0:ba7650f404af 63 TMR0_IRQn, /* 28:13 Timer32-0 */
aravindsv 0:ba7650f404af 64 TMR1_IRQn, /* 29:14 Timer32-1 */
aravindsv 0:ba7650f404af 65 TMR2_IRQn, /* 30:15 Timer32-1 */
aravindsv 0:ba7650f404af 66 TMR3_IRQn, /* 31:16 Timer32-2 */
aravindsv 0:ba7650f404af 67 RSVD0_IRQn, /* 32:17 RSVD */
aravindsv 0:ba7650f404af 68 RSVD1_IRQn, /* 33:18 RSVD */
aravindsv 0:ba7650f404af 69 DAC0_IRQn, /* 34:19 DAC0 (12-bit DAC) */
aravindsv 0:ba7650f404af 70 DAC1_IRQn, /* 35:20 DAC1 (12-bit DAC) */
aravindsv 0:ba7650f404af 71 DAC2_IRQn, /* 36:21 DAC2 (8-bit DAC) */
aravindsv 0:ba7650f404af 72 DAC3_IRQn, /* 37:22 DAC3 (8-bit DAC) */
aravindsv 0:ba7650f404af 73 ADC_IRQn, /* 38:23 ADC */
aravindsv 0:ba7650f404af 74 FLC_IRQn, /* 39:24 Flash Controller */
aravindsv 0:ba7650f404af 75 PWRMAN_IRQn, /* 40:25 PWRMAN */
aravindsv 0:ba7650f404af 76 CLKMAN_IRQn, /* 41:26 CLKMAN */
aravindsv 0:ba7650f404af 77 RTC0_IRQn, /* 42:27 RTC INT0 */
aravindsv 0:ba7650f404af 78 RTC1_IRQn, /* 43:28 RTC INT1 */
aravindsv 0:ba7650f404af 79 RTC2_IRQn, /* 44:29 RTC INT2 */
aravindsv 0:ba7650f404af 80 RTC3_IRQn, /* 45:30 RTC INT3 */
aravindsv 0:ba7650f404af 81 WDT0_IRQn, /* 46:31 WATCHDOG0 */
aravindsv 0:ba7650f404af 82 WDT0_P_IRQn, /* 47:32 WATCHDOG0 PRE-WINDOW */
aravindsv 0:ba7650f404af 83 WDT1_IRQn, /* 48:33 WATCHDOG1 */
aravindsv 0:ba7650f404af 84 WDT1_P_IRQn, /* 49:34 WATCHDOG1 PRE-WINDOW */
aravindsv 0:ba7650f404af 85 GPIO_P0_IRQn, /* 50:35 GPIO Port 0 */
aravindsv 0:ba7650f404af 86 GPIO_P1_IRQn, /* 51:36 GPIO Port 1 */
aravindsv 0:ba7650f404af 87 GPIO_P2_IRQn, /* 52:37 GPIO Port 2 */
aravindsv 0:ba7650f404af 88 GPIO_P3_IRQn, /* 53:38 GPIO Port 3 */
aravindsv 0:ba7650f404af 89 GPIO_P4_IRQn, /* 54:39 GPIO Port 4 */
aravindsv 0:ba7650f404af 90 GPIO_P5_IRQn, /* 55:40 GPIO Port 5 */
aravindsv 0:ba7650f404af 91 GPIO_P6_IRQn, /* 56:41 GPIO Port 6 */
aravindsv 0:ba7650f404af 92 GPIO_P7_IRQn, /* 57:42 GPIO Port 7 */
aravindsv 0:ba7650f404af 93 TMR16_0_IRQn, /* 58:43 Timer16-s0 */
aravindsv 0:ba7650f404af 94 TMR16_1_IRQn, /* 59:44 Timer16-s1 */
aravindsv 0:ba7650f404af 95 TMR16_2_IRQn, /* 60:45 Timer16-s2 */
aravindsv 0:ba7650f404af 96 TMR16_3_IRQn, /* 61:46 Timer16-s3 */
aravindsv 0:ba7650f404af 97 I2CM1_IRQn, /* 62:47 I2C Master 1 */
aravindsv 0:ba7650f404af 98 MXC_IRQ_EXT_COUNT,
aravindsv 0:ba7650f404af 99 } IRQn_Type;
aravindsv 0:ba7650f404af 100
aravindsv 0:ba7650f404af 101 #define MXC_IRQ_COUNT (MXC_IRQ_EXT_COUNT + 16)
aravindsv 0:ba7650f404af 102
aravindsv 0:ba7650f404af 103 /* ================================================================================ */
aravindsv 0:ba7650f404af 104 /* ================ Processor and Core Peripheral Section ================ */
aravindsv 0:ba7650f404af 105 /* ================================================================================ */
aravindsv 0:ba7650f404af 106
aravindsv 0:ba7650f404af 107 #define __NVIC_PRIO_BITS 3 /*!< Number of Bits used for Priority Levels */
aravindsv 0:ba7650f404af 108
aravindsv 0:ba7650f404af 109 #include <core_cm3.h> /* Processor and core peripherals */
aravindsv 0:ba7650f404af 110 #include "system_max32610.h" /* System Header */
aravindsv 0:ba7650f404af 111
aravindsv 0:ba7650f404af 112
aravindsv 0:ba7650f404af 113 /* ================================================================================ */
aravindsv 0:ba7650f404af 114 /* ================== Device Specific Memory Section ================== */
aravindsv 0:ba7650f404af 115 /* ================================================================================ */
aravindsv 0:ba7650f404af 116
aravindsv 0:ba7650f404af 117 #define MXC_FLASH_MEM_BASE 0x00000000UL
aravindsv 0:ba7650f404af 118 #define MXC_FLASH_PAGE_SIZE 0x1000 // 256 x 128b = 4KB
aravindsv 0:ba7650f404af 119 #define MXC_FLASH_MEM_SIZE 0x00040000UL
aravindsv 0:ba7650f404af 120 #define MXC_SYS_MEM_BASE 0x20000000UL
aravindsv 0:ba7650f404af 121
aravindsv 0:ba7650f404af 122 /* ================================================================================ */
aravindsv 0:ba7650f404af 123 /* ================ Device Specific Peripheral Section ================ */
aravindsv 0:ba7650f404af 124 /* ================================================================================ */
aravindsv 0:ba7650f404af 125
aravindsv 0:ba7650f404af 126 /*******************************************************************************/
aravindsv 0:ba7650f404af 127 /* General Purpose I/O Ports (GPIO) */
aravindsv 0:ba7650f404af 128
aravindsv 0:ba7650f404af 129
aravindsv 0:ba7650f404af 130 #define MXC_BASE_GPIO ((uint32_t)0x40000000UL)
aravindsv 0:ba7650f404af 131 #define MXC_GPIO ((mxc_gpio_regs_t *)MXC_BASE_GPIO)
aravindsv 0:ba7650f404af 132 #define MXC_BASE_GPIO_BITBAND ((uint32_t)0x42000000UL)
aravindsv 0:ba7650f404af 133
aravindsv 0:ba7650f404af 134 #define MXC_GPIO_GET_IRQ(i) (((unsigned int)i) + GPIO_P0_IRQn)
aravindsv 0:ba7650f404af 135
aravindsv 0:ba7650f404af 136
aravindsv 0:ba7650f404af 137 /*******************************************************************************/
aravindsv 0:ba7650f404af 138 /* Pulse Train Generation */
aravindsv 0:ba7650f404af 139
aravindsv 0:ba7650f404af 140 #define MXC_CFG_PT_INSTANCES (13)
aravindsv 0:ba7650f404af 141
aravindsv 0:ba7650f404af 142 #define MXC_BASE_PTG ((uint32_t)0x40001000UL)
aravindsv 0:ba7650f404af 143 #define MXC_PTG ((mxc_ptg_regs_t *)MXC_BASE_PTG)
aravindsv 0:ba7650f404af 144 #define MXC_BASE_PT ((uint32_t)0x40001008UL)
aravindsv 0:ba7650f404af 145 #define MXC_PT ((mxc_pt_regs_t *)MXC_BASE_PT)
aravindsv 0:ba7650f404af 146 #define MXC_BASE_PT0 ((uint32_t)0x40001008UL)
aravindsv 0:ba7650f404af 147 #define MXC_PT0 ((mxc_pt_regs_t *)MXC_BASE_PT0)
aravindsv 0:ba7650f404af 148 #define MXC_BASE_PT1 ((uint32_t)0x40001010UL)
aravindsv 0:ba7650f404af 149 #define MXC_PT1 ((mxc_pt_regs_t *)MXC_BASE_PT1)
aravindsv 0:ba7650f404af 150 #define MXC_BASE_PT2 ((uint32_t)0x40001018UL)
aravindsv 0:ba7650f404af 151 #define MXC_PT2 ((mxc_pt_regs_t *)MXC_BASE_PT2)
aravindsv 0:ba7650f404af 152 #define MXC_BASE_PT3 ((uint32_t)0x40001020UL)
aravindsv 0:ba7650f404af 153 #define MXC_PT3 ((mxc_pt_regs_t *)MXC_BASE_PT3)
aravindsv 0:ba7650f404af 154 #define MXC_BASE_PT4 ((uint32_t)0x40001028UL)
aravindsv 0:ba7650f404af 155 #define MXC_PT4 ((mxc_pt_regs_t *)MXC_BASE_PT4)
aravindsv 0:ba7650f404af 156 #define MXC_BASE_PT5 ((uint32_t)0x40001030UL)
aravindsv 0:ba7650f404af 157 #define MXC_PT5 ((mxc_pt_regs_t *)MXC_BASE_PT5)
aravindsv 0:ba7650f404af 158 #define MXC_BASE_PT6 ((uint32_t)0x40001038UL)
aravindsv 0:ba7650f404af 159 #define MXC_PT6 ((mxc_pt_regs_t *)MXC_BASE_PT6)
aravindsv 0:ba7650f404af 160 #define MXC_BASE_PT7 ((uint32_t)0x40001040UL)
aravindsv 0:ba7650f404af 161 #define MXC_PT7 ((mxc_pt_regs_t *)MXC_BASE_PT7)
aravindsv 0:ba7650f404af 162
aravindsv 0:ba7650f404af 163 /* PT12, PT13, PT14 are not used */
aravindsv 0:ba7650f404af 164
aravindsv 0:ba7650f404af 165 /*******************************************************************************/
aravindsv 0:ba7650f404af 166 /* CRC-16/CRC-32 Engine */
aravindsv 0:ba7650f404af 167
aravindsv 0:ba7650f404af 168 #define MXC_BASE_CRC ((uint32_t)0x40010000UL)
aravindsv 0:ba7650f404af 169 #define MXC_CRC_REGS ((mxc_crc_regs_t *)MXC_BASE_CRC)
aravindsv 0:ba7650f404af 170
aravindsv 0:ba7650f404af 171 #define MXC_BASE_CRC_DATA ((uint32_t)0x4010B000UL)
aravindsv 0:ba7650f404af 172 #define MXC_CRC_DATA ((mxc_crc_data_regs_t *)MXC_BASE_CRC_DATA)
aravindsv 0:ba7650f404af 173
aravindsv 0:ba7650f404af 174 /*******************************************************************************/
aravindsv 0:ba7650f404af 175 /* Trust Protection Unit (TPU) */
aravindsv 0:ba7650f404af 176
aravindsv 0:ba7650f404af 177 #define MXC_BASE_TPU ((uint32_t)0x40011000UL)
aravindsv 0:ba7650f404af 178 #define MXC_TPU ((mxc_tpu_regs_t *)MXC_BASE_TPU)
aravindsv 0:ba7650f404af 179
aravindsv 0:ba7650f404af 180 #define MXC_BASE_TPU_TSR ((uint32_t)0x40011C00UL)
aravindsv 0:ba7650f404af 181 #define MXC_TPU_TSR ((mxc_tpu_tsr_regs_t *)MXC_BASE_TPU_TSR)
aravindsv 0:ba7650f404af 182
aravindsv 0:ba7650f404af 183 /*******************************************************************************/
aravindsv 0:ba7650f404af 184 /* AES Cryptographic Engine */
aravindsv 0:ba7650f404af 185
aravindsv 0:ba7650f404af 186 #define MXC_BASE_AES ((uint32_t)0x40011400UL)
aravindsv 0:ba7650f404af 187 #define MXC_AES ((mxc_aes_regs_t *)MXC_BASE_AES)
aravindsv 0:ba7650f404af 188
aravindsv 0:ba7650f404af 189 #define MXC_BASE_AES_MEM ((uint32_t)0x4010A000UL)
aravindsv 0:ba7650f404af 190 #define MXC_AES_MEM ((mxc_aes_mem_regs_t *)MXC_BASE_AES_MEM)
aravindsv 0:ba7650f404af 191
aravindsv 0:ba7650f404af 192
aravindsv 0:ba7650f404af 193 /*******************************************************************************/
aravindsv 0:ba7650f404af 194 /* MAA Cryptographic Engine */
aravindsv 0:ba7650f404af 195
aravindsv 0:ba7650f404af 196 #define MXC_BASE_MAA ((uint32_t)0x40011800UL)
aravindsv 0:ba7650f404af 197 #define MXC_MAA ((mxc_maa_regs_t *)MXC_BASE_MAA)
aravindsv 0:ba7650f404af 198
aravindsv 0:ba7650f404af 199 #define MXC_BASE_MAA_MEM ((uint32_t)0x4010A800UL)
aravindsv 0:ba7650f404af 200 #define MXC_MAA_MEM ((mxc_maa_mem_regs_t *)MXC_BASE_MAA_MEM)
aravindsv 0:ba7650f404af 201
aravindsv 0:ba7650f404af 202 /*******************************************************************************/
aravindsv 0:ba7650f404af 203 /* 32-Bit PWM Timer/Counter */
aravindsv 0:ba7650f404af 204
aravindsv 0:ba7650f404af 205 #define MXC_CFG_TMR_INSTANCES (4)
aravindsv 0:ba7650f404af 206
aravindsv 0:ba7650f404af 207 #define MXC_BASE_TMR0 ((uint32_t)0x40012000UL)
aravindsv 0:ba7650f404af 208 #define MXC_BASE_TMR0_BITBAND ((uint32_t)0x42240000UL)
aravindsv 0:ba7650f404af 209 #define MXC_TMR0 ((mxc_tmr_regs_t *) MXC_BASE_TMR0)
aravindsv 0:ba7650f404af 210
aravindsv 0:ba7650f404af 211 #define MXC_BASE_TMR1 ((uint32_t)0x40013000UL)
aravindsv 0:ba7650f404af 212 #define MXC_BASE_TMR1_BITBAND ((uint32_t)0x42260000UL)
aravindsv 0:ba7650f404af 213 #define MXC_TMR1 ((mxc_tmr_regs_t *) MXC_BASE_TMR1)
aravindsv 0:ba7650f404af 214
aravindsv 0:ba7650f404af 215 #define MXC_BASE_TMR2 ((uint32_t)0x40014000UL)
aravindsv 0:ba7650f404af 216 #define MXC_BASE_TMR2_BITBAND ((uint32_t)0x42280000UL)
aravindsv 0:ba7650f404af 217 #define MXC_TMR2 ((mxc_tmr_regs_t *) MXC_BASE_TMR2)
aravindsv 0:ba7650f404af 218
aravindsv 0:ba7650f404af 219 #define MXC_BASE_TMR3 ((uint32_t)0x40015000UL)
aravindsv 0:ba7650f404af 220 #define MXC_BASE_TMR3_BITBAND ((uint32_t)0x422A0000UL)
aravindsv 0:ba7650f404af 221 #define MXC_TMR3 ((mxc_tmr_regs_t *) MXC_BASE_TMR3)
aravindsv 0:ba7650f404af 222
aravindsv 0:ba7650f404af 223
aravindsv 0:ba7650f404af 224 #define MXC_TMR_GET_IRQ_32(i) ((i) == 0 ? TMR0_IRQn : \
aravindsv 0:ba7650f404af 225 (i) == 1 ? TMR1_IRQn : \
aravindsv 0:ba7650f404af 226 (i) == 2 ? TMR2_IRQn : \
aravindsv 0:ba7650f404af 227 (i) == 3 ? TMR3_IRQn : 0)
aravindsv 0:ba7650f404af 228
aravindsv 0:ba7650f404af 229 #define MXC_TMR_GET_IRQ_16(i) ((i) == 0 ? TMR0_IRQn : \
aravindsv 0:ba7650f404af 230 (i) == 1 ? TMR1_IRQn : \
aravindsv 0:ba7650f404af 231 (i) == 2 ? TMR2_IRQn : \
aravindsv 0:ba7650f404af 232 (i) == 3 ? TMR3_IRQn : \
aravindsv 0:ba7650f404af 233 (i) == 4 ? TMR16_0_IRQn : \
aravindsv 0:ba7650f404af 234 (i) == 5 ? TMR16_1_IRQn : \
aravindsv 0:ba7650f404af 235 (i) == 6 ? TMR16_2_IRQn : \
aravindsv 0:ba7650f404af 236 (i) == 7 ? TMR16_3_IRQn : 0)
aravindsv 0:ba7650f404af 237
aravindsv 0:ba7650f404af 238 #define MXC_TMR_GET_BASE(i) ((i) == 0 ? MXC_BASE_TMR0 : \
aravindsv 0:ba7650f404af 239 (i) == 1 ? MXC_BASE_TMR1 : \
aravindsv 0:ba7650f404af 240 (i) == 2 ? MXC_BASE_TMR2 : \
aravindsv 0:ba7650f404af 241 (i) == 3 ? MXC_BASE_TMR3 : 0)
aravindsv 0:ba7650f404af 242
aravindsv 0:ba7650f404af 243 #define MXC_TMR_GET_TMR(i) ((i) == 0 ? MXC_TMR0 : \
aravindsv 0:ba7650f404af 244 (i) == 1 ? MXC_TMR1 : \
aravindsv 0:ba7650f404af 245 (i) == 2 ? MXC_TMR2 : \
aravindsv 0:ba7650f404af 246 (i) == 3 ? MXC_TMR3 : 0)
aravindsv 0:ba7650f404af 247 /*******************************************************************************/
aravindsv 0:ba7650f404af 248 /* Watchdog Timer */
aravindsv 0:ba7650f404af 249
aravindsv 0:ba7650f404af 250 #define MXC_CFG_WDT_INSTANCES (2)
aravindsv 0:ba7650f404af 251
aravindsv 0:ba7650f404af 252 #define MXC_BASE_WDT0 ((uint32_t)0x40021000UL)
aravindsv 0:ba7650f404af 253 #define MXC_BASE_WDT0_BITBAND ((uint32_t)0x42420000UL)
aravindsv 0:ba7650f404af 254 #define MXC_WDT0 ((mxc_wdt_regs_t *)MXC_BASE_WDT0)
aravindsv 0:ba7650f404af 255
aravindsv 0:ba7650f404af 256 #define MXC_BASE_WDT1 ((uint32_t)0x40022000UL)
aravindsv 0:ba7650f404af 257 #define MXC_BASE_WDT1_BITBAND ((uint32_t)0x42440000UL)
aravindsv 0:ba7650f404af 258 #define MXC_WDT1 ((mxc_wdt_regs_t *)MXC_BASE_WDT1)
aravindsv 0:ba7650f404af 259
aravindsv 0:ba7650f404af 260 #define MXC_WDT_GET_IRQ(i) ((i) == 0 ? WDT0_IRQn : \
aravindsv 0:ba7650f404af 261 (i) == 1 ? WDT1_IRQn : 0)
aravindsv 0:ba7650f404af 262
aravindsv 0:ba7650f404af 263 #define MXC_WDT_GET_IRQ_P(i) ((i) == 0 ? WDT0_P_IRQn : \
aravindsv 0:ba7650f404af 264 (i) == 1 ? WDT1_P_IRQn : 0)
aravindsv 0:ba7650f404af 265
aravindsv 0:ba7650f404af 266 #define MXC_WDT_GET_BASE(i) ((i) == 0 ? MXC_BASE_WDT0 : \
aravindsv 0:ba7650f404af 267 (i) == 1 ? MXC_BASE_WDT1 : 0)
aravindsv 0:ba7650f404af 268
aravindsv 0:ba7650f404af 269 #define MXC_WDT_GET_WDT(i) ((i) == 0 ? MXC_WDT0 : \
aravindsv 0:ba7650f404af 270 (i) == 1 ? MXC_WDT1 : 0)
aravindsv 0:ba7650f404af 271
aravindsv 0:ba7650f404af 272 /*******************************************************************************/
aravindsv 0:ba7650f404af 273 /* SPI Interface */
aravindsv 0:ba7650f404af 274
aravindsv 0:ba7650f404af 275 #define MXC_CFG_SPI_INSTANCES (3)
aravindsv 0:ba7650f404af 276 #define MXC_CFG_SPI_FIFO_DEPTH (16)
aravindsv 0:ba7650f404af 277
aravindsv 0:ba7650f404af 278 #define MXC_BASE_SPI0 ((uint32_t)0x40030000UL)
aravindsv 0:ba7650f404af 279 #define MXC_SPI0 ((mxc_spi_regs_t *)MXC_BASE_SPI0)
aravindsv 0:ba7650f404af 280
aravindsv 0:ba7650f404af 281 #define MXC_BASE_SPI0_TXFIFO ((uint32_t)0x40100000UL)
aravindsv 0:ba7650f404af 282 #define MXC_SPI0_TXFIFO ((mxc_spi_txfifo_regs_t *)MXC_BASE_SPI0_TXFIFO)
aravindsv 0:ba7650f404af 283 #define MXC_BASE_SPI0_RXFIFO ((uint32_t)0x40100800UL)
aravindsv 0:ba7650f404af 284 #define MXC_SPI0_RXFIFO ((mxc_spi_rxfifo_regs_t *)MXC_BASE_SPI0_RXFIFO)
aravindsv 0:ba7650f404af 285
aravindsv 0:ba7650f404af 286 #define MXC_BASE_SPI1 ((uint32_t)0x40031000UL)
aravindsv 0:ba7650f404af 287 #define MXC_SPI1 ((mxc_spi_regs_t *)MXC_BASE_SPI1)
aravindsv 0:ba7650f404af 288
aravindsv 0:ba7650f404af 289 #define MXC_BASE_SPI1_TXFIFO ((uint32_t)0x40101000UL)
aravindsv 0:ba7650f404af 290 #define MXC_SPI1_TXFIFO ((mxc_spi_txfifo_regs_t *)MXC_BASE_SPI1_TXFIFO)
aravindsv 0:ba7650f404af 291 #define MXC_BASE_SPI1_RXFIFO ((uint32_t)0x40101800UL)
aravindsv 0:ba7650f404af 292 #define MXC_SPI1_RXFIFO ((mxc_spi_rxfifo_regs_t *)MXC_BASE_SPI1_RXFIFO)
aravindsv 0:ba7650f404af 293
aravindsv 0:ba7650f404af 294 #define MXC_BASE_SPI2 ((uint32_t)0x40032000UL)
aravindsv 0:ba7650f404af 295 #define MXC_SPI2 ((mxc_spi_regs_t *)MXC_BASE_SPI2)
aravindsv 0:ba7650f404af 296
aravindsv 0:ba7650f404af 297 #define MXC_BASE_SPI2_TXFIFO ((uint32_t)0x40102000UL)
aravindsv 0:ba7650f404af 298 #define MXC_SPI2_TXFIFO ((mxc_spi_txfifo_regs_t *)MXC_BASE_SPI2_TXFIFO)
aravindsv 0:ba7650f404af 299 #define MXC_BASE_SPI2_RXFIFO ((uint32_t)0x40102800UL)
aravindsv 0:ba7650f404af 300 #define MXC_SPI2_RXFIFO ((mxc_spi_rxfifo_regs_t *)MXC_BASE_SPI2_RXFIFO)
aravindsv 0:ba7650f404af 301
aravindsv 0:ba7650f404af 302
aravindsv 0:ba7650f404af 303 #define MXC_SPI_GET_IRQ(i) ((i) == 0 ? SPI0_IRQn : \
aravindsv 0:ba7650f404af 304 (i) == 1 ? SPI1_IRQn : \
aravindsv 0:ba7650f404af 305 (i) == 2 ? SPI2_IRQn : 0)
aravindsv 0:ba7650f404af 306
aravindsv 0:ba7650f404af 307 #define MXC_SPI_GET_BASE(i) ((i) == 0 ? MXC_BASE_SPI0 : \
aravindsv 0:ba7650f404af 308 (i) == 1 ? MXC_BASE_SPI1 : \
aravindsv 0:ba7650f404af 309 (i) == 2 ? MXC_BASE_SPI2 : 0)
aravindsv 0:ba7650f404af 310
aravindsv 0:ba7650f404af 311 #define MXC_SPI_GET_SPI(i) ((i) == 0 ? MXC_SPI0 : \
aravindsv 0:ba7650f404af 312 (i) == 1 ? MXC_SPI1 : \
aravindsv 0:ba7650f404af 313 (i) == 2 ? MXC_SPI2 : 0)
aravindsv 0:ba7650f404af 314
aravindsv 0:ba7650f404af 315 #define MXC_SPI_GET_RXFIFO(i) ((i) == 0 ? MXC_SPI0_RXFIFO : \
aravindsv 0:ba7650f404af 316 (i) == 1 ? MXC_SPI1_RXFIFO : \
aravindsv 0:ba7650f404af 317 (i) == 2 ? MXC_SPI2_RXFIFO : 0)
aravindsv 0:ba7650f404af 318
aravindsv 0:ba7650f404af 319 #define MXC_SPI_GET_TXFIFO(i) ((i) == 0 ? MXC_SPI0_TXFIFO : \
aravindsv 0:ba7650f404af 320 (i) == 1 ? MXC_SPI1_TXFIFO : \
aravindsv 0:ba7650f404af 321 (i) == 2 ? MXC_SPI2_TXFIFO : 0)
aravindsv 0:ba7650f404af 322
aravindsv 0:ba7650f404af 323 #define MXC_SPI_INSTANCE_TO_BASE(instance) (((uint32_t)(instance) << 12) + MXC_BASE_SPI0)
aravindsv 0:ba7650f404af 324 #define MXC_SPI_BASE_TO_INSTANCE(base) (((uint32_t)(base) & 0x00003000) >> 12)
aravindsv 0:ba7650f404af 325
aravindsv 0:ba7650f404af 326
aravindsv 0:ba7650f404af 327 /*******************************************************************************/
aravindsv 0:ba7650f404af 328 /* UART Interface */
aravindsv 0:ba7650f404af 329
aravindsv 0:ba7650f404af 330 #define MXC_CFG_UART_INSTANCES (2)
aravindsv 0:ba7650f404af 331
aravindsv 0:ba7650f404af 332 #define MXC_BASE_UART0 ((uint32_t)0x40038000UL)
aravindsv 0:ba7650f404af 333 #define MXC_BASE_UART0_BITBAND ((uint32_t)0x42700000UL)
aravindsv 0:ba7650f404af 334 #define MXC_UART0 ((mxc_uart_regs_t *)MXC_BASE_UART0)
aravindsv 0:ba7650f404af 335
aravindsv 0:ba7650f404af 336 #define MXC_BASE_UART1 ((uint32_t)0x40039000UL)
aravindsv 0:ba7650f404af 337 #define MXC_BASE_UART1_BITBAND ((uint32_t)0x42720000UL)
aravindsv 0:ba7650f404af 338 #define MXC_UART1 ((mxc_uart_regs_t *)MXC_BASE_UART1)
aravindsv 0:ba7650f404af 339
aravindsv 0:ba7650f404af 340
aravindsv 0:ba7650f404af 341 #define MXC_UART_GET_IRQ(i) ((i) == 0 ? UART0_IRQn : \
aravindsv 0:ba7650f404af 342 (i) == 1 ? UART1_IRQn : 0)
aravindsv 0:ba7650f404af 343
aravindsv 0:ba7650f404af 344 #define MXC_UART_GET_BASE(i) ((i) == 0 ? MXC_BASE_UART0 : \
aravindsv 0:ba7650f404af 345 (i) == 1 ? MXC_BASE_UART1 : 0)
aravindsv 0:ba7650f404af 346
aravindsv 0:ba7650f404af 347 #define MXC_UART_GET_UART(i) ((i) == 0 ? MXC_UART0 : \
aravindsv 0:ba7650f404af 348 (i) == 1 ? MXC_UART1 : 0)
aravindsv 0:ba7650f404af 349
aravindsv 0:ba7650f404af 350 #define MXC_UART_INSTANCE_TO_BASE(instance) (((uint32_t)(instance) << 12) + MXC_BASE_UART0)
aravindsv 0:ba7650f404af 351 #define MXC_UART_BASE_TO_INSTANCE(base) (((uint32_t)(base) & 0x00001000) >> 12)
aravindsv 0:ba7650f404af 352
aravindsv 0:ba7650f404af 353
aravindsv 0:ba7650f404af 354 /*******************************************************************************/
aravindsv 0:ba7650f404af 355 /* I2C Master Interface */
aravindsv 0:ba7650f404af 356
aravindsv 0:ba7650f404af 357 #define MXC_CFG_I2CM_INSTANCES (2)
aravindsv 0:ba7650f404af 358
aravindsv 0:ba7650f404af 359 #define MXC_BASE_I2CM0 ((uint32_t)0x40040000UL)
aravindsv 0:ba7650f404af 360 #define MXC_BASE_I2CM0_BITBAND ((uint32_t)0x42800000UL)
aravindsv 0:ba7650f404af 361 #define MXC_I2CM0 ((mxc_i2cm_regs_t *)MXC_BASE_I2CM0)
aravindsv 0:ba7650f404af 362 #define MXC_BASE_I2CM0_TX_FIFO ((uint32_t)0x40103000UL)
aravindsv 0:ba7650f404af 363 #define MXC_BASE_I2CM0_RX_FIFO ((uint32_t)0x40103800UL)
aravindsv 0:ba7650f404af 364
aravindsv 0:ba7650f404af 365 #define MXC_BASE_I2CM1 ((uint32_t)0x40042000UL)
aravindsv 0:ba7650f404af 366 #define MXC_BASE_I2CM1_BITBAND ((uint32_t)0x42840000UL)
aravindsv 0:ba7650f404af 367 #define MXC_I2CM1 ((mxc_i2cm_regs_t *)MXC_BASE_I2CM1)
aravindsv 0:ba7650f404af 368 #define MXC_BASE_I2CM1_TX_FIFO ((uint32_t)0x4010D000UL)
aravindsv 0:ba7650f404af 369 #define MXC_BASE_I2CM1_RX_FIFO ((uint32_t)0x4010D800UL)
aravindsv 0:ba7650f404af 370
aravindsv 0:ba7650f404af 371 #define MXC_I2CM_GET_IRQ(i) ((i) == 0 ? I2CM0_IRQn : \
aravindsv 0:ba7650f404af 372 (i) == 1 ? I2CM1_IRQn : 0)
aravindsv 0:ba7650f404af 373
aravindsv 0:ba7650f404af 374 #define MXC_I2CM_GET_BASE(i) ((i) == 0 ? MXC_BASE_I2CM0 : \
aravindsv 0:ba7650f404af 375 (i) == 1 ? MXC_BASE_I2CM1 : 0)
aravindsv 0:ba7650f404af 376
aravindsv 0:ba7650f404af 377 #define MXC_I2CM_GET_I2CM(i) ((i) == 0 ? MXC_I2CM0 : \
aravindsv 0:ba7650f404af 378 (i) == 1 ? MXC_I2CM1 : 0)
aravindsv 0:ba7650f404af 379
aravindsv 0:ba7650f404af 380 #define MXC_I2CM_GET_BASE_TX_FIFO(i) ((i) == 0 ? MXC_BASE_I2CM0_TX_FIFO : \
aravindsv 0:ba7650f404af 381 (i) == 1 ? MXC_BASE_I2CM1_TX_FIFO : 0)
aravindsv 0:ba7650f404af 382
aravindsv 0:ba7650f404af 383 #define MXC_I2CM_GET_BASE_RX_FIFO(i) ((i) == 0 ? MXC_BASE_I2CM0_RX_FIFO : \
aravindsv 0:ba7650f404af 384 (i) == 1 ? MXC_BASE_I2CM1_RX_FIFO : 0)
aravindsv 0:ba7650f404af 385
aravindsv 0:ba7650f404af 386 #define MXC_I2CM_INSTANCE_TO_BASE(instance) (((uint32_t)(instance) << 13) + MXC_BASE_I2CM0)
aravindsv 0:ba7650f404af 387 #define MXC_I2CM_BASE_TO_INSTANCE(base) (((uint32_t)(base) & 0x00002000) >> 13)
aravindsv 0:ba7650f404af 388
aravindsv 0:ba7650f404af 389
aravindsv 0:ba7650f404af 390 /*******************************************************************************/
aravindsv 0:ba7650f404af 391 /* I2C Slave Interface */
aravindsv 0:ba7650f404af 392
aravindsv 0:ba7650f404af 393 #define MXC_CFG_I2CS_INSTANCES (1)
aravindsv 0:ba7650f404af 394
aravindsv 0:ba7650f404af 395 #define MXC_BASE_I2CS0 ((uint32_t)0x40041000UL)
aravindsv 0:ba7650f404af 396 #define MXC_BASE_I2CS0_BITBAND ((uint32_t)0x42820000UL)
aravindsv 0:ba7650f404af 397 #define MXC_I2CS0 ((mxc_i2cs_regs_t *)MXC_BASE_I2CS0)
aravindsv 0:ba7650f404af 398
aravindsv 0:ba7650f404af 399 #define MXC_BASE_I2CS0_FIFO ((uint32_t)0x40104000UL)
aravindsv 0:ba7650f404af 400 #define MXC_I2CS0_FIFO ((mxc_i2cs_fifo_regs_t *)MXC_BASE_I2CS0)
aravindsv 0:ba7650f404af 401
aravindsv 0:ba7650f404af 402
aravindsv 0:ba7650f404af 403
aravindsv 0:ba7650f404af 404 /*******************************************************************************/
aravindsv 0:ba7650f404af 405 /* DACs */
aravindsv 0:ba7650f404af 406
aravindsv 0:ba7650f404af 407 #define MXC_CFG_DAC_INSTANCES (4)
aravindsv 0:ba7650f404af 408 #define MXC_CFG_DAC_FIFO_DEPTH (32)
aravindsv 0:ba7650f404af 409
aravindsv 0:ba7650f404af 410 #define MXC_BASE_DAC0 ((uint32_t)0x40050000UL)
aravindsv 0:ba7650f404af 411 #define MXC_DAC0 ((mxc_dac_regs_t *)MXC_BASE_DAC0)
aravindsv 0:ba7650f404af 412 #define MXC_BASE_DAC0_FIFO ((uint32_t)0x40105000UL)
aravindsv 0:ba7650f404af 413 #define MXC_DAC0_FIFO ((mxc_dac_fifo_regs_t *)MXC_BASE_DAC0_FIFO)
aravindsv 0:ba7650f404af 414 #define MXC_DAC0_WIDTH ((uint8_t)(2))
aravindsv 0:ba7650f404af 415
aravindsv 0:ba7650f404af 416 #define MXC_BASE_DAC1 ((uint32_t)0x40051000UL)
aravindsv 0:ba7650f404af 417 #define MXC_DAC1 ((mxc_dac_regs_t *)MXC_BASE_DAC1)
aravindsv 0:ba7650f404af 418 #define MXC_BASE_DAC1_FIFO ((uint32_t)0x40106000UL)
aravindsv 0:ba7650f404af 419 #define MXC_DAC1_FIFO ((mxc_dac_fifo_regs_t *)MXC_BASE_DAC1_FIFO)
aravindsv 0:ba7650f404af 420 #define MXC_DAC1_WIDTH ((uint8_t)(2))
aravindsv 0:ba7650f404af 421
aravindsv 0:ba7650f404af 422 #define MXC_BASE_DAC2 ((uint32_t)0x40052000UL)
aravindsv 0:ba7650f404af 423 #define MXC_DAC2 ((mxc_dac_regs_t *)MXC_BASE_DAC2)
aravindsv 0:ba7650f404af 424 #define MXC_BASE_DAC2_FIFO ((uint32_t)0x40107000UL)
aravindsv 0:ba7650f404af 425 #define MXC_DAC2_FIFO ((mxc_dac_fifo_regs_t *)MXC_BASE_DAC2_FIFO)
aravindsv 0:ba7650f404af 426 #define MXC_DAC2_WIDTH ((uint8_t)(1))
aravindsv 0:ba7650f404af 427
aravindsv 0:ba7650f404af 428 #define MXC_BASE_DAC3 ((uint32_t)0x40053000UL)
aravindsv 0:ba7650f404af 429 #define MXC_DAC3 ((mxc_dac_regs_t *)MXC_BASE_DAC3)
aravindsv 0:ba7650f404af 430 #define MXC_BASE_DAC3_FIFO ((uint32_t)0x40108000UL)
aravindsv 0:ba7650f404af 431 #define MXC_DAC3_FIFO ((mxc_dac_fifo_regs_t *)MXC_BASE_DAC3_FIFO)
aravindsv 0:ba7650f404af 432 #define MXC_DAC3_WIDTH ((uint8_t)(1))
aravindsv 0:ba7650f404af 433
aravindsv 0:ba7650f404af 434
aravindsv 0:ba7650f404af 435 #define MXC_DAC_GET_IRQ(i) ((i) == 0 ? DAC0_IRQn : \
aravindsv 0:ba7650f404af 436 (i) == 1 ? DAC1_IRQn : \
aravindsv 0:ba7650f404af 437 (i) == 2 ? DAC2_IRQn : \
aravindsv 0:ba7650f404af 438 (i) == 3 ? DAC3_IRQn : 0)
aravindsv 0:ba7650f404af 439
aravindsv 0:ba7650f404af 440
aravindsv 0:ba7650f404af 441 #define MXC_DAC_GET_BASE(i) (i == 0 ? MXC_BASE_DAC0 : \
aravindsv 0:ba7650f404af 442 i == 1 ? MXC_BASE_DAC1 : \
aravindsv 0:ba7650f404af 443 i == 2 ? MXC_BASE_DAC2 : \
aravindsv 0:ba7650f404af 444 i == 3 ? MXC_BASE_DAC3 : 0)
aravindsv 0:ba7650f404af 445
aravindsv 0:ba7650f404af 446 #define MXC_DAC_GET_FIFO(i) (i == 0 ? MXC_BASE_DAC0_FIFO : \
aravindsv 0:ba7650f404af 447 i == 1 ? MXC_BASE_DAC1_FIFO : \
aravindsv 0:ba7650f404af 448 i == 2 ? MXC_BASE_DAC2_FIFO : \
aravindsv 0:ba7650f404af 449 i == 3 ? MXC_BASE_DAC3_FIFO : 0)
aravindsv 0:ba7650f404af 450
aravindsv 0:ba7650f404af 451 #define MXC_DAC_GET_PMU_FIFO_IRQ(i) (i == 0 ? PMU_IRQ_DAC0_FIFO_AE : \
aravindsv 0:ba7650f404af 452 i == 1 ? PMU_IRQ_DAC1_FIFO_AE : \
aravindsv 0:ba7650f404af 453 i == 2 ? PMU_IRQ_DAC2_FIFO_AE : \
aravindsv 0:ba7650f404af 454 i == 3 ? PMU_IRQ_DAC3_FIFO_AE : 0)
aravindsv 0:ba7650f404af 455
aravindsv 0:ba7650f404af 456 #define MXC_DAC_GET_DAC(i) (i == 0 ? MXC_DAC0 : \
aravindsv 0:ba7650f404af 457 i == 1 ? MXC_DAC1 : \
aravindsv 0:ba7650f404af 458 i == 2 ? MXC_DAC2 : \
aravindsv 0:ba7650f404af 459 i == 3 ? MXC_DAC3 : 0)
aravindsv 0:ba7650f404af 460
aravindsv 0:ba7650f404af 461 #define MXC_DAC_GET_WIDTH(i) (i == 0 ? MXC_DAC0_WIDTH : \
aravindsv 0:ba7650f404af 462 i == 1 ? MXC_DAC1_WIDTH : \
aravindsv 0:ba7650f404af 463 i == 2 ? MXC_DAC2_WIDTH : \
aravindsv 0:ba7650f404af 464 i == 3 ? MXC_DAC3_WIDTH : 0)
aravindsv 0:ba7650f404af 465
aravindsv 0:ba7650f404af 466
aravindsv 0:ba7650f404af 467 /*******************************************************************************/
aravindsv 0:ba7650f404af 468 /* Analog Front End */
aravindsv 0:ba7650f404af 469
aravindsv 0:ba7650f404af 470 #define MXC_BASE_AFE ((uint32_t)0x4005401CUL)
aravindsv 0:ba7650f404af 471 #define MXC_AFE ((mxc_afe_regs_t *)MXC_BASE_AFE)
aravindsv 0:ba7650f404af 472
aravindsv 0:ba7650f404af 473
aravindsv 0:ba7650f404af 474
aravindsv 0:ba7650f404af 475 /*******************************************************************************/
aravindsv 0:ba7650f404af 476 /* ADC */
aravindsv 0:ba7650f404af 477
aravindsv 0:ba7650f404af 478 #define MXC_CFG_ADC_FIFO_DEPTH ((uint32_t)(32))
aravindsv 0:ba7650f404af 479
aravindsv 0:ba7650f404af 480 #define MXC_BASE_ADC ((uint32_t)0x40054000UL)
aravindsv 0:ba7650f404af 481 #define MXC_ADC ((mxc_adc_regs_t *)MXC_BASE_ADC)
aravindsv 0:ba7650f404af 482
aravindsv 0:ba7650f404af 483 #define MXC_BASE_ADCCFG ((uint32_t)0x40054038UL)
aravindsv 0:ba7650f404af 484 #define MXC_ADCCFG ((mxc_adccfg_regs_t *)MXC_BASE_ADCCFG)
aravindsv 0:ba7650f404af 485
aravindsv 0:ba7650f404af 486 #define MXC_BASE_ADC_FIFO ((uint32_t)0x40109000UL)
aravindsv 0:ba7650f404af 487 #define MXC_ADC_FIFO ((mxc_adc_fifo_regs_t *)MXC_BASE_ADC_FIFO)
aravindsv 0:ba7650f404af 488
aravindsv 0:ba7650f404af 489
aravindsv 0:ba7650f404af 490
aravindsv 0:ba7650f404af 491 /*******************************************************************************/
aravindsv 0:ba7650f404af 492 /* Peripheral Management Unit (PMU) - formerly DMA Controller */
aravindsv 0:ba7650f404af 493
aravindsv 0:ba7650f404af 494 #define MXC_CFG_PMU_CHANNELS (6)
aravindsv 0:ba7650f404af 495
aravindsv 0:ba7650f404af 496 #define MXC_BASE_PMU0 ((uint32_t)0x40070000UL)
aravindsv 0:ba7650f404af 497 #define MXC_PMU0 ((mxc_pmu_regs_t *)MXC_BASE_PMU0)
aravindsv 0:ba7650f404af 498 #define MXC_BASE_PMU1 ((uint32_t)0x40070020UL)
aravindsv 0:ba7650f404af 499 #define MXC_PMU1 ((mxc_pmu_regs_t *)MXC_BASE_PMU1)
aravindsv 0:ba7650f404af 500 #define MXC_BASE_PMU2 ((uint32_t)0x40070040UL)
aravindsv 0:ba7650f404af 501 #define MXC_PMU2 ((mxc_pmu_regs_t *)MXC_BASE_PMU2)
aravindsv 0:ba7650f404af 502 #define MXC_BASE_PMU3 ((uint32_t)0x40070060UL)
aravindsv 0:ba7650f404af 503 #define MXC_PMU3 ((mxc_pmu_regs_t *)MXC_BASE_PMU3)
aravindsv 0:ba7650f404af 504 #define MXC_BASE_PMU4 ((uint32_t)0x40070080UL)
aravindsv 0:ba7650f404af 505 #define MXC_PMU4 ((mxc_pmu_regs_t *)MXC_BASE_PMU4)
aravindsv 0:ba7650f404af 506 #define MXC_BASE_PMU5 ((uint32_t)0x400700A0UL)
aravindsv 0:ba7650f404af 507 #define MXC_PMU5 ((mxc_pmu_regs_t *)MXC_BASE_PMU5)
aravindsv 0:ba7650f404af 508
aravindsv 0:ba7650f404af 509 #define MXC_BASE_PMU_BITBAND ((uint32_t)0x42E00000UL)
aravindsv 0:ba7650f404af 510 #define MXC_BASE_PMU_BITBAND_CHOFFSET ((uint32_t)0x00000400UL)
aravindsv 0:ba7650f404af 511 /*******************************************************************************/
aravindsv 0:ba7650f404af 512
aravindsv 0:ba7650f404af 513 typedef enum {
aravindsv 0:ba7650f404af 514 PMU_IRQ_DAC0_FIFO_AE,
aravindsv 0:ba7650f404af 515 PMU_IRQ_DAC1_FIFO_AE,
aravindsv 0:ba7650f404af 516 PMU_IRQ_DAC2_FIFO_AE,
aravindsv 0:ba7650f404af 517 PMU_IRQ_DAC3_FIFO_AE,
aravindsv 0:ba7650f404af 518 PMU_IRQ_DAC0_DONE,
aravindsv 0:ba7650f404af 519 PMU_IRQ_DAC1_DONE,
aravindsv 0:ba7650f404af 520 PMU_IRQ_DAC2_DONE,
aravindsv 0:ba7650f404af 521 PMU_IRQ_DAC3_DONE,
aravindsv 0:ba7650f404af 522 PMU_IRQ_ADC_FIFO_AF,
aravindsv 0:ba7650f404af 523 PMU_IRQ_ADC_DONE,
aravindsv 0:ba7650f404af 524 PMU_IRQ_I2C_MST0_DONE,
aravindsv 0:ba7650f404af 525 PMU_IRQ_I2C_MST1_DONE,
aravindsv 0:ba7650f404af 526 PMU_IRQ_SPI0_RSLTS_DONE,
aravindsv 0:ba7650f404af 527 PMU_IRQ_SPI1_RSLTS_DONE,
aravindsv 0:ba7650f404af 528 PMU_IRQ_SPI2_RSLTS_DONE,
aravindsv 0:ba7650f404af 529 PMU_IRQ_MAA_DONE,
aravindsv 0:ba7650f404af 530 PMU_IRQ_SPI0_TX_FIFO_AE,
aravindsv 0:ba7650f404af 531 PMU_IRQ_SPI0_RSLTS_FIFO_AF,
aravindsv 0:ba7650f404af 532 PMU_IRQ_SPI1_TX_FIFO_AE,
aravindsv 0:ba7650f404af 533 PMU_IRQ_SPI1_RSLTS_FIFO_AF,
aravindsv 0:ba7650f404af 534 PMU_IRQ_SPI2_TX_FIFO_AE,
aravindsv 0:ba7650f404af 535 PMU_IRQ_SPI3_RSLTS_FIFO_AF,
aravindsv 0:ba7650f404af 536 PMU_IRQ_I2C_MST0_TRANS_FIFO,
aravindsv 0:ba7650f404af 537 PMU_IRQ_I2C_MST0_RSLT_FIFO,
aravindsv 0:ba7650f404af 538 PMU_IRQ_I2C_MST1_TRANS_FIFO,
aravindsv 0:ba7650f404af 539 PMU_IRQ_I2C_MST2_RSLT_FIFO,
aravindsv 0:ba7650f404af 540 PMU_IRQ_I2C_SLV_TRANS_FIFO,
aravindsv 0:ba7650f404af 541 PMU_IRQ_I2C_SLV_RSLT_FIFO,
aravindsv 0:ba7650f404af 542 PMU_IRQ_UART0_TX_FIFO,
aravindsv 0:ba7650f404af 543 PMU_IRQ_UART0_RX_FIFO,
aravindsv 0:ba7650f404af 544 PMU_IRQ_UART1_TX_FIFO,
aravindsv 0:ba7650f404af 545 PMU_IRQ_UART1_RX_FIFO,
aravindsv 0:ba7650f404af 546 PMU_IRQ_SPI0_EXCP,
aravindsv 0:ba7650f404af 547 PMU_IRQ_SPI1_EXCP,
aravindsv 0:ba7650f404af 548 PMU_IRQ_SPI2_EXCP,
aravindsv 0:ba7650f404af 549 PMU_IRQ_RSVD0,
aravindsv 0:ba7650f404af 550 PMU_IRQ_I2C_MST0_EXCP,
aravindsv 0:ba7650f404af 551 PMU_IRQ_I2C_MST1_EXCP,
aravindsv 0:ba7650f404af 552 PMU_IRQ_I2C_SLV_EXCP,
aravindsv 0:ba7650f404af 553 PMU_IRQ_RSVD1,
aravindsv 0:ba7650f404af 554 PMU_IRQ_GPIO0,
aravindsv 0:ba7650f404af 555 PMU_IRQ_GPIO1,
aravindsv 0:ba7650f404af 556 PMU_IRQ_GPIO2,
aravindsv 0:ba7650f404af 557 PMU_IRQ_GPIO3,
aravindsv 0:ba7650f404af 558 PMU_IRQ_GPIO4,
aravindsv 0:ba7650f404af 559 PMU_IRQ_GPIO5,
aravindsv 0:ba7650f404af 560 PMU_IRQ_GPIO6,
aravindsv 0:ba7650f404af 561 PMU_IRQ_GPIO7,
aravindsv 0:ba7650f404af 562 PMU_IRQ_GPIO8,
aravindsv 0:ba7650f404af 563 PMU_IRQ_AFE_COMP_NMI,
aravindsv 0:ba7650f404af 564 PMU_IRQ_AES_ENGINE,
aravindsv 0:ba7650f404af 565 } pmu_int_mask_t;
aravindsv 0:ba7650f404af 566
aravindsv 0:ba7650f404af 567 /*******************************************************************************/
aravindsv 0:ba7650f404af 568 /* USB */
aravindsv 0:ba7650f404af 569
aravindsv 0:ba7650f404af 570 #define MXC_BASE_USB ((uint32_t)0x4010C000UL)
aravindsv 0:ba7650f404af 571 #define MXC_USB ((mxc_usb_regs_t *)MXC_BASE_USB)
aravindsv 0:ba7650f404af 572
aravindsv 0:ba7650f404af 573 #define MXC_USB_MAX_PACKET (64)
aravindsv 0:ba7650f404af 574 #define MXC_USB_NUM_EP (8)
aravindsv 0:ba7650f404af 575
aravindsv 0:ba7650f404af 576
aravindsv 0:ba7650f404af 577 /*******************************************************************************/
aravindsv 0:ba7650f404af 578 /* Instruction Cache Controller */
aravindsv 0:ba7650f404af 579
aravindsv 0:ba7650f404af 580 #define MXC_BASE_ICC ((uint32_t)0x40080000UL)
aravindsv 0:ba7650f404af 581 #define MXC_ICC ((mxc_icc_regs_t *)MXC_BASE_ICC)
aravindsv 0:ba7650f404af 582
aravindsv 0:ba7650f404af 583 /* System Manager */
aravindsv 0:ba7650f404af 584
aravindsv 0:ba7650f404af 585 #define MXC_BASE_SYSMAN ((uint32_t)0x40090000UL)
aravindsv 0:ba7650f404af 586
aravindsv 0:ba7650f404af 587 /*******************************************************************************/
aravindsv 0:ba7650f404af 588 /* Clock Manager */
aravindsv 0:ba7650f404af 589
aravindsv 0:ba7650f404af 590 #define MXC_BASE_CLKMAN ((uint32_t)0x40090400UL)
aravindsv 0:ba7650f404af 591 #define MXC_CLKMAN ((mxc_clkman_regs_t *)MXC_BASE_CLKMAN)
aravindsv 0:ba7650f404af 592
aravindsv 0:ba7650f404af 593
aravindsv 0:ba7650f404af 594 /*******************************************************************************/
aravindsv 0:ba7650f404af 595 /* Power Manager */
aravindsv 0:ba7650f404af 596
aravindsv 0:ba7650f404af 597 #define MXC_BASE_PWRMAN ((uint32_t)0x40090800UL)
aravindsv 0:ba7650f404af 598 #define MXC_PWRMAN ((mxc_pwrman_regs_t *)MXC_BASE_PWRMAN)
aravindsv 0:ba7650f404af 599
aravindsv 0:ba7650f404af 600 /*******************************************************************************/
aravindsv 0:ba7650f404af 601 /* I/O Manager */
aravindsv 0:ba7650f404af 602
aravindsv 0:ba7650f404af 603 #define MXC_BASE_IOMAN ((uint32_t)0x40090C00UL)
aravindsv 0:ba7650f404af 604 #define MXC_IOMAN ((mxc_ioman_regs_t *)MXC_BASE_IOMAN)
aravindsv 0:ba7650f404af 605
aravindsv 0:ba7650f404af 606
aravindsv 0:ba7650f404af 607 /*******************************************************************************/
aravindsv 0:ba7650f404af 608 /* RTC: Timer/Alarms */
aravindsv 0:ba7650f404af 609
aravindsv 0:ba7650f404af 610 #define MXC_BASE_RTCTMR ((uint32_t)0x40090A00UL)
aravindsv 0:ba7650f404af 611 #define MXC_RTCTMR ((mxc_rtctmr_regs_t *)MXC_BASE_RTCTMR)
aravindsv 0:ba7650f404af 612
aravindsv 0:ba7650f404af 613 #define MXC_RTCTMR_GET_IRQ(i) (i == 0 ? RTC0_IRQn : \
aravindsv 0:ba7650f404af 614 i == 1 ? RTC1_IRQn : \
aravindsv 0:ba7650f404af 615 i == 2 ? RTC2_IRQn : \
aravindsv 0:ba7650f404af 616 i == 3 ? RTC3_IRQn : 0)
aravindsv 0:ba7650f404af 617
aravindsv 0:ba7650f404af 618 #define MXC_BASE_RTCCFG ((uint32_t)0x40090A70UL)
aravindsv 0:ba7650f404af 619 #define MXC_RTCCFG ((mxc_rtccfg_regs_t *)MXC_BASE_RTCCFG)
aravindsv 0:ba7650f404af 620 /*******************************************************************************/
aravindsv 0:ba7650f404af 621 /* RTC: Power Sequencer */
aravindsv 0:ba7650f404af 622
aravindsv 0:ba7650f404af 623 #define MXC_BASE_PWRSEQ ((uint32_t)0x40090A30UL)
aravindsv 0:ba7650f404af 624 #define MXC_PWRSEQ ((mxc_pwrseq_regs_t *)MXC_BASE_PWRSEQ)
aravindsv 0:ba7650f404af 625
aravindsv 0:ba7650f404af 626 /*******************************************************************************/
aravindsv 0:ba7650f404af 627 /* Trim Shadow Registers */
aravindsv 0:ba7650f404af 628
aravindsv 0:ba7650f404af 629 #define MXC_BASE_TRIM ((uint32_t)0x400E0000UL)
aravindsv 0:ba7650f404af 630 #define MXC_TRIM ((mxc_ftr_regs_t *)MXC_BASE_TRIM)
aravindsv 0:ba7650f404af 631
aravindsv 0:ba7650f404af 632 /*******************************************************************************/
aravindsv 0:ba7650f404af 633 /* Flash Memory Controller / Security */
aravindsv 0:ba7650f404af 634
aravindsv 0:ba7650f404af 635 #define MXC_BASE_FLC ((uint32_t)0x400F0000UL)
aravindsv 0:ba7650f404af 636 #define MXC_FLC ((mxc_flc_regs_t *)MXC_BASE_FLC)
aravindsv 0:ba7650f404af 637 #define MXC_BASE_FLC_BITBAND ((uint32_t)0x43E00000UL)
aravindsv 0:ba7650f404af 638 #define MXC_FLC_PAGE_SIZE_SHIFT 11
aravindsv 0:ba7650f404af 639 #define MXC_FLC_PAGE_SIZE (1 << MXC_FLC_PAGE_SIZE_SHIFT)
aravindsv 0:ba7650f404af 640 #define MXC_FLC_PAGE_ERASE_MSK ((~(1 << (MXC_FLC_PAGE_SIZE_SHIFT - 1))) >> MXC_FLC_PAGE_SIZE_SHIFT) << MXC_FLC_PAGE_SIZE_SHIFT
aravindsv 0:ba7650f404af 641
aravindsv 0:ba7650f404af 642 /*******************************************************************************/
aravindsv 0:ba7650f404af 643
aravindsv 0:ba7650f404af 644 #define MXC_SET_FIELD(reg, clr, set) (*(volatile uint32_t *)reg = ((*(volatile uint32_t *)reg & ~clr) | set))
aravindsv 0:ba7650f404af 645
aravindsv 0:ba7650f404af 646 /*******************************************************************************/
aravindsv 0:ba7650f404af 647
aravindsv 0:ba7650f404af 648 #define BITBAND(reg, bit) ((0xf0000000 & (uint32_t)(reg)) + 0x2000000 + (((uint32_t)(reg) & 0x0fffffff) << 5) + ((bit) << 2))
aravindsv 0:ba7650f404af 649 #define BITBAND_ClrBit(reg, bit) *(volatile uint32_t *)BITBAND(reg, bit) = 0
aravindsv 0:ba7650f404af 650 #define BITBAND_SetBit(reg, bit) *(volatile uint32_t *)BITBAND(reg, bit) = 1
aravindsv 0:ba7650f404af 651 #define BITBAND_GetBit(reg, bit) (*(volatile uint32_t *)BITBAND(reg, bit))
aravindsv 0:ba7650f404af 652
aravindsv 0:ba7650f404af 653 /*******************************************************************************/
aravindsv 0:ba7650f404af 654
aravindsv 0:ba7650f404af 655 #endif /* _MAX32610_H_ */