mbed library sources. Supersedes mbed-src.

Dependents:   keyboard

Fork of mbed-dev by mbed official

Committer:
bogdanm
Date:
Thu Oct 01 15:25:22 2015 +0300
Revision:
0:9b334a45a8ff
Initial commit on mbed-dev

Replaces mbed-src (now inactive)

Who changed what in which revision?

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