Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.

Upstream: https://github.com/ARMmbed/DAPLink

Committer:
Pawel Zarembski
Date:
Tue Apr 07 12:55:42 2020 +0200
Revision:
0:01f31e923fe2
hani: DAPLink with reset workaround

Who changed what in which revision?

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