test

Committer:
elijahsj
Date:
Mon Nov 09 00:33:19 2020 -0500
Revision:
2:4364577b5ad8
Parent:
1:8a094db1347f
copied mbed library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elijahsj 1:8a094db1347f 1 /**
elijahsj 1:8a094db1347f 2 * @file
elijahsj 1:8a094db1347f 3 * @brief MAX3263X device specific definitions for the core, peripherals,
elijahsj 1:8a094db1347f 4 * features, memory, and IRQs.
elijahsj 1:8a094db1347f 5 */
elijahsj 1:8a094db1347f 6 /* *****************************************************************************
elijahsj 1:8a094db1347f 7 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
elijahsj 1:8a094db1347f 8 *
elijahsj 1:8a094db1347f 9 * Permission is hereby granted, free of charge, to any person obtaining a
elijahsj 1:8a094db1347f 10 * copy of this software and associated documentation files (the "Software"),
elijahsj 1:8a094db1347f 11 * to deal in the Software without restriction, including without limitation
elijahsj 1:8a094db1347f 12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
elijahsj 1:8a094db1347f 13 * and/or sell copies of the Software, and to permit persons to whom the
elijahsj 1:8a094db1347f 14 * Software is furnished to do so, subject to the following conditions:
elijahsj 1:8a094db1347f 15 *
elijahsj 1:8a094db1347f 16 * The above copyright notice and this permission notice shall be included
elijahsj 1:8a094db1347f 17 * in all copies or substantial portions of the Software.
elijahsj 1:8a094db1347f 18 *
elijahsj 1:8a094db1347f 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
elijahsj 1:8a094db1347f 20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
elijahsj 1:8a094db1347f 21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
elijahsj 1:8a094db1347f 22 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
elijahsj 1:8a094db1347f 23 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
elijahsj 1:8a094db1347f 24 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
elijahsj 1:8a094db1347f 25 * OTHER DEALINGS IN THE SOFTWARE.
elijahsj 1:8a094db1347f 26 *
elijahsj 1:8a094db1347f 27 * Except as contained in this notice, the name of Maxim Integrated
elijahsj 1:8a094db1347f 28 * Products, Inc. shall not be used except as stated in the Maxim Integrated
elijahsj 1:8a094db1347f 29 * Products, Inc. Branding Policy.
elijahsj 1:8a094db1347f 30 *
elijahsj 1:8a094db1347f 31 * The mere transfer of this software does not imply any licenses
elijahsj 1:8a094db1347f 32 * of trade secrets, proprietary technology, copyrights, patents,
elijahsj 1:8a094db1347f 33 * trademarks, maskwork rights, or any other form of intellectual
elijahsj 1:8a094db1347f 34 * property whatsoever. Maxim Integrated Products, Inc. retains all
elijahsj 1:8a094db1347f 35 * ownership rights.
elijahsj 1:8a094db1347f 36 *
elijahsj 1:8a094db1347f 37 *
elijahsj 1:8a094db1347f 38 * $Date: 2016-10-31 17:08:23 -0500 (Mon, 31 Oct 2016) $
elijahsj 1:8a094db1347f 39 * $Revision: 24858 $
elijahsj 1:8a094db1347f 40 *
elijahsj 1:8a094db1347f 41 *************************************************************************** */
elijahsj 1:8a094db1347f 42
elijahsj 1:8a094db1347f 43 /* **** Includes **** */
elijahsj 1:8a094db1347f 44 #include <stdint.h>
elijahsj 1:8a094db1347f 45
elijahsj 1:8a094db1347f 46 /* Define to prevent redundant inclusion */
elijahsj 1:8a094db1347f 47 #ifndef _MAX3263X_H_
elijahsj 1:8a094db1347f 48 #define _MAX3263X_H_
elijahsj 1:8a094db1347f 49
elijahsj 1:8a094db1347f 50
elijahsj 1:8a094db1347f 51 /**
elijahsj 1:8a094db1347f 52 * @ingroup cmsis_product
elijahsj 1:8a094db1347f 53 * @defgroup product_name MAX3263X
elijahsj 1:8a094db1347f 54 * @brief MAX3263X device specific definitions for the core, peripherals,
elijahsj 1:8a094db1347f 55 * features, memory, and IRQs.
elijahsj 1:8a094db1347f 56 * @details The <b><em>MAX32630/MAX32631</em></b> is an ARM&reg;
elijahsj 1:8a094db1347f 57 * Cortex&reg;-M4F 32-bit microcontroller with a floating point
elijahsj 1:8a094db1347f 58 * unit, ideal for the emerging category of wearable medical and
elijahsj 1:8a094db1347f 59 * fitness applications. The architecture combines ultra-low power
elijahsj 1:8a094db1347f 60 * high-efficiency signal processing functionality with
elijahsj 1:8a094db1347f 61 * significantly reduced power consumption and ease of use. The
elijahsj 1:8a094db1347f 62 * device features four powerful and flexible power modes. A
elijahsj 1:8a094db1347f 63 * peripheral management unit (PMU) enables intelligent peripheral
elijahsj 1:8a094db1347f 64 * control with up to six channels to significantly reduce power
elijahsj 1:8a094db1347f 65 * consumption. Built-in dynamic clock gating and
elijahsj 1:8a094db1347f 66 * firmware-controlled power gating allows the user to optimize
elijahsj 1:8a094db1347f 67 * power for the specific application. Multiple SPI, UART and
elijahsj 1:8a094db1347f 68 * I&sup2;C serial interfaces, as well as 1-Wire&reg; master and
elijahsj 1:8a094db1347f 69 * USB, allow for interconnection to a wide variety of external
elijahsj 1:8a094db1347f 70 * sensors. A four-input, 10-bit ADC with selectable references is
elijahsj 1:8a094db1347f 71 * available to monitor analog input from external sensors and
elijahsj 1:8a094db1347f 72 * meters. The small 100-ball WLP package provides a tiny, 4.37mm x
elijahsj 1:8a094db1347f 73 * 4.37mm footprint. The <b><em>MAX32630/MAX32631</em></b> include
elijahsj 1:8a094db1347f 74 * a hardware AES engine. The <b>@em MAX32631</b> is a secure
elijahsj 1:8a094db1347f 75 * version of the <b>@em MAX32630</b>. It incorporates a trust
elijahsj 1:8a094db1347f 76 * protection unit (TPU) with encryption and advanced security
elijahsj 1:8a094db1347f 77 * features. These features include a modular arithmetic
elijahsj 1:8a094db1347f 78 * accelerator (MAA) for fast ECDSA, a hardware PRNG entropy
elijahsj 1:8a094db1347f 79 * generator, and a secure boot loader.
elijahsj 1:8a094db1347f 80 * @{
elijahsj 1:8a094db1347f 81 */
elijahsj 1:8a094db1347f 82 #ifndef FALSE
elijahsj 1:8a094db1347f 83 /**
elijahsj 1:8a094db1347f 84 * @internal False
elijahsj 1:8a094db1347f 85 */
elijahsj 1:8a094db1347f 86 #define FALSE (0)
elijahsj 1:8a094db1347f 87 #endif
elijahsj 1:8a094db1347f 88
elijahsj 1:8a094db1347f 89 #ifndef TRUE
elijahsj 1:8a094db1347f 90 /**
elijahsj 1:8a094db1347f 91 * @internal True
elijahsj 1:8a094db1347f 92 */
elijahsj 1:8a094db1347f 93 #define TRUE (1)
elijahsj 1:8a094db1347f 94 #endif
elijahsj 1:8a094db1347f 95
elijahsj 1:8a094db1347f 96 /* COMPILER SPECIFIC DEFINES (IAR, ARMCC and GNUC) */
elijahsj 1:8a094db1347f 97 #if defined ( __GNUC__ )
elijahsj 1:8a094db1347f 98 #define __weak __attribute__((weak)) /**< GNUC weak function keyword. */
elijahsj 1:8a094db1347f 99 #elif defined ( __CC_ARM)
elijahsj 1:8a094db1347f 100 #define inline __inline /**< inline keyword for Keil compiler. */
elijahsj 1:8a094db1347f 101 #pragma anon_unions
elijahsj 1:8a094db1347f 102 #endif
elijahsj 1:8a094db1347f 103 /**@}*/
elijahsj 1:8a094db1347f 104 /**
elijahsj 1:8a094db1347f 105 * @ingroup product_name
elijahsj 1:8a094db1347f 106 * @defgroup nvic_table Nested Interrupt Vector Table (NVIC)
elijahsj 1:8a094db1347f 107 * Device specific interrupt request NVIC entries.
elijahsj 1:8a094db1347f 108 * @{
elijahsj 1:8a094db1347f 109 */
elijahsj 1:8a094db1347f 110 /**
elijahsj 1:8a094db1347f 111 * \MXIM_Device Nested Interrupt Vector Table (NVIC).
elijahsj 1:8a094db1347f 112 * @details
elijahsj 1:8a094db1347f 113 * NVIC Peripheral Entry numbers and Offsets are shown in the table below.
elijahsj 1:8a094db1347f 114 *
elijahsj 1:8a094db1347f 115 * | Entry | Offset | Peripheral |
elijahsj 1:8a094db1347f 116 * |-------: | ------: | :------------------------------------ |
elijahsj 1:8a094db1347f 117 * | 0x10 | 0x0040 | CLKMAN |
elijahsj 1:8a094db1347f 118 * | 0x11 | 0x0044 | PWRMAN |
elijahsj 1:8a094db1347f 119 * | 0x12 | 0x0048 | Flash Controller |
elijahsj 1:8a094db1347f 120 * | 0x13 | 0x004C | RTC Counter match with Compare 0 |
elijahsj 1:8a094db1347f 121 * | 0x14 | 0x0050 | RTC Counter match with Compare 1 |
elijahsj 1:8a094db1347f 122 * | 0x15 | 0x0054 | RTC Prescaler interval compare match |
elijahsj 1:8a094db1347f 123 * | 0x16 | 0x0058 | RTC Overflow |
elijahsj 1:8a094db1347f 124 * | 0x17 | 0x005C | Peripheral Management Unit (PMU/DMA) |
elijahsj 1:8a094db1347f 125 * | 0x18 | 0x0060 | USB |
elijahsj 1:8a094db1347f 126 * | 0x19 | 0x0064 | AES |
elijahsj 1:8a094db1347f 127 * | 0x1A | 0x0068 | MAA |
elijahsj 1:8a094db1347f 128 * | 0x1B | 0x006C | Watchdog 0 timeout |
elijahsj 1:8a094db1347f 129 * | 0x1C | 0x0070 | Watchdog 0 pre-window (fed too early)|
elijahsj 1:8a094db1347f 130 * | 0x1D | 0x0074 | Watchdog 1 timeout |
elijahsj 1:8a094db1347f 131 * | 0x1E | 0x0078 | Watchdog 1 pre-window (fed too early)|
elijahsj 1:8a094db1347f 132 * | 0x1F | 0x007C | GPIO Port 0 |
elijahsj 1:8a094db1347f 133 * | 0x20 | 0x0080 | GPIO Port 1 |
elijahsj 1:8a094db1347f 134 * | 0x21 | 0x0084 | GPIO Port 2 |
elijahsj 1:8a094db1347f 135 * | 0x22 | 0x0088 | GPIO Port 3 |
elijahsj 1:8a094db1347f 136 * | 0x23 | 0x008C | GPIO Port 4 |
elijahsj 1:8a094db1347f 137 * | 0x24 | 0x0090 | GPIO Port 5 |
elijahsj 1:8a094db1347f 138 * | 0x25 | 0x0094 | GPIO Port 6 |
elijahsj 1:8a094db1347f 139 * | 0x26 | 0x0098 | Timer 0 (32-bit, 16-bit #0) |
elijahsj 1:8a094db1347f 140 * | 0x27 | 0x009C | Timer 0 (16-bit #1) |
elijahsj 1:8a094db1347f 141 * | 0x28 | 0x00A0 | Timer 1 (32-bit, 16-bit #0) |
elijahsj 1:8a094db1347f 142 * | 0x29 | 0x00A4 | Timer 1 (16-bit #1) |
elijahsj 1:8a094db1347f 143 * | 0x2A | 0x00A8 | Timer 2 (32-bit, 16-bit #0) |
elijahsj 1:8a094db1347f 144 * | 0x2B | 0x00AC | Timer 2 (16-bit #1) |
elijahsj 1:8a094db1347f 145 * | 0x2C | 0x00B0 | Timer 3 (32-bit, 16-bit #0) |
elijahsj 1:8a094db1347f 146 * | 0x2D | 0x00B4 | Timer 3 (16-bit #1) |
elijahsj 1:8a094db1347f 147 * | 0x2E | 0x00B8 | Timer 4 (32-bit, 16-bit #0) |
elijahsj 1:8a094db1347f 148 * | 0x2F | 0x00BC | Timer 4 (16-bit #1) |
elijahsj 1:8a094db1347f 149 * | 0x30 | 0x00C0 | Timer 5 (32-bit, 16-bit #0) |
elijahsj 1:8a094db1347f 150 * | 0x31 | 0x00C4 | Timer 5 (16-bit #1) |
elijahsj 1:8a094db1347f 151 * | 0x32 | 0x00C8 | UART 0 |
elijahsj 1:8a094db1347f 152 * | 0x33 | 0x00CC | UART 1 |
elijahsj 1:8a094db1347f 153 * | 0x34 | 0x00D0 | UART 2 |
elijahsj 1:8a094db1347f 154 * | 0x35 | 0x00D4 | UART 3 |
elijahsj 1:8a094db1347f 155 * | 0x36 | 0x00D8 | Pulse Trains |
elijahsj 1:8a094db1347f 156 * | 0x37 | 0x00DC | I2C Master 0 |
elijahsj 1:8a094db1347f 157 * | 0x38 | 0x00E0 | I2C Master 1 |
elijahsj 1:8a094db1347f 158 * | 0x39 | 0x00E4 | I2C Master 2 |
elijahsj 1:8a094db1347f 159 * | 0x3A | 0x00E8 | I2C Slave |
elijahsj 1:8a094db1347f 160 * | 0x3B | 0x00EC | SPI Master 0 |
elijahsj 1:8a094db1347f 161 * | 0x3C | 0x00F0 | SPI Master 1 |
elijahsj 1:8a094db1347f 162 * | 0x3D | 0x00F4 | SPI Master 2 |
elijahsj 1:8a094db1347f 163 * | 0x3E | 0x00F8 | SPI Bridge |
elijahsj 1:8a094db1347f 164 * | 0x3F | 0x00FC | 1-Wire Master |
elijahsj 1:8a094db1347f 165 * | 0x40 | 0x0100 | ADC |
elijahsj 1:8a094db1347f 166 * | 0x41 | 0x0104 | SPI Slave |
elijahsj 1:8a094db1347f 167 * | 0x42 | 0x0108 | GPIO Port 7 |
elijahsj 1:8a094db1347f 168 * | 0x43 | 0x010C | GPIO Port 8 |
elijahsj 1:8a094db1347f 169 */
elijahsj 1:8a094db1347f 170
elijahsj 1:8a094db1347f 171 /**
elijahsj 1:8a094db1347f 172 * Enumeration type of all \MXIM_Device NVIC entries.
elijahsj 1:8a094db1347f 173 */
elijahsj 1:8a094db1347f 174 typedef enum {
elijahsj 1:8a094db1347f 175 NonMaskableInt_IRQn = -14, /**< ARM Core : Non-maskable IRQ */
elijahsj 1:8a094db1347f 176 HardFault_IRQn = -13, /**< ARM Core : Hard Fault IRQ */
elijahsj 1:8a094db1347f 177 MemoryManagement_IRQn = -12, /**< ARM Core : Memory Management IRQ */
elijahsj 1:8a094db1347f 178 BusFault_IRQn = -11, /**< ARM Core : Bus Fault IRQ */
elijahsj 1:8a094db1347f 179 UsageFault_IRQn = -10, /**< ARM Core : Usage Fault IRQ */
elijahsj 1:8a094db1347f 180 SVCall_IRQn = -5, /**< ARM Core : SVCall IRQ */
elijahsj 1:8a094db1347f 181 DebugMonitor_IRQn = -4, /**< ARM Core : Debug Monitor IRQ */
elijahsj 1:8a094db1347f 182 PendSV_IRQn = -2, /**< ARM Core : PendSV IRQ */
elijahsj 1:8a094db1347f 183 SysTick_IRQn = -1, /**< ARM Core : SysTick IRQ */
elijahsj 1:8a094db1347f 184 CLKMAN_IRQn = 0, /**< CLKMAN */
elijahsj 1:8a094db1347f 185 PWRMAN_IRQn, /**< PWRMAN */
elijahsj 1:8a094db1347f 186 FLC_IRQn, /**< Flash Controller */
elijahsj 1:8a094db1347f 187 RTC0_IRQn, /**< RTC Counter match with Compare 0 */
elijahsj 1:8a094db1347f 188 RTC1_IRQn, /**< RTC Counter match with Compare 1 */
elijahsj 1:8a094db1347f 189 RTC2_IRQn, /**< RTC Prescaler interval compare match */
elijahsj 1:8a094db1347f 190 RTC3_IRQn, /**< RTC Overflow */
elijahsj 1:8a094db1347f 191 PMU_IRQn, /**< Peripheral Management Unit (PMU/DMA) */
elijahsj 1:8a094db1347f 192 USB_IRQn, /**< USB */
elijahsj 1:8a094db1347f 193 AES_IRQn, /**< AES */
elijahsj 1:8a094db1347f 194 MAA_IRQn, /**< MAA */
elijahsj 1:8a094db1347f 195 WDT0_IRQn, /**< Watchdog 0 timeout */
elijahsj 1:8a094db1347f 196 WDT0_P_IRQn, /**< Watchdog 0 pre-window (fed too early) */
elijahsj 1:8a094db1347f 197 WDT1_IRQn, /**< Watchdog 1 timeout */
elijahsj 1:8a094db1347f 198 WDT1_P_IRQn, /**< Watchdog 1 pre-window (fed too early) */
elijahsj 1:8a094db1347f 199 GPIO_P0_IRQn, /**< GPIO Port 0 */
elijahsj 1:8a094db1347f 200 GPIO_P1_IRQn, /**< GPIO Port 1 */
elijahsj 1:8a094db1347f 201 GPIO_P2_IRQn, /**< GPIO Port 2 */
elijahsj 1:8a094db1347f 202 GPIO_P3_IRQn, /**< GPIO Port 3 */
elijahsj 1:8a094db1347f 203 GPIO_P4_IRQn, /**< GPIO Port 4 */
elijahsj 1:8a094db1347f 204 GPIO_P5_IRQn, /**< GPIO Port 5 */
elijahsj 1:8a094db1347f 205 GPIO_P6_IRQn, /**< GPIO Port 6 */
elijahsj 1:8a094db1347f 206 TMR0_0_IRQn, /**< Timer 0 (32-bit, 16-bit #0) */
elijahsj 1:8a094db1347f 207 TMR0_1_IRQn, /**< Timer 0 (16-bit #1) */
elijahsj 1:8a094db1347f 208 TMR1_0_IRQn, /**< Timer 1 (32-bit, 16-bit #0) */
elijahsj 1:8a094db1347f 209 TMR1_1_IRQn, /**< Timer 1 (16-bit #1) */
elijahsj 1:8a094db1347f 210 TMR2_0_IRQn, /**< Timer 2 (32-bit, 16-bit #0) */
elijahsj 1:8a094db1347f 211 TMR2_1_IRQn, /**< Timer 2 (16-bit #1) */
elijahsj 1:8a094db1347f 212 TMR3_0_IRQn, /**< Timer 3 (32-bit, 16-bit #0) */
elijahsj 1:8a094db1347f 213 TMR3_1_IRQn, /**< Timer 3 (16-bit #1) */
elijahsj 1:8a094db1347f 214 TMR4_0_IRQn, /**< Timer 4 (32-bit, 16-bit #0) */
elijahsj 1:8a094db1347f 215 TMR4_1_IRQn, /**< Timer 4 (16-bit #1) */
elijahsj 1:8a094db1347f 216 TMR5_0_IRQn, /**< Timer 5 (32-bit, 16-bit #0) */
elijahsj 1:8a094db1347f 217 TMR5_1_IRQn, /**< Timer 5 (16-bit #1) */
elijahsj 1:8a094db1347f 218 UART0_IRQn, /**< UART 0 */
elijahsj 1:8a094db1347f 219 UART1_IRQn, /**< UART 1 */
elijahsj 1:8a094db1347f 220 UART2_IRQn, /**< UART 2 */
elijahsj 1:8a094db1347f 221 UART3_IRQn, /**< UART 3 */
elijahsj 1:8a094db1347f 222 PT_IRQn, /**< Pulse Trains */
elijahsj 1:8a094db1347f 223 I2CM0_IRQn, /**< I2C Master 0 */
elijahsj 1:8a094db1347f 224 I2CM1_IRQn, /**< I2C Master 1 */
elijahsj 1:8a094db1347f 225 I2CM2_IRQn, /**< I2C Master 2 */
elijahsj 1:8a094db1347f 226 I2CS_IRQn, /**< I2C Slave */
elijahsj 1:8a094db1347f 227 SPIM0_IRQn, /**< SPI Master 0 */
elijahsj 1:8a094db1347f 228 SPIM1_IRQn, /**< SPI Master 1 */
elijahsj 1:8a094db1347f 229 SPIM2_IRQn, /**< SPI Master 2 */
elijahsj 1:8a094db1347f 230 SPIB_IRQn, /**< SPI Bridge */
elijahsj 1:8a094db1347f 231 OWM_IRQn, /**< 1-Wire Master */
elijahsj 1:8a094db1347f 232 AFE_IRQn, /**< ADC */
elijahsj 1:8a094db1347f 233 SPIS_IRQn, /**< SPI Slave */
elijahsj 1:8a094db1347f 234 GPIO_P7_IRQn, /**< GPIO Port 7 */
elijahsj 1:8a094db1347f 235 GPIO_P8_IRQn, /**< GPIO Port 8 */
elijahsj 1:8a094db1347f 236 MXC_IRQ_EXT_COUNT /**< Total number of non-core IRQ vectors. */
elijahsj 1:8a094db1347f 237 } IRQn_Type;
elijahsj 1:8a094db1347f 238
elijahsj 1:8a094db1347f 239 #define MXC_IRQ_COUNT (MXC_IRQ_EXT_COUNT + 16) /**< Total number of device IRQs inclusive of core and non-core IRQ vectors. */
elijahsj 1:8a094db1347f 240 /**@}end of group nvic_table*/
elijahsj 1:8a094db1347f 241
elijahsj 1:8a094db1347f 242 /* ================================================================================ */
elijahsj 1:8a094db1347f 243 /* ================ Processor and Core Peripheral Section ================ */
elijahsj 1:8a094db1347f 244 /* ================================================================================ */
elijahsj 1:8a094db1347f 245 /**
elijahsj 1:8a094db1347f 246 * @ingroup product_name
elijahsj 1:8a094db1347f 247 * @defgroup Cortex_M4 Cortex-M Configuration
elijahsj 1:8a094db1347f 248 * @{
elijahsj 1:8a094db1347f 249 */
elijahsj 1:8a094db1347f 250 /* ---------------------- Configuration of the Cortex-M Processor and Core Peripherals ---------------------- */
elijahsj 1:8a094db1347f 251 #define __CM4_REV 0x0100 /**< Cortex-M4 Core Revision */
elijahsj 1:8a094db1347f 252 #define __MPU_PRESENT 1 /**< MPU is present */
elijahsj 1:8a094db1347f 253 #define __NVIC_PRIO_BITS 3 /**< Number of Bits used for IRQ Priority Levels */
elijahsj 1:8a094db1347f 254 #define __Vendor_SysTickConfig 0 /**< Using standard CMSIS SysTickConfig */
elijahsj 1:8a094db1347f 255 #define __FPU_PRESENT 1 /**< FPU is Present */
elijahsj 1:8a094db1347f 256 /**@} end of ingroup Cortex_M4*/
elijahsj 1:8a094db1347f 257 #include <core_cm4.h> /*!< Cortex-M4 processor and core peripherals */
elijahsj 1:8a094db1347f 258 #include "system_max3263x.h" /*!< System Header */
elijahsj 1:8a094db1347f 259
elijahsj 1:8a094db1347f 260
elijahsj 1:8a094db1347f 261 /* ================================================================================ */
elijahsj 1:8a094db1347f 262 /* ================== Device Specific Memory Section ================== */
elijahsj 1:8a094db1347f 263 /* ================================================================================ */
elijahsj 1:8a094db1347f 264 /**
elijahsj 1:8a094db1347f 265 * @ingroup product_name
elijahsj 1:8a094db1347f 266 * @{
elijahsj 1:8a094db1347f 267 */
elijahsj 1:8a094db1347f 268 #define MXC_FLASH_MEM_BASE 0x00000000UL /**< Internal Flash Memory Start Address. */
elijahsj 1:8a094db1347f 269 #define MXC_FLASH_PAGE_SIZE 0x00002000UL /**< Internal Flash Memory Page Size. */
elijahsj 1:8a094db1347f 270 #define MXC_FLASH_FULL_MEM_SIZE 0x00200000UL /**< Internal Flash Memory Size. */
elijahsj 1:8a094db1347f 271 #define MXC_SYS_MEM_BASE 0x20000000UL /**< System Memory Start Address. */
elijahsj 1:8a094db1347f 272 #define MXC_SRAM_FULL_MEM_SIZE 0x00080000UL /**< Internal SRAM Size. */
elijahsj 1:8a094db1347f 273 #define MXC_EXT_FLASH_MEM_BASE 0x10000000UL /**< External Flash Memory Start Address, SPIX interface. */
elijahsj 1:8a094db1347f 274
elijahsj 1:8a094db1347f 275 /* ================================================================================ */
elijahsj 1:8a094db1347f 276 /* ================ Device Specific Peripheral Section ================ */
elijahsj 1:8a094db1347f 277 /* ================================================================================ */
elijahsj 1:8a094db1347f 278
elijahsj 1:8a094db1347f 279
elijahsj 1:8a094db1347f 280 /*
elijahsj 1:8a094db1347f 281 Base addresses and configuration settings for all MAX3263X peripheral modules.
elijahsj 1:8a094db1347f 282 */
elijahsj 1:8a094db1347f 283
elijahsj 1:8a094db1347f 284
elijahsj 1:8a094db1347f 285 /* *************************************************************************** */
elijahsj 1:8a094db1347f 286 /* System Manager Settings */
elijahsj 1:8a094db1347f 287
elijahsj 1:8a094db1347f 288 #define MXC_BASE_SYSMAN ((uint32_t)0x40000000UL)
elijahsj 1:8a094db1347f 289 #define MXC_SYSMAN ((mxc_sysman_regs_t *)MXC_BASE_SYSMAN)
elijahsj 1:8a094db1347f 290
elijahsj 1:8a094db1347f 291
elijahsj 1:8a094db1347f 292
elijahsj 1:8a094db1347f 293 /* *************************************************************************** */
elijahsj 1:8a094db1347f 294 /* System Clock Manager */
elijahsj 1:8a094db1347f 295
elijahsj 1:8a094db1347f 296 #define MXC_BASE_CLKMAN ((uint32_t)0x40000400UL)
elijahsj 1:8a094db1347f 297 #define MXC_CLKMAN ((mxc_clkman_regs_t *)MXC_BASE_CLKMAN)
elijahsj 1:8a094db1347f 298
elijahsj 1:8a094db1347f 299
elijahsj 1:8a094db1347f 300
elijahsj 1:8a094db1347f 301 /* *************************************************************************** */
elijahsj 1:8a094db1347f 302 /* System Power Manager */
elijahsj 1:8a094db1347f 303
elijahsj 1:8a094db1347f 304 #define MXC_BASE_PWRMAN ((uint32_t)0x40000800UL)
elijahsj 1:8a094db1347f 305 #define MXC_PWRMAN ((mxc_pwrman_regs_t *)MXC_BASE_PWRMAN)
elijahsj 1:8a094db1347f 306
elijahsj 1:8a094db1347f 307
elijahsj 1:8a094db1347f 308
elijahsj 1:8a094db1347f 309 /* *************************************************************************** */
elijahsj 1:8a094db1347f 310 /* Real Time Clock */
elijahsj 1:8a094db1347f 311
elijahsj 1:8a094db1347f 312 #define MXC_BASE_RTCTMR ((uint32_t)0x40000A00UL)
elijahsj 1:8a094db1347f 313 #define MXC_RTCTMR ((mxc_rtctmr_regs_t *)MXC_BASE_RTCTMR)
elijahsj 1:8a094db1347f 314 #define MXC_BASE_RTCCFG ((uint32_t)0x40000A70UL)
elijahsj 1:8a094db1347f 315 #define MXC_RTCCFG ((mxc_rtccfg_regs_t *)MXC_BASE_RTCCFG)
elijahsj 1:8a094db1347f 316
elijahsj 1:8a094db1347f 317 #define MXC_RTCTMR_GET_IRQ(i) (IRQn_Type)(i == 0 ? RTC0_IRQn : \
elijahsj 1:8a094db1347f 318 i == 1 ? RTC1_IRQn : \
elijahsj 1:8a094db1347f 319 i == 2 ? RTC2_IRQn : \
elijahsj 1:8a094db1347f 320 i == 3 ? RTC3_IRQn : 0)
elijahsj 1:8a094db1347f 321
elijahsj 1:8a094db1347f 322
elijahsj 1:8a094db1347f 323
elijahsj 1:8a094db1347f 324 /* *************************************************************************** */
elijahsj 1:8a094db1347f 325 /* Power Sequencer */
elijahsj 1:8a094db1347f 326
elijahsj 1:8a094db1347f 327 #define MXC_BASE_PWRSEQ ((uint32_t)0x40000A30UL)
elijahsj 1:8a094db1347f 328 #define MXC_PWRSEQ ((mxc_pwrseq_regs_t *)MXC_BASE_PWRSEQ)
elijahsj 1:8a094db1347f 329
elijahsj 1:8a094db1347f 330
elijahsj 1:8a094db1347f 331
elijahsj 1:8a094db1347f 332 /* *************************************************************************** */
elijahsj 1:8a094db1347f 333 /* System I/O Manager */
elijahsj 1:8a094db1347f 334 /**@} end of ingroup product_name*/
elijahsj 1:8a094db1347f 335 /**
elijahsj 1:8a094db1347f 336 * @ingroup ioman_registers
elijahsj 1:8a094db1347f 337 * @{
elijahsj 1:8a094db1347f 338 */
elijahsj 1:8a094db1347f 339 #define MXC_BASE_IOMAN ((uint32_t)0x40000C00UL) /**< Base Peripheral Address for IOMAN */
elijahsj 1:8a094db1347f 340 #define MXC_IOMAN ((mxc_ioman_regs_t *)MXC_BASE_IOMAN) /**< Pointer to the #mxc_ioman_regs_t structure representing the IOMAN Registers. */
elijahsj 1:8a094db1347f 341 /**@}*/
elijahsj 1:8a094db1347f 342
elijahsj 1:8a094db1347f 343 /**
elijahsj 1:8a094db1347f 344 * @ingroup product_name
elijahsj 1:8a094db1347f 345 * @{
elijahsj 1:8a094db1347f 346 */
elijahsj 1:8a094db1347f 347 /* *************************************************************************** */
elijahsj 1:8a094db1347f 348 /* Shadow Trim Registers */
elijahsj 1:8a094db1347f 349
elijahsj 1:8a094db1347f 350 #define MXC_BASE_TRIM ((uint32_t)0x40001000UL)
elijahsj 1:8a094db1347f 351 #define MXC_TRIM ((mxc_trim_regs_t *)MXC_BASE_TRIM)
elijahsj 1:8a094db1347f 352
elijahsj 1:8a094db1347f 353
elijahsj 1:8a094db1347f 354
elijahsj 1:8a094db1347f 355 /* *************************************************************************** */
elijahsj 1:8a094db1347f 356 /* Flash Controller */
elijahsj 1:8a094db1347f 357
elijahsj 1:8a094db1347f 358 #define MXC_BASE_FLC ((uint32_t)0x40002000UL)
elijahsj 1:8a094db1347f 359 #define MXC_FLC ((mxc_flc_regs_t *)MXC_BASE_FLC)
elijahsj 1:8a094db1347f 360
elijahsj 1:8a094db1347f 361 #define MXC_FLC_PAGE_SIZE_SHIFT (13)
elijahsj 1:8a094db1347f 362 #define MXC_FLC_PAGE_SIZE (1 << MXC_FLC_PAGE_SIZE_SHIFT)
elijahsj 1:8a094db1347f 363 #define MXC_FLC_PAGE_ERASE_MSK ((~(1 << (MXC_FLC_PAGE_SIZE_SHIFT - 1))) >> MXC_FLC_PAGE_SIZE_SHIFT) << MXC_FLC_PAGE_SIZE_SHIFT
elijahsj 1:8a094db1347f 364
elijahsj 1:8a094db1347f 365
elijahsj 1:8a094db1347f 366
elijahsj 1:8a094db1347f 367 /* *************************************************************************** */
elijahsj 1:8a094db1347f 368 /* Instruction Cache */
elijahsj 1:8a094db1347f 369
elijahsj 1:8a094db1347f 370 #define MXC_BASE_ICC ((uint32_t)0x40003000UL)
elijahsj 1:8a094db1347f 371 #define MXC_ICC ((mxc_icc_regs_t *)MXC_BASE_ICC)
elijahsj 1:8a094db1347f 372
elijahsj 1:8a094db1347f 373
elijahsj 1:8a094db1347f 374 /**@} end of ingroup product_name*/
elijahsj 1:8a094db1347f 375 /* *************************************************************************** */
elijahsj 1:8a094db1347f 376 /* SPI XIP Interface */
elijahsj 1:8a094db1347f 377 /**
elijahsj 1:8a094db1347f 378 * @ingroup spix_registers
elijahsj 1:8a094db1347f 379 * @{
elijahsj 1:8a094db1347f 380 */
elijahsj 1:8a094db1347f 381 #define MXC_BASE_SPIX ((uint32_t)0x40004000UL) /**< SPIX Base Peripheral Address. */
elijahsj 1:8a094db1347f 382 #define MXC_SPIX ((mxc_spix_regs_t *)MXC_BASE_SPIX) /**< SPIX pointer to the #mxc_spix_regs_t register structure type. */
elijahsj 1:8a094db1347f 383 /**@} end of ingroup spix_registers*/
elijahsj 1:8a094db1347f 384
elijahsj 1:8a094db1347f 385 /**
elijahsj 1:8a094db1347f 386 * @ingroup product_name
elijahsj 1:8a094db1347f 387 * @{
elijahsj 1:8a094db1347f 388 */
elijahsj 1:8a094db1347f 389 /* *************************************************************************** */
elijahsj 1:8a094db1347f 390 /* Peripheral Management Unit */
elijahsj 1:8a094db1347f 391
elijahsj 1:8a094db1347f 392 #define MXC_CFG_PMU_CHANNELS (6)
elijahsj 1:8a094db1347f 393
elijahsj 1:8a094db1347f 394 #define MXC_BASE_PMU0 ((uint32_t)0x40005000UL)
elijahsj 1:8a094db1347f 395 #define MXC_PMU0 ((mxc_pmu_regs_t *)MXC_BASE_PMU0)
elijahsj 1:8a094db1347f 396 #define MXC_BASE_PMU1 ((uint32_t)0x40005020UL)
elijahsj 1:8a094db1347f 397 #define MXC_PMU1 ((mxc_pmu_regs_t *)MXC_BASE_PMU1)
elijahsj 1:8a094db1347f 398 #define MXC_BASE_PMU2 ((uint32_t)0x40005040UL)
elijahsj 1:8a094db1347f 399 #define MXC_PMU2 ((mxc_pmu_regs_t *)MXC_BASE_PMU2)
elijahsj 1:8a094db1347f 400 #define MXC_BASE_PMU3 ((uint32_t)0x40005060UL)
elijahsj 1:8a094db1347f 401 #define MXC_PMU3 ((mxc_pmu_regs_t *)MXC_BASE_PMU3)
elijahsj 1:8a094db1347f 402 #define MXC_BASE_PMU4 ((uint32_t)0x40005080UL)
elijahsj 1:8a094db1347f 403 #define MXC_PMU4 ((mxc_pmu_regs_t *)MXC_BASE_PMU4)
elijahsj 1:8a094db1347f 404 #define MXC_BASE_PMU5 ((uint32_t)0x400050A0UL)
elijahsj 1:8a094db1347f 405 #define MXC_PMU5 ((mxc_pmu_regs_t *)MXC_BASE_PMU5)
elijahsj 1:8a094db1347f 406
elijahsj 1:8a094db1347f 407 #define MXC_PMU_GET_BASE(i) ((i) == 0 ? MXC_BASE_PMU0 : \
elijahsj 1:8a094db1347f 408 (i) == 1 ? MXC_BASE_PMU1 : \
elijahsj 1:8a094db1347f 409 (i) == 2 ? MXC_BASE_PMU2 : \
elijahsj 1:8a094db1347f 410 (i) == 3 ? MXC_BASE_PMU3 : \
elijahsj 1:8a094db1347f 411 (i) == 4 ? MXC_BASE_PMU4 : \
elijahsj 1:8a094db1347f 412 (i) == 5 ? MXC_BASE_PMU5 : 0)
elijahsj 1:8a094db1347f 413
elijahsj 1:8a094db1347f 414 #define MXC_PMU_GET_PMU(i) ((i) == 0 ? MXC_PMU0 : \
elijahsj 1:8a094db1347f 415 (i) == 1 ? MXC_PMU1 : \
elijahsj 1:8a094db1347f 416 (i) == 2 ? MXC_PMU2 : \
elijahsj 1:8a094db1347f 417 (i) == 3 ? MXC_PMU3 : \
elijahsj 1:8a094db1347f 418 (i) == 4 ? MXC_PMU4 : \
elijahsj 1:8a094db1347f 419 (i) == 5 ? MXC_PMU5 : 0)
elijahsj 1:8a094db1347f 420
elijahsj 1:8a094db1347f 421 #define MXC_PMU_GET_IDX(p) ((p) == MXC_PMU0 ? 0 : \
elijahsj 1:8a094db1347f 422 (p) == MXC_PMU1 ? 1 : \
elijahsj 1:8a094db1347f 423 (p) == MXC_PMU2 ? 2 : \
elijahsj 1:8a094db1347f 424 (p) == MXC_PMU3 ? 3 : \
elijahsj 1:8a094db1347f 425 (p) == MXC_PMU4 ? 4 : \
elijahsj 1:8a094db1347f 426 (p) == MXC_PMU5 ? 5 : -1)
elijahsj 1:8a094db1347f 427
elijahsj 1:8a094db1347f 428 /* *************************************************************************** */
elijahsj 1:8a094db1347f 429 /* USB Device Controller */
elijahsj 1:8a094db1347f 430
elijahsj 1:8a094db1347f 431 #define MXC_BASE_USB ((uint32_t)0x40100000UL)
elijahsj 1:8a094db1347f 432 #define MXC_USB ((mxc_usb_regs_t *)MXC_BASE_USB)
elijahsj 1:8a094db1347f 433
elijahsj 1:8a094db1347f 434 #define MXC_USB_MAX_PACKET (64)
elijahsj 1:8a094db1347f 435 #define MXC_USB_NUM_EP (8)
elijahsj 1:8a094db1347f 436
elijahsj 1:8a094db1347f 437
elijahsj 1:8a094db1347f 438
elijahsj 1:8a094db1347f 439 /* *************************************************************************** */
elijahsj 1:8a094db1347f 440 /* CRC-16/CRC-32 Engine */
elijahsj 1:8a094db1347f 441
elijahsj 1:8a094db1347f 442 #define MXC_BASE_CRC ((uint32_t)0x40006000UL)
elijahsj 1:8a094db1347f 443 #define MXC_CRC ((mxc_crc_regs_t *)MXC_BASE_CRC)
elijahsj 1:8a094db1347f 444 #define MXC_BASE_CRC_DATA ((uint32_t)0x40101000UL)
elijahsj 1:8a094db1347f 445 #define MXC_CRC_DATA ((mxc_crc_data_regs_t *)MXC_BASE_CRC_DATA)
elijahsj 1:8a094db1347f 446
elijahsj 1:8a094db1347f 447 /* *************************************************************************** */
elijahsj 1:8a094db1347f 448 /* Pseudo-random number generator (PRNG) */
elijahsj 1:8a094db1347f 449
elijahsj 1:8a094db1347f 450 #define MXC_BASE_PRNG ((uint32_t)0x40007000UL)
elijahsj 1:8a094db1347f 451 #define MXC_PRNG ((mxc_prng_regs_t *)MXC_BASE_PRNG)
elijahsj 1:8a094db1347f 452
elijahsj 1:8a094db1347f 453 /* *************************************************************************** */
elijahsj 1:8a094db1347f 454 /* AES Cryptographic Engine */
elijahsj 1:8a094db1347f 455
elijahsj 1:8a094db1347f 456 #define MXC_BASE_AES ((uint32_t)0x40007400UL)
elijahsj 1:8a094db1347f 457 #define MXC_AES ((mxc_aes_regs_t *)MXC_BASE_AES)
elijahsj 1:8a094db1347f 458 #define MXC_BASE_AES_MEM ((uint32_t)0x40102000UL)
elijahsj 1:8a094db1347f 459 #define MXC_AES_MEM ((mxc_aes_mem_regs_t *)MXC_BASE_AES_MEM)
elijahsj 1:8a094db1347f 460
elijahsj 1:8a094db1347f 461 /* *************************************************************************** */
elijahsj 1:8a094db1347f 462 /* MAA Cryptographic Engine */
elijahsj 1:8a094db1347f 463
elijahsj 1:8a094db1347f 464 #define MXC_BASE_MAA ((uint32_t)0x40007800UL)
elijahsj 1:8a094db1347f 465 #define MXC_MAA ((mxc_maa_regs_t *)MXC_BASE_MAA)
elijahsj 1:8a094db1347f 466 #define MXC_BASE_MAA_MEM ((uint32_t)0x40102800UL)
elijahsj 1:8a094db1347f 467 #define MXC_MAA_MEM ((mxc_maa_mem_regs_t *)MXC_BASE_MAA_MEM)
elijahsj 1:8a094db1347f 468
elijahsj 1:8a094db1347f 469 /* *************************************************************************** */
elijahsj 1:8a094db1347f 470 /* Trust Protection Unit (TPU) */
elijahsj 1:8a094db1347f 471
elijahsj 1:8a094db1347f 472 #define MXC_BASE_TPU ((uint32_t)0x40007000UL)
elijahsj 1:8a094db1347f 473 #define MXC_TPU ((mxc_tpu_regs_t *)MXC_BASE_TPU)
elijahsj 1:8a094db1347f 474 #define MXC_BASE_TPU_TSR ((uint32_t)0x40007C00UL)
elijahsj 1:8a094db1347f 475 #define MXC_TPU_TSR ((mxc_tpu_tsr_regs_t *)MXC_BASE_TPU_TSR)
elijahsj 1:8a094db1347f 476 /**@} end of ingroup product_name*/
elijahsj 1:8a094db1347f 477 /* *************************************************************************** */
elijahsj 1:8a094db1347f 478 /* Watchdog Timers */
elijahsj 1:8a094db1347f 479 /**
elijahsj 1:8a094db1347f 480 * @ingroup wdt_registers
elijahsj 1:8a094db1347f 481 * @{
elijahsj 1:8a094db1347f 482 */
elijahsj 1:8a094db1347f 483 #define MXC_CFG_WDT_INSTANCES (2) /**< Define for the number of timers on the \MXIM_Device */
elijahsj 1:8a094db1347f 484
elijahsj 1:8a094db1347f 485 #define MXC_BASE_WDT0 ((uint32_t)0x40008000UL) /**< Base Peripheral Address for WDT 0 */
elijahsj 1:8a094db1347f 486 #define MXC_WDT0 ((mxc_wdt_regs_t *)MXC_BASE_WDT0) /**< Pointer to the #mxc_wdt_regs_t structure representing WDT0 Registers. */
elijahsj 1:8a094db1347f 487 #define MXC_BASE_WDT1 ((uint32_t)0x40009000UL) /**< Base Peripheral Address for WDT 1 */
elijahsj 1:8a094db1347f 488 #define MXC_WDT1 ((mxc_wdt_regs_t *)MXC_BASE_WDT1) /**< Pointer to the #mxc_wdt_regs_t structure representing WDT1 Registers. */
elijahsj 1:8a094db1347f 489 /**
elijahsj 1:8a094db1347f 490 * Macro that returns the WDT[i] IRQ, where i=0 to i < #MXC_CFG_WDT_INSTANCES.
elijahsj 1:8a094db1347f 491 */
elijahsj 1:8a094db1347f 492 #define MXC_WDT_GET_IRQ(i) (IRQn_Type)((i) == 0 ? WDT0_IRQn : \
elijahsj 1:8a094db1347f 493 (i) == 1 ? WDT1_IRQn : 0)
elijahsj 1:8a094db1347f 494
elijahsj 1:8a094db1347f 495 #define MXC_WDT_GET_IRQ_P(i) (IRQn_Type)((i) == 0 ? WDT0_P_IRQn : \
elijahsj 1:8a094db1347f 496 (i) == 1 ? WDT1_P_IRQn : 0)
elijahsj 1:8a094db1347f 497 /**
elijahsj 1:8a094db1347f 498 * Macro to return the base address for a requested Watchdog Timer index number.
elijahsj 1:8a094db1347f 499 * @p i WDT instance number.
elijahsj 1:8a094db1347f 500 * @p returns the base peripheral address for the requested Watchdog Timer instance.
elijahsj 1:8a094db1347f 501 */
elijahsj 1:8a094db1347f 502 #define MXC_WDT_GET_BASE(i) ((i) == 0 ? MXC_BASE_WDT0 : \
elijahsj 1:8a094db1347f 503 (i) == 1 ? MXC_BASE_WDT1 : 0)
elijahsj 1:8a094db1347f 504 /**
elijahsj 1:8a094db1347f 505 * Macro to return a pointer to the #mxc_tmr_regs_t object for the requested Watchdog Timer.
elijahsj 1:8a094db1347f 506 * @p i Watchdog Timer instance number.
elijahsj 1:8a094db1347f 507 * @p returns a pointer to a #mxc_wdt_regs_t for the requested WDT number.
elijahsj 1:8a094db1347f 508 */
elijahsj 1:8a094db1347f 509 #define MXC_WDT_GET_WDT(i) ((i) == 0 ? MXC_WDT0 : \
elijahsj 1:8a094db1347f 510 (i) == 1 ? MXC_WDT1 : 0)
elijahsj 1:8a094db1347f 511 /**
elijahsj 1:8a094db1347f 512 * Macro to return the index number for a given #mxc_wdt_regs_t structure.
elijahsj 1:8a094db1347f 513 * @p p pointer to a #mxc_wdt_regs_t structure.
elijahsj 1:8a094db1347f 514 * @p returns a watchdog timer instance number.
elijahsj 1:8a094db1347f 515 */
elijahsj 1:8a094db1347f 516 #define MXC_WDT_GET_IDX(i) ((i) == MXC_WDT0 ? 0: \
elijahsj 1:8a094db1347f 517 (i) == MXC_WDT1 ? 1: -1)
elijahsj 1:8a094db1347f 518
elijahsj 1:8a094db1347f 519 /**@} end of ingroup wdt_registers */
elijahsj 1:8a094db1347f 520 /* *************************************************************************** */
elijahsj 1:8a094db1347f 521 /* Always-On Watchdog Timer */
elijahsj 1:8a094db1347f 522 /**
elijahsj 1:8a094db1347f 523 * @ingroup wdt2_registers
elijahsj 1:8a094db1347f 524 * @{
elijahsj 1:8a094db1347f 525 */
elijahsj 1:8a094db1347f 526 #define MXC_BASE_WDT2 ((uint32_t)0x40007C60UL) /**< Base Peripheral Address for WDT 2 */
elijahsj 1:8a094db1347f 527 #define MXC_WDT2 ((mxc_wdt2_regs_t *)MXC_BASE_WDT2) /**< Pointer to the #mxc_wdt2_regs_t structure representing the WDT2 hardware registers. */
elijahsj 1:8a094db1347f 528 /**@} end of ingroup wdt2_registers */
elijahsj 1:8a094db1347f 529
elijahsj 1:8a094db1347f 530
elijahsj 1:8a094db1347f 531 /* *************************************************************************** */
elijahsj 1:8a094db1347f 532 /* General Purpose I/O Ports (GPIO) */
elijahsj 1:8a094db1347f 533 /**
elijahsj 1:8a094db1347f 534 * @ingroup gpio_registers
elijahsj 1:8a094db1347f 535 * @{
elijahsj 1:8a094db1347f 536 */
elijahsj 1:8a094db1347f 537 #define MXC_GPIO_NUM_PORTS (9) /**< Number of GPIO Ports for the \MXIM_Device. */
elijahsj 1:8a094db1347f 538 #define MXC_GPIO_MAX_PINS_PER_PORT (8) /**< Number of port pins per port for the \MXIM_Device */
elijahsj 1:8a094db1347f 539
elijahsj 1:8a094db1347f 540 #define MXC_BASE_GPIO ((uint32_t)0x4000A000UL) /**< GPIO Base Peripheral Offset */
elijahsj 1:8a094db1347f 541 #define MXC_GPIO ((mxc_gpio_regs_t *)MXC_BASE_GPIO) /**< Pointer to the #mxc_gpio_regs_t object representing GPIO Registers. */
elijahsj 1:8a094db1347f 542 /**
elijahsj 1:8a094db1347f 543 * Macro that returns the GPIO[i] IRQ, where i=0 to i < #MXC_GPIO_NUM_PORTS.
elijahsj 1:8a094db1347f 544 */
elijahsj 1:8a094db1347f 545 #define MXC_GPIO_GET_IRQ(i) (IRQn_Type)((i) == 0 ? GPIO_P0_IRQn : \
elijahsj 1:8a094db1347f 546 (i) == 1 ? GPIO_P1_IRQn : \
elijahsj 1:8a094db1347f 547 (i) == 2 ? GPIO_P2_IRQn : \
elijahsj 1:8a094db1347f 548 (i) == 3 ? GPIO_P3_IRQn : \
elijahsj 1:8a094db1347f 549 (i) == 4 ? GPIO_P4_IRQn : \
elijahsj 1:8a094db1347f 550 (i) == 5 ? GPIO_P5_IRQn : \
elijahsj 1:8a094db1347f 551 (i) == 6 ? GPIO_P6_IRQn : \
elijahsj 1:8a094db1347f 552 (i) == 7 ? GPIO_P7_IRQn : \
elijahsj 1:8a094db1347f 553 (i) == 8 ? GPIO_P8_IRQn : 0)
elijahsj 1:8a094db1347f 554
elijahsj 1:8a094db1347f 555 /**@} end of ingroup gpio_registers */
elijahsj 1:8a094db1347f 556
elijahsj 1:8a094db1347f 557 /* *************************************************************************** */
elijahsj 1:8a094db1347f 558 /* 16/32 bit Timer/Counters */
elijahsj 1:8a094db1347f 559 /**
elijahsj 1:8a094db1347f 560 * @ingroup tmr_registers
elijahsj 1:8a094db1347f 561 * @{
elijahsj 1:8a094db1347f 562 */
elijahsj 1:8a094db1347f 563 #define MXC_CFG_TMR_INSTANCES (6) /**< Define for the number of timers on the \MXIM_Device */
elijahsj 1:8a094db1347f 564 #define MXC_BASE_TMR0 ((uint32_t)0x4000B000UL) /**< Base Address for Timer 0 */
elijahsj 1:8a094db1347f 565 #define MXC_TMR0 ((mxc_tmr_regs_t *)MXC_BASE_TMR0) /**< Pointer to a #mxc_tmr_regs_t structure representing Timer 0 */
elijahsj 1:8a094db1347f 566 #define MXC_BASE_TMR1 ((uint32_t)0x4000C000UL) /**< Base Address for Timer 1 */
elijahsj 1:8a094db1347f 567 #define MXC_TMR1 ((mxc_tmr_regs_t *)MXC_BASE_TMR1) /**< Pointer to a #mxc_tmr_regs_t structure representing Timer 1 */
elijahsj 1:8a094db1347f 568 #define MXC_BASE_TMR2 ((uint32_t)0x4000D000UL) /**< Base Address for Timer 2 */
elijahsj 1:8a094db1347f 569 #define MXC_TMR2 ((mxc_tmr_regs_t *)MXC_BASE_TMR2) /**< Pointer to a #mxc_tmr_regs_t structure representing Timer 2 */
elijahsj 1:8a094db1347f 570 #define MXC_BASE_TMR3 ((uint32_t)0x4000E000UL) /**< Base Address for Timer 3 */
elijahsj 1:8a094db1347f 571 #define MXC_TMR3 ((mxc_tmr_regs_t *)MXC_BASE_TMR3) /**< Pointer to a #mxc_tmr_regs_t structure representing Timer 3 */
elijahsj 1:8a094db1347f 572 #define MXC_BASE_TMR4 ((uint32_t)0x4000F000UL) /**< Base Address for Timer 4 */
elijahsj 1:8a094db1347f 573 #define MXC_TMR4 ((mxc_tmr_regs_t *)MXC_BASE_TMR4) /**< Pointer to a #mxc_tmr_regs_t structure representing Timer 4 */
elijahsj 1:8a094db1347f 574 #define MXC_BASE_TMR5 ((uint32_t)0x40010000UL) /**< Base Address for Timer 5 */
elijahsj 1:8a094db1347f 575 #define MXC_TMR5 ((mxc_tmr_regs_t *)MXC_BASE_TMR5) /**< Pointer to a #mxc_tmr_regs_t structure representing Timer 5 */
elijahsj 1:8a094db1347f 576
elijahsj 1:8a094db1347f 577 /**
elijahsj 1:8a094db1347f 578 * Macro that returns an #IRQn_Type for the requested 32-bit timer interrupt.
elijahsj 1:8a094db1347f 579 */
elijahsj 1:8a094db1347f 580 #define MXC_TMR_GET_IRQ_32(i) (IRQn_Type)((i) == 0 ? TMR0_0_IRQn : \
elijahsj 1:8a094db1347f 581 (i) == 1 ? TMR1_0_IRQn : \
elijahsj 1:8a094db1347f 582 (i) == 2 ? TMR2_0_IRQn : \
elijahsj 1:8a094db1347f 583 (i) == 3 ? TMR3_0_IRQn : \
elijahsj 1:8a094db1347f 584 (i) == 4 ? TMR4_0_IRQn : \
elijahsj 1:8a094db1347f 585 (i) == 5 ? TMR5_0_IRQn : 0)
elijahsj 1:8a094db1347f 586 /**
elijahsj 1:8a094db1347f 587 * Macro that returns an IRQn_Type for the requested 16-bit timer interrupt number.
elijahsj 1:8a094db1347f 588 */
elijahsj 1:8a094db1347f 589 #define MXC_TMR_GET_IRQ_16(i) (IRQn_Type)((i) == 0 ? TMR0_0_IRQn : \
elijahsj 1:8a094db1347f 590 (i) == 1 ? TMR1_0_IRQn : \
elijahsj 1:8a094db1347f 591 (i) == 2 ? TMR2_0_IRQn : \
elijahsj 1:8a094db1347f 592 (i) == 3 ? TMR3_0_IRQn : \
elijahsj 1:8a094db1347f 593 (i) == 4 ? TMR4_0_IRQn : \
elijahsj 1:8a094db1347f 594 (i) == 5 ? TMR5_0_IRQn : \
elijahsj 1:8a094db1347f 595 (i) == 6 ? TMR0_1_IRQn : \
elijahsj 1:8a094db1347f 596 (i) == 7 ? TMR1_1_IRQn : \
elijahsj 1:8a094db1347f 597 (i) == 8 ? TMR2_1_IRQn : \
elijahsj 1:8a094db1347f 598 (i) == 9 ? TMR3_1_IRQn : \
elijahsj 1:8a094db1347f 599 (i) == 10 ? TMR4_1_IRQn : \
elijahsj 1:8a094db1347f 600 (i) == 11 ? TMR5_1_IRQn : 0)
elijahsj 1:8a094db1347f 601 /**
elijahsj 1:8a094db1347f 602 * Macro to return the base address for a given Timer index number.
elijahsj 1:8a094db1347f 603 * @p i Timer instance number.
elijahsj 1:8a094db1347f 604 * @p returns the base peripheral address for the requested timer instance.
elijahsj 1:8a094db1347f 605 */
elijahsj 1:8a094db1347f 606 #define MXC_TMR_GET_BASE(i) ((i) == 0 ? MXC_BASE_TMR0 : \
elijahsj 1:8a094db1347f 607 (i) == 1 ? MXC_BASE_TMR1 : \
elijahsj 1:8a094db1347f 608 (i) == 2 ? MXC_BASE_TMR2 : \
elijahsj 1:8a094db1347f 609 (i) == 3 ? MXC_BASE_TMR3 : \
elijahsj 1:8a094db1347f 610 (i) == 4 ? MXC_BASE_TMR4 : \
elijahsj 1:8a094db1347f 611 (i) == 5 ? MXC_BASE_TMR5 : 0)
elijahsj 1:8a094db1347f 612 /**
elijahsj 1:8a094db1347f 613 * Macro to return a pointer to the #mxc_tmr_regs_t structure for a given Timer Instance.
elijahsj 1:8a094db1347f 614 * @p i Timer instance number.
elijahsj 1:8a094db1347f 615 * @p returns a pointer to a #mxc_tmr_regs_t for the requested timer number.
elijahsj 1:8a094db1347f 616 */
elijahsj 1:8a094db1347f 617 #define MXC_TMR_GET_TMR(i) ((i) == 0 ? MXC_TMR0 : \
elijahsj 1:8a094db1347f 618 (i) == 1 ? MXC_TMR1 : \
elijahsj 1:8a094db1347f 619 (i) == 2 ? MXC_TMR2 : \
elijahsj 1:8a094db1347f 620 (i) == 3 ? MXC_TMR3 : \
elijahsj 1:8a094db1347f 621 (i) == 4 ? MXC_TMR4 : \
elijahsj 1:8a094db1347f 622 (i) == 5 ? MXC_TMR5 : 0)
elijahsj 1:8a094db1347f 623 /**
elijahsj 1:8a094db1347f 624 * Macro to return the index number for a given pointer to a #mxc_tmr_regs_t structure.
elijahsj 1:8a094db1347f 625 * @p p pointer to a #mxc_tmr_regs_t structure.
elijahsj 1:8a094db1347f 626 * @p returns a timer instance number.
elijahsj 1:8a094db1347f 627 */
elijahsj 1:8a094db1347f 628 #define MXC_TMR_GET_IDX(p) ((p) == MXC_TMR0 ? 0 : \
elijahsj 1:8a094db1347f 629 (p) == MXC_TMR1 ? 1 : \
elijahsj 1:8a094db1347f 630 (p) == MXC_TMR2 ? 2 : \
elijahsj 1:8a094db1347f 631 (p) == MXC_TMR3 ? 3 : \
elijahsj 1:8a094db1347f 632 (p) == MXC_TMR4 ? 4 : \
elijahsj 1:8a094db1347f 633 (p) == MXC_TMR5 ? 5 : -1)
elijahsj 1:8a094db1347f 634
elijahsj 1:8a094db1347f 635 /**@} end of ingroup tmr_registers */
elijahsj 1:8a094db1347f 636
elijahsj 1:8a094db1347f 637 /**
elijahsj 1:8a094db1347f 638 * @ingroup product_name
elijahsj 1:8a094db1347f 639 * @{
elijahsj 1:8a094db1347f 640 */
elijahsj 1:8a094db1347f 641 /* *************************************************************************** */
elijahsj 1:8a094db1347f 642 /* Pulse Train Generation */
elijahsj 1:8a094db1347f 643 #define MXC_CFG_PT_INSTANCES (16)
elijahsj 1:8a094db1347f 644
elijahsj 1:8a094db1347f 645 #define MXC_BASE_PTG ((uint32_t)0x40011000UL)
elijahsj 1:8a094db1347f 646 #define MXC_PTG ((mxc_ptg_regs_t *)MXC_BASE_PTG)
elijahsj 1:8a094db1347f 647 #define MXC_BASE_PT0 ((uint32_t)0x40011020UL)
elijahsj 1:8a094db1347f 648 #define MXC_PT0 ((mxc_pt_regs_t *)MXC_BASE_PT0)
elijahsj 1:8a094db1347f 649 #define MXC_BASE_PT1 ((uint32_t)0x40011040UL)
elijahsj 1:8a094db1347f 650 #define MXC_PT1 ((mxc_pt_regs_t *)MXC_BASE_PT1)
elijahsj 1:8a094db1347f 651 #define MXC_BASE_PT2 ((uint32_t)0x40011060UL)
elijahsj 1:8a094db1347f 652 #define MXC_PT2 ((mxc_pt_regs_t *)MXC_BASE_PT2)
elijahsj 1:8a094db1347f 653 #define MXC_BASE_PT3 ((uint32_t)0x40011080UL)
elijahsj 1:8a094db1347f 654 #define MXC_PT3 ((mxc_pt_regs_t *)MXC_BASE_PT3)
elijahsj 1:8a094db1347f 655 #define MXC_BASE_PT4 ((uint32_t)0x400110A0UL)
elijahsj 1:8a094db1347f 656 #define MXC_PT4 ((mxc_pt_regs_t *)MXC_BASE_PT4)
elijahsj 1:8a094db1347f 657 #define MXC_BASE_PT5 ((uint32_t)0x400110C0UL)
elijahsj 1:8a094db1347f 658 #define MXC_PT5 ((mxc_pt_regs_t *)MXC_BASE_PT5)
elijahsj 1:8a094db1347f 659 #define MXC_BASE_PT6 ((uint32_t)0x400110E0UL)
elijahsj 1:8a094db1347f 660 #define MXC_PT6 ((mxc_pt_regs_t *)MXC_BASE_PT6)
elijahsj 1:8a094db1347f 661 #define MXC_BASE_PT7 ((uint32_t)0x40011100UL)
elijahsj 1:8a094db1347f 662 #define MXC_PT7 ((mxc_pt_regs_t *)MXC_BASE_PT7)
elijahsj 1:8a094db1347f 663 #define MXC_BASE_PT8 ((uint32_t)0x40011120UL)
elijahsj 1:8a094db1347f 664 #define MXC_PT8 ((mxc_pt_regs_t *)MXC_BASE_PT8)
elijahsj 1:8a094db1347f 665 #define MXC_BASE_PT9 ((uint32_t)0x40011140UL)
elijahsj 1:8a094db1347f 666 #define MXC_PT9 ((mxc_pt_regs_t *)MXC_BASE_PT9)
elijahsj 1:8a094db1347f 667 #define MXC_BASE_PT10 ((uint32_t)0x40011160UL)
elijahsj 1:8a094db1347f 668 #define MXC_PT10 ((mxc_pt_regs_t *)MXC_BASE_PT10)
elijahsj 1:8a094db1347f 669 #define MXC_BASE_PT11 ((uint32_t)0x40011180UL)
elijahsj 1:8a094db1347f 670 #define MXC_PT11 ((mxc_pt_regs_t *)MXC_BASE_PT11)
elijahsj 1:8a094db1347f 671 #define MXC_BASE_PT12 ((uint32_t)0x400111A0UL)
elijahsj 1:8a094db1347f 672 #define MXC_PT12 ((mxc_pt_regs_t *)MXC_BASE_PT12)
elijahsj 1:8a094db1347f 673 #define MXC_BASE_PT13 ((uint32_t)0x400111C0UL)
elijahsj 1:8a094db1347f 674 #define MXC_PT13 ((mxc_pt_regs_t *)MXC_BASE_PT13)
elijahsj 1:8a094db1347f 675 #define MXC_BASE_PT14 ((uint32_t)0x400111E0UL)
elijahsj 1:8a094db1347f 676 #define MXC_PT14 ((mxc_pt_regs_t *)MXC_BASE_PT14)
elijahsj 1:8a094db1347f 677 #define MXC_BASE_PT15 ((uint32_t)0x40011200UL)
elijahsj 1:8a094db1347f 678 #define MXC_PT15 ((mxc_pt_regs_t *)MXC_BASE_PT15)
elijahsj 1:8a094db1347f 679
elijahsj 1:8a094db1347f 680 #define MXC_PT_GET_BASE(i) ((i) == 0 ? MXC_BASE_PT0 : \
elijahsj 1:8a094db1347f 681 (i) == 1 ? MXC_BASE_PT1 : \
elijahsj 1:8a094db1347f 682 (i) == 2 ? MXC_BASE_PT2 : \
elijahsj 1:8a094db1347f 683 (i) == 3 ? MXC_BASE_PT3 : \
elijahsj 1:8a094db1347f 684 (i) == 4 ? MXC_BASE_PT4 : \
elijahsj 1:8a094db1347f 685 (i) == 5 ? MXC_BASE_PT5 : \
elijahsj 1:8a094db1347f 686 (i) == 6 ? MXC_BASE_PT6 : \
elijahsj 1:8a094db1347f 687 (i) == 7 ? MXC_BASE_PT7 : \
elijahsj 1:8a094db1347f 688 (i) == 8 ? MXC_BASE_PT8 : \
elijahsj 1:8a094db1347f 689 (i) == 9 ? MXC_BASE_PT9 : \
elijahsj 1:8a094db1347f 690 (i) == 10 ? MXC_BASE_PT10 : \
elijahsj 1:8a094db1347f 691 (i) == 11 ? MXC_BASE_PT11 : \
elijahsj 1:8a094db1347f 692 (i) == 12 ? MXC_BASE_PT12 : \
elijahsj 1:8a094db1347f 693 (i) == 13 ? MXC_BASE_PT13 : \
elijahsj 1:8a094db1347f 694 (i) == 14 ? MXC_BASE_PT14 : \
elijahsj 1:8a094db1347f 695 (i) == 15 ? MXC_BASE_PT15 : 0)
elijahsj 1:8a094db1347f 696
elijahsj 1:8a094db1347f 697 #define MXC_PT_GET_PT(i) ((i) == 0 ? MXC_PT0 : \
elijahsj 1:8a094db1347f 698 (i) == 1 ? MXC_PT1 : \
elijahsj 1:8a094db1347f 699 (i) == 2 ? MXC_PT2 : \
elijahsj 1:8a094db1347f 700 (i) == 3 ? MXC_PT3 : \
elijahsj 1:8a094db1347f 701 (i) == 4 ? MXC_PT4 : \
elijahsj 1:8a094db1347f 702 (i) == 5 ? MXC_PT5 : \
elijahsj 1:8a094db1347f 703 (i) == 6 ? MXC_PT6 : \
elijahsj 1:8a094db1347f 704 (i) == 7 ? MXC_PT7 : \
elijahsj 1:8a094db1347f 705 (i) == 8 ? MXC_PT8 : \
elijahsj 1:8a094db1347f 706 (i) == 9 ? MXC_PT9 : \
elijahsj 1:8a094db1347f 707 (i) == 10 ? MXC_PT10 : \
elijahsj 1:8a094db1347f 708 (i) == 11 ? MXC_PT11 : \
elijahsj 1:8a094db1347f 709 (i) == 12 ? MXC_PT12 : \
elijahsj 1:8a094db1347f 710 (i) == 13 ? MXC_PT13 : \
elijahsj 1:8a094db1347f 711 (i) == 14 ? MXC_PT14 : \
elijahsj 1:8a094db1347f 712 (i) == 15 ? MXC_PT15 : 0)
elijahsj 1:8a094db1347f 713
elijahsj 1:8a094db1347f 714 #define MXC_PT_GET_IDX(p) ((p) == MXC_PT0 ? 0 : \
elijahsj 1:8a094db1347f 715 (p) == MXC_PT1 ? 1 : \
elijahsj 1:8a094db1347f 716 (p) == MXC_PT2 ? 2 : \
elijahsj 1:8a094db1347f 717 (p) == MXC_PT3 ? 3 : \
elijahsj 1:8a094db1347f 718 (p) == MXC_PT4 ? 4 : \
elijahsj 1:8a094db1347f 719 (p) == MXC_PT5 ? 5 : \
elijahsj 1:8a094db1347f 720 (p) == MXC_PT6 ? 6 : \
elijahsj 1:8a094db1347f 721 (p) == MXC_PT7 ? 7 : \
elijahsj 1:8a094db1347f 722 (p) == MXC_PT8 ? 8 : \
elijahsj 1:8a094db1347f 723 (p) == MXC_PT9 ? 9 : \
elijahsj 1:8a094db1347f 724 (p) == MXC_PT10 ? 10 : \
elijahsj 1:8a094db1347f 725 (p) == MXC_PT11 ? 11 : \
elijahsj 1:8a094db1347f 726 (p) == MXC_PT12 ? 12 : \
elijahsj 1:8a094db1347f 727 (p) == MXC_PT13 ? 13 : \
elijahsj 1:8a094db1347f 728 (p) == MXC_PT14 ? 14 : \
elijahsj 1:8a094db1347f 729 (p) == MXC_PT15 ? 15 : -1)
elijahsj 1:8a094db1347f 730
elijahsj 1:8a094db1347f 731
elijahsj 1:8a094db1347f 732
elijahsj 1:8a094db1347f 733 /* *************************************************************************** */
elijahsj 1:8a094db1347f 734 /* UART / Serial Port Interface */
elijahsj 1:8a094db1347f 735
elijahsj 1:8a094db1347f 736 #define MXC_CFG_UART_INSTANCES (4)
elijahsj 1:8a094db1347f 737 #define MXC_UART_FIFO_DEPTH (32)
elijahsj 1:8a094db1347f 738
elijahsj 1:8a094db1347f 739 #define MXC_BASE_UART0 ((uint32_t)0x40012000UL)
elijahsj 1:8a094db1347f 740 #define MXC_UART0 ((mxc_uart_regs_t *)MXC_BASE_UART0)
elijahsj 1:8a094db1347f 741 #define MXC_BASE_UART1 ((uint32_t)0x40013000UL)
elijahsj 1:8a094db1347f 742 #define MXC_UART1 ((mxc_uart_regs_t *)MXC_BASE_UART1) /**< UART Port 1 Base Address */
elijahsj 1:8a094db1347f 743 #define MXC_BASE_UART2 ((uint32_t)0x40014000UL)
elijahsj 1:8a094db1347f 744 #define MXC_UART2 ((mxc_uart_regs_t *)MXC_BASE_UART2)
elijahsj 1:8a094db1347f 745 #define MXC_BASE_UART3 ((uint32_t)0x40015000UL)
elijahsj 1:8a094db1347f 746 #define MXC_UART3 ((mxc_uart_regs_t *)MXC_BASE_UART3)
elijahsj 1:8a094db1347f 747 #define MXC_BASE_UART0_FIFO ((uint32_t)0x40103000UL)
elijahsj 1:8a094db1347f 748 #define MXC_UART0_FIFO ((mxc_uart_fifo_regs_t *)MXC_BASE_UART0_FIFO)
elijahsj 1:8a094db1347f 749 #define MXC_BASE_UART1_FIFO ((uint32_t)0x40104000UL)
elijahsj 1:8a094db1347f 750 #define MXC_UART1_FIFO ((mxc_uart_fifo_regs_t *)MXC_BASE_UART1_FIFO)
elijahsj 1:8a094db1347f 751 #define MXC_BASE_UART2_FIFO ((uint32_t)0x40105000UL)
elijahsj 1:8a094db1347f 752 #define MXC_UART2_FIFO ((mxc_uart_fifo_regs_t *)MXC_BASE_UART2_FIFO)
elijahsj 1:8a094db1347f 753 #define MXC_BASE_UART3_FIFO ((uint32_t)0x40106000UL)
elijahsj 1:8a094db1347f 754 #define MXC_UART3_FIFO ((mxc_uart_fifo_regs_t *)MXC_BASE_UART3_FIFO)
elijahsj 1:8a094db1347f 755
elijahsj 1:8a094db1347f 756 #define MXC_UART_GET_IRQ(i) (IRQn_Type)((i) == 0 ? UART0_IRQn : \
elijahsj 1:8a094db1347f 757 (i) == 1 ? UART1_IRQn : \
elijahsj 1:8a094db1347f 758 (i) == 2 ? UART2_IRQn : \
elijahsj 1:8a094db1347f 759 (i) == 3 ? UART3_IRQn : 0)
elijahsj 1:8a094db1347f 760
elijahsj 1:8a094db1347f 761 #define MXC_UART_GET_BASE(i) ((i) == 0 ? MXC_BASE_UART0 : \
elijahsj 1:8a094db1347f 762 (i) == 1 ? MXC_BASE_UART1 : \
elijahsj 1:8a094db1347f 763 (i) == 2 ? MXC_BASE_UART2 : \
elijahsj 1:8a094db1347f 764 (i) == 3 ? MXC_BASE_UART3 : 0)
elijahsj 1:8a094db1347f 765
elijahsj 1:8a094db1347f 766 #define MXC_UART_GET_UART(i) ((i) == 0 ? MXC_UART0 : \
elijahsj 1:8a094db1347f 767 (i) == 1 ? MXC_UART1 : \
elijahsj 1:8a094db1347f 768 (i) == 2 ? MXC_UART2 : \
elijahsj 1:8a094db1347f 769 (i) == 3 ? MXC_UART3 : 0)
elijahsj 1:8a094db1347f 770
elijahsj 1:8a094db1347f 771 #define MXC_UART_GET_IDX(p) ((p) == MXC_UART0 ? 0 : \
elijahsj 1:8a094db1347f 772 (p) == MXC_UART1 ? 1 : \
elijahsj 1:8a094db1347f 773 (p) == MXC_UART2 ? 2 : \
elijahsj 1:8a094db1347f 774 (p) == MXC_UART3 ? 3 : -1)
elijahsj 1:8a094db1347f 775
elijahsj 1:8a094db1347f 776 #define MXC_UART_GET_BASE_FIFO(i) ((i) == 0 ? MXC_BASE_UART0_FIFO : \
elijahsj 1:8a094db1347f 777 (i) == 1 ? MXC_BASE_UART1_FIFO : \
elijahsj 1:8a094db1347f 778 (i) == 2 ? MXC_BASE_UART2_FIFO : \
elijahsj 1:8a094db1347f 779 (i) == 3 ? MXC_BASE_UART3_FIFO : 0)
elijahsj 1:8a094db1347f 780
elijahsj 1:8a094db1347f 781 #define MXC_UART_GET_FIFO(i) ((i) == 0 ? MXC_UART0_FIFO : \
elijahsj 1:8a094db1347f 782 (i) == 1 ? MXC_UART1_FIFO : \
elijahsj 1:8a094db1347f 783 (i) == 2 ? MXC_UART2_FIFO : \
elijahsj 1:8a094db1347f 784 (i) == 3 ? MXC_UART3_FIFO : 0)
elijahsj 1:8a094db1347f 785
elijahsj 1:8a094db1347f 786
elijahsj 1:8a094db1347f 787
elijahsj 1:8a094db1347f 788 /* *************************************************************************** */
elijahsj 1:8a094db1347f 789 /* I2C Master Interface */
elijahsj 1:8a094db1347f 790
elijahsj 1:8a094db1347f 791 #define MXC_CFG_I2CM_INSTANCES (3)
elijahsj 1:8a094db1347f 792 #define MXC_I2CM_FIFO_DEPTH (8)
elijahsj 1:8a094db1347f 793
elijahsj 1:8a094db1347f 794 #define MXC_BASE_I2CM0 ((uint32_t)0x40016000UL)
elijahsj 1:8a094db1347f 795 #define MXC_I2CM0 ((mxc_i2cm_regs_t *)MXC_BASE_I2CM0)
elijahsj 1:8a094db1347f 796 #define MXC_BASE_I2CM1 ((uint32_t)0x40017000UL)
elijahsj 1:8a094db1347f 797 #define MXC_I2CM1 ((mxc_i2cm_regs_t *)MXC_BASE_I2CM1)
elijahsj 1:8a094db1347f 798 #define MXC_BASE_I2CM2 ((uint32_t)0x40018000UL)
elijahsj 1:8a094db1347f 799 #define MXC_I2CM2 ((mxc_i2cm_regs_t *)MXC_BASE_I2CM2)
elijahsj 1:8a094db1347f 800 #define MXC_BASE_I2CM0_FIFO ((uint32_t)0x40107000UL)
elijahsj 1:8a094db1347f 801 #define MXC_I2CM0_FIFO ((mxc_i2cm_fifo_regs_t *)MXC_BASE_I2CM0_FIFO)
elijahsj 1:8a094db1347f 802 #define MXC_BASE_I2CM1_FIFO ((uint32_t)0x40108000UL)
elijahsj 1:8a094db1347f 803 #define MXC_I2CM1_FIFO ((mxc_i2cm_fifo_regs_t *)MXC_BASE_I2CM1_FIFO)
elijahsj 1:8a094db1347f 804 #define MXC_BASE_I2CM2_FIFO ((uint32_t)0x40109000UL)
elijahsj 1:8a094db1347f 805 #define MXC_I2CM2_FIFO ((mxc_i2cm_fifo_regs_t *)MXC_BASE_I2CM2_FIFO)
elijahsj 1:8a094db1347f 806
elijahsj 1:8a094db1347f 807 #define MXC_I2CM_GET_IRQ(i) (IRQn_Type)((i) == 0 ? I2CM0_IRQn : \
elijahsj 1:8a094db1347f 808 (i) == 1 ? I2CM1_IRQn : \
elijahsj 1:8a094db1347f 809 (i) == 2 ? I2CM2_IRQn : 0)
elijahsj 1:8a094db1347f 810
elijahsj 1:8a094db1347f 811 #define MXC_I2CM_GET_BASE(i) ((i) == 0 ? MXC_BASE_I2CM0 : \
elijahsj 1:8a094db1347f 812 (i) == 1 ? MXC_BASE_I2CM1 : \
elijahsj 1:8a094db1347f 813 (i) == 2 ? MXC_BASE_I2CM2 : 0)
elijahsj 1:8a094db1347f 814
elijahsj 1:8a094db1347f 815 #define MXC_I2CM_GET_I2CM(i) ((i) == 0 ? MXC_I2CM0 : \
elijahsj 1:8a094db1347f 816 (i) == 1 ? MXC_I2CM1 : \
elijahsj 1:8a094db1347f 817 (i) == 2 ? MXC_I2CM2 : 0)
elijahsj 1:8a094db1347f 818
elijahsj 1:8a094db1347f 819 #define MXC_I2CM_GET_IDX(p) ((p) == MXC_I2CM0 ? 0 : \
elijahsj 1:8a094db1347f 820 (p) == MXC_I2CM1 ? 1 : \
elijahsj 1:8a094db1347f 821 (p) == MXC_I2CM2 ? 2 : -1)
elijahsj 1:8a094db1347f 822
elijahsj 1:8a094db1347f 823 #define MXC_I2CM_GET_BASE_FIFO(i) ((i) == 0 ? MXC_BASE_I2CM0_FIFO : \
elijahsj 1:8a094db1347f 824 (i) == 1 ? MXC_BASE_I2CM1_FIFO : \
elijahsj 1:8a094db1347f 825 (i) == 2 ? MXC_BASE_I2CM2_FIFO : 0)
elijahsj 1:8a094db1347f 826
elijahsj 1:8a094db1347f 827 #define MXC_I2CM_GET_FIFO(i) ((i) == 0 ? MXC_I2CM0_FIFO : \
elijahsj 1:8a094db1347f 828 (i) == 1 ? MXC_I2CM1_FIFO : \
elijahsj 1:8a094db1347f 829 (i) == 2 ? MXC_I2CM2_FIFO : 0)
elijahsj 1:8a094db1347f 830
elijahsj 1:8a094db1347f 831
elijahsj 1:8a094db1347f 832
elijahsj 1:8a094db1347f 833 /* *************************************************************************** */
elijahsj 1:8a094db1347f 834 /* I2C Slave Interface (Mailbox type) */
elijahsj 1:8a094db1347f 835
elijahsj 1:8a094db1347f 836 #define MXC_CFG_I2CS_INSTANCES (1)
elijahsj 1:8a094db1347f 837 #define MXC_CFG_I2CS_BUFFER_SIZE (32)
elijahsj 1:8a094db1347f 838
elijahsj 1:8a094db1347f 839 #define MXC_BASE_I2CS ((uint32_t)0x40019000UL)
elijahsj 1:8a094db1347f 840 #define MXC_I2CS ((mxc_i2cs_regs_t *)MXC_BASE_I2CS)
elijahsj 1:8a094db1347f 841
elijahsj 1:8a094db1347f 842 #define MXC_I2CS_GET_IRQ(i) (IRQn_Type)((i) == 0 ? I2CS_IRQn : 0)
elijahsj 1:8a094db1347f 843
elijahsj 1:8a094db1347f 844 #define MXC_I2CS_GET_BASE(i) ((i) == 0 ? MXC_BASE_I2CS : 0)
elijahsj 1:8a094db1347f 845
elijahsj 1:8a094db1347f 846 #define MXC_I2CS_GET_I2CS(i) ((i) == 0 ? MXC_I2CS : 0)
elijahsj 1:8a094db1347f 847
elijahsj 1:8a094db1347f 848 #define MXC_I2CS_GET_IDX(p) ((p) == MXC_I2CS ? 0 : -1)
elijahsj 1:8a094db1347f 849
elijahsj 1:8a094db1347f 850 /* *************************************************************************** */
elijahsj 1:8a094db1347f 851 /* SPI Master Interface */
elijahsj 1:8a094db1347f 852
elijahsj 1:8a094db1347f 853 #define MXC_CFG_SPIM_INSTANCES (3)
elijahsj 1:8a094db1347f 854 #define MXC_CFG_SPIM_FIFO_DEPTH (16)
elijahsj 1:8a094db1347f 855
elijahsj 1:8a094db1347f 856 #define MXC_BASE_SPIM0 ((uint32_t)0x4001A000UL)
elijahsj 1:8a094db1347f 857 #define MXC_SPIM0 ((mxc_spim_regs_t *)MXC_BASE_SPIM0)
elijahsj 1:8a094db1347f 858 #define MXC_BASE_SPIM1 ((uint32_t)0x4001B000UL)
elijahsj 1:8a094db1347f 859 #define MXC_SPIM1 ((mxc_spim_regs_t *)MXC_BASE_SPIM1)
elijahsj 1:8a094db1347f 860 #define MXC_BASE_SPIM2 ((uint32_t)0x4001C000UL)
elijahsj 1:8a094db1347f 861 #define MXC_SPIM2 ((mxc_spim_regs_t *)MXC_BASE_SPIM2)
elijahsj 1:8a094db1347f 862 #define MXC_BASE_SPIM0_FIFO ((uint32_t)0x4010A000UL)
elijahsj 1:8a094db1347f 863 #define MXC_SPIM0_FIFO ((mxc_spim_fifo_regs_t *)MXC_BASE_SPIM0_FIFO)
elijahsj 1:8a094db1347f 864 #define MXC_BASE_SPIM1_FIFO ((uint32_t)0x4010B000UL)
elijahsj 1:8a094db1347f 865 #define MXC_SPIM1_FIFO ((mxc_spim_fifo_regs_t *)MXC_BASE_SPIM1_FIFO)
elijahsj 1:8a094db1347f 866 #define MXC_BASE_SPIM2_FIFO ((uint32_t)0x4010C000UL)
elijahsj 1:8a094db1347f 867 #define MXC_SPIM2_FIFO ((mxc_spim_fifo_regs_t *)MXC_BASE_SPIM2_FIFO)
elijahsj 1:8a094db1347f 868
elijahsj 1:8a094db1347f 869 #define MXC_SPIM_GET_IRQ(i) (IRQn_Type)((i) == 0 ? SPIM0_IRQn : \
elijahsj 1:8a094db1347f 870 (i) == 1 ? SPIM1_IRQn : \
elijahsj 1:8a094db1347f 871 (i) == 2 ? SPIM2_IRQn : 0)
elijahsj 1:8a094db1347f 872
elijahsj 1:8a094db1347f 873 #define MXC_SPIM_GET_BASE(i) ((i) == 0 ? MXC_BASE_SPIM0 : \
elijahsj 1:8a094db1347f 874 (i) == 1 ? MXC_BASE_SPIM1 : \
elijahsj 1:8a094db1347f 875 (i) == 2 ? MXC_BASE_SPIM2 : 0)
elijahsj 1:8a094db1347f 876
elijahsj 1:8a094db1347f 877 #define MXC_SPIM_GET_SPIM(i) ((i) == 0 ? MXC_SPIM0 : \
elijahsj 1:8a094db1347f 878 (i) == 1 ? MXC_SPIM1 : \
elijahsj 1:8a094db1347f 879 (i) == 2 ? MXC_SPIM2 : 0)
elijahsj 1:8a094db1347f 880
elijahsj 1:8a094db1347f 881 #define MXC_SPIM_GET_IDX(p) ((p) == MXC_SPIM0 ? 0 : \
elijahsj 1:8a094db1347f 882 (p) == MXC_SPIM1 ? 1 : \
elijahsj 1:8a094db1347f 883 (p) == MXC_SPIM2 ? 2 : -1)
elijahsj 1:8a094db1347f 884
elijahsj 1:8a094db1347f 885 #define MXC_SPIM_GET_BASE_FIFO(i) ((i) == 0 ? MXC_BASE_SPIM0_FIFO : \
elijahsj 1:8a094db1347f 886 (i) == 1 ? MXC_BASE_SPIM1_FIFO : \
elijahsj 1:8a094db1347f 887 (i) == 2 ? MXC_BASE_SPIM2_FIFO : 0)
elijahsj 1:8a094db1347f 888
elijahsj 1:8a094db1347f 889 #define MXC_SPIM_GET_SPIM_FIFO(i) ((i) == 0 ? MXC_SPIM0_FIFO : \
elijahsj 1:8a094db1347f 890 (i) == 1 ? MXC_SPIM1_FIFO : \
elijahsj 1:8a094db1347f 891 (i) == 2 ? MXC_SPIM2_FIFO : 0)
elijahsj 1:8a094db1347f 892
elijahsj 1:8a094db1347f 893
elijahsj 1:8a094db1347f 894
elijahsj 1:8a094db1347f 895 /* *************************************************************************** */
elijahsj 1:8a094db1347f 896 /* 1-Wire Master Interface */
elijahsj 1:8a094db1347f 897
elijahsj 1:8a094db1347f 898 #define MXC_CFG_OWM_INSTANCES (1)
elijahsj 1:8a094db1347f 899
elijahsj 1:8a094db1347f 900 #define MXC_BASE_OWM ((uint32_t)0x4001E000UL)
elijahsj 1:8a094db1347f 901 #define MXC_OWM ((mxc_owm_regs_t *)MXC_BASE_OWM)
elijahsj 1:8a094db1347f 902
elijahsj 1:8a094db1347f 903 #define MXC_OWM_GET_IRQ(i) (IRQn_Type)((i) == 0 ? OWM_IRQn : 0)
elijahsj 1:8a094db1347f 904
elijahsj 1:8a094db1347f 905 #define MXC_OWM_GET_BASE(i) ((i) == 0 ? MXC_BASE_OWM : 0)
elijahsj 1:8a094db1347f 906
elijahsj 1:8a094db1347f 907 #define MXC_OWM_GET_OWM(i) ((i) == 0 ? MXC_OWM : 0)
elijahsj 1:8a094db1347f 908
elijahsj 1:8a094db1347f 909 #define MXC_OWM_GET_IDX(p) ((p) == MXC_OWM ? 0 : -1)
elijahsj 1:8a094db1347f 910
elijahsj 1:8a094db1347f 911
elijahsj 1:8a094db1347f 912 /* *************************************************************************** */
elijahsj 1:8a094db1347f 913 /* ADC / AFE */
elijahsj 1:8a094db1347f 914
elijahsj 1:8a094db1347f 915 #define MXC_CFG_ADC_FIFO_DEPTH (32)
elijahsj 1:8a094db1347f 916
elijahsj 1:8a094db1347f 917 #define MXC_BASE_ADC ((uint32_t)0x4001F000UL)
elijahsj 1:8a094db1347f 918 #define MXC_ADC ((mxc_adc_regs_t *)MXC_BASE_ADC)
elijahsj 1:8a094db1347f 919
elijahsj 1:8a094db1347f 920
elijahsj 1:8a094db1347f 921
elijahsj 1:8a094db1347f 922 /* *************************************************************************** */
elijahsj 1:8a094db1347f 923 /* SPIB AHB-to-SPI Bridge */
elijahsj 1:8a094db1347f 924
elijahsj 1:8a094db1347f 925 #define MXC_BASE_SPIB ((uint32_t)0x4000D000UL)
elijahsj 1:8a094db1347f 926 #define MXC_SPIB ((mxc_spib_regs_t *)MXC_BASE_SPIB)
elijahsj 1:8a094db1347f 927
elijahsj 1:8a094db1347f 928
elijahsj 1:8a094db1347f 929
elijahsj 1:8a094db1347f 930 /* *************************************************************************** */
elijahsj 1:8a094db1347f 931 /* SPI Slave Interface */
elijahsj 1:8a094db1347f 932
elijahsj 1:8a094db1347f 933 #define MXC_BASE_SPIS ((uint32_t)0x40020000UL)
elijahsj 1:8a094db1347f 934 #define MXC_SPIS ((mxc_spis_regs_t *)MXC_BASE_SPIS)
elijahsj 1:8a094db1347f 935 #define MXC_BASE_SPIS_FIFO ((uint32_t)0x4010E000UL)
elijahsj 1:8a094db1347f 936 #define MXC_SPIS_FIFO ((mxc_spis_fifo_regs_t *)MXC_BASE_SPIS_FIFO)
elijahsj 1:8a094db1347f 937
elijahsj 1:8a094db1347f 938
elijahsj 1:8a094db1347f 939
elijahsj 1:8a094db1347f 940 /* *************************************************************************** */
elijahsj 1:8a094db1347f 941 /* Bit Shifting */
elijahsj 1:8a094db1347f 942
elijahsj 1:8a094db1347f 943 #define MXC_F_BIT_0 (1 << 0)
elijahsj 1:8a094db1347f 944 #define MXC_F_BIT_1 (1 << 1)
elijahsj 1:8a094db1347f 945 #define MXC_F_BIT_2 (1 << 2)
elijahsj 1:8a094db1347f 946 #define MXC_F_BIT_3 (1 << 3)
elijahsj 1:8a094db1347f 947 #define MXC_F_BIT_4 (1 << 4)
elijahsj 1:8a094db1347f 948 #define MXC_F_BIT_5 (1 << 5)
elijahsj 1:8a094db1347f 949 #define MXC_F_BIT_6 (1 << 6)
elijahsj 1:8a094db1347f 950 #define MXC_F_BIT_7 (1 << 7)
elijahsj 1:8a094db1347f 951 #define MXC_F_BIT_8 (1 << 8)
elijahsj 1:8a094db1347f 952 #define MXC_F_BIT_9 (1 << 9)
elijahsj 1:8a094db1347f 953 #define MXC_F_BIT_10 (1 << 10)
elijahsj 1:8a094db1347f 954 #define MXC_F_BIT_11 (1 << 11)
elijahsj 1:8a094db1347f 955 #define MXC_F_BIT_12 (1 << 12)
elijahsj 1:8a094db1347f 956 #define MXC_F_BIT_13 (1 << 13)
elijahsj 1:8a094db1347f 957 #define MXC_F_BIT_14 (1 << 14)
elijahsj 1:8a094db1347f 958 #define MXC_F_BIT_15 (1 << 15)
elijahsj 1:8a094db1347f 959 #define MXC_F_BIT_16 (1 << 16)
elijahsj 1:8a094db1347f 960 #define MXC_F_BIT_17 (1 << 17)
elijahsj 1:8a094db1347f 961 #define MXC_F_BIT_18 (1 << 18)
elijahsj 1:8a094db1347f 962 #define MXC_F_BIT_19 (1 << 19)
elijahsj 1:8a094db1347f 963 #define MXC_F_BIT_20 (1 << 20)
elijahsj 1:8a094db1347f 964 #define MXC_F_BIT_21 (1 << 21)
elijahsj 1:8a094db1347f 965 #define MXC_F_BIT_22 (1 << 22)
elijahsj 1:8a094db1347f 966 #define MXC_F_BIT_23 (1 << 23)
elijahsj 1:8a094db1347f 967 #define MXC_F_BIT_24 (1 << 24)
elijahsj 1:8a094db1347f 968 #define MXC_F_BIT_25 (1 << 25)
elijahsj 1:8a094db1347f 969 #define MXC_F_BIT_26 (1 << 26)
elijahsj 1:8a094db1347f 970 #define MXC_F_BIT_27 (1 << 27)
elijahsj 1:8a094db1347f 971 #define MXC_F_BIT_28 (1 << 28)
elijahsj 1:8a094db1347f 972 #define MXC_F_BIT_29 (1 << 29)
elijahsj 1:8a094db1347f 973 #define MXC_F_BIT_30 (1 << 30)
elijahsj 1:8a094db1347f 974 #define MXC_F_BIT_31 (1 << 31)
elijahsj 1:8a094db1347f 975
elijahsj 1:8a094db1347f 976 /* *************************************************************************** */
elijahsj 1:8a094db1347f 977
elijahsj 1:8a094db1347f 978 #define MXC_SET_FIELD(reg, clr, set) (*(volatile uint32_t *)reg = ((*(volatile uint32_t *)reg & ~clr) | set))
elijahsj 1:8a094db1347f 979
elijahsj 1:8a094db1347f 980 /* *************************************************************************** */
elijahsj 1:8a094db1347f 981
elijahsj 1:8a094db1347f 982 #define BITBAND(reg, bit) ((0xf0000000 & (uint32_t)(reg)) + 0x2000000 + (((uint32_t)(reg) & 0x0fffffff) << 5) + ((bit) << 2))
elijahsj 1:8a094db1347f 983 #define MXC_CLRBIT(reg, bit) (*(volatile uint32_t *)BITBAND(reg, bit) = 0)
elijahsj 1:8a094db1347f 984 #define MXC_SETBIT(reg, bit) (*(volatile uint32_t *)BITBAND(reg, bit) = 1)
elijahsj 1:8a094db1347f 985 #define MXC_GETBIT(reg, bit) (*(volatile uint32_t *)BITBAND(reg, bit))
elijahsj 1:8a094db1347f 986
elijahsj 1:8a094db1347f 987
elijahsj 1:8a094db1347f 988 /* *************************************************************************** */
elijahsj 1:8a094db1347f 989
elijahsj 1:8a094db1347f 990 /* SCB CPACR Register Definitions */
elijahsj 1:8a094db1347f 991 /* Note: Added by Maxim Integrated, as these are missing from CMSIS/Core/Include/core_cm4.h */
elijahsj 1:8a094db1347f 992 #define SCB_CPACR_CP10_Pos 20 /*!< SCB CPACR: Coprocessor 10 Position */
elijahsj 1:8a094db1347f 993 #define SCB_CPACR_CP10_Msk (0x3UL << SCB_CPACR_CP10_Pos) /*!< SCB CPACR: Coprocessor 10 Mask */
elijahsj 1:8a094db1347f 994 #define SCB_CPACR_CP11_Pos 22 /*!< SCB CPACR: Coprocessor 11 Position */
elijahsj 1:8a094db1347f 995 #define SCB_CPACR_CP11_Msk (0x3UL << SCB_CPACR_CP11_Pos) /*!< SCB CPACR: Coprocessor 11 Mask */
elijahsj 1:8a094db1347f 996 /**@} end of ingroup product_name */
elijahsj 1:8a094db1347f 997 #endif /* _MAX3263X_H_ */
elijahsj 1:8a094db1347f 998