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