21#ifndef LIBRARIES_CMSIS_DEVICE_MAXIM_MAX32690_INCLUDE_MAX32690_H_
22#define LIBRARIES_CMSIS_DEVICE_MAXIM_MAX32690_INCLUDE_MAX32690_H_
25#define TARGET_NUM 32690
43#define __weak __attribute__((weak))
46#elif defined(__CC_ARM)
48#define inline __inline
55 NonMaskableInt_IRQn = -14,
57 MemoryManagement_IRQn = -12,
59 UsageFault_IRQn = -10,
61 DebugMonitor_IRQn = -4,
112 BTLE_RX_ENG_DET_IRQn,
122 BTLE_INV_APB_ADDR_IRQn,
123 BTLE_IQ_DATA_VALID_IRQn,
216 BTLE_RX_ENG_DET_IRQn,
226 BTLE_INV_APB_ADDR_IRQn,
227 BTLE_IQ_DATA_VALID_IRQn,
250#define MXC_IRQ_COUNT (MXC_IRQ_EXT_COUNT + 16)
258#define __CM4_REV 0x0100
259#define __MPU_PRESENT 1
260#define __NVIC_PRIO_BITS 3
261#define __Vendor_SysTickConfig 0
262#define __FPU_PRESENT 1
268#include <core_rv32.h>
272#include "system_max32690.h"
278#define MXC_ROM_MEM_BASE 0x00000000UL
279#define MXC_ROM_MEM_SIZE 0x00020000UL
280#define MXC_XIP_MEM_BASE 0x08000000UL
281#define MXC_XIP_MEM_SIZE 0x08000000UL
282#define MXC_FLASH0_MEM_BASE 0x10000000UL
283#define MXC_FLASH1_MEM_BASE 0x10300000UL
284#define MXC_FLASH_MEM_BASE MXC_FLASH0_MEM_BASE
285#define MXC_FLASH_PAGE_SIZE 0x00004000UL
286#define MXC_FLASH0_PAGE_SIZE 0x00004000UL
287#define MXC_FLASH1_PAGE_SIZE 0x00002000UL
288#define MXC_FLASH0_MEM_SIZE 0x00300000UL
289#define MXC_FLASH1_MEM_SIZE 0x00040000UL
290#define MXC_FLASH_MEM_SIZE (MXC_FLASH0_MEM_SIZE + MXC_FLASH1_MEM_SIZE)
291#define MXC_INFO0_MEM_BASE 0x10800000UL
292#define MXC_INFO1_MEM_BASE 0x10802000UL
293#define MXC_INFO_MEM_BASE MXC_INFO0_MEM_BASE
294#define MXC_INFO_MEM_SIZE 0x00002000UL
295#define MXC_INFO0_MEM_SIZE 0x00002000UL
296#define MXC_INFO1_MEM_SIZE 0x00002000UL
297#define MXC_SRAM_MEM_BASE 0x20000000UL
298#define MXC_SRAM_MEM_SIZE 0x00120000UL
299#define MXC_HPB_MEM_BASE 0x60000000UL
300#define MXC_HPB_MEM_SIZE 0x20000000UL
301#define MXC_XIP_DATA_MEM_BASE 0x80000000UL
302#define MXC_XIP_DATA_MEM_SIZE 0x20000000UL
314#define MXC_BASE_GCR ((uint32_t)0x40000000UL)
315#define MXC_GCR ((mxc_gcr_regs_t *)MXC_BASE_GCR)
319#define MXC_BASE_SIR ((uint32_t)0x40000400UL)
320#define MXC_SIR ((mxc_sir_regs_t *)MXC_BASE_SIR)
324#define MXC_BASE_FCR ((uint32_t)0x40000800UL)
325#define MXC_FCR ((mxc_fcr_regs_t *)MXC_BASE_FCR)
329#define MXC_BASE_CTB ((uint32_t)0x40001000UL)
330#define MXC_CTB ((mxc_ctb_regs_t *)MXC_BASE_CTB)
334#define MXC_CFG_WDT_INSTANCES (2)
336#define MXC_BASE_WDT0 ((uint32_t)0x40003000UL)
337#define MXC_WDT0 ((mxc_wdt_regs_t *)MXC_BASE_WDT0)
338#define MXC_WDT MXC_WDT0
339#define MXC_BASE_WDT1 ((uint32_t)0x40080800UL)
340#define MXC_WDT1 ((mxc_wdt_regs_t *)MXC_BASE_WDT1)
342#define MXC_WDT_GET_IDX(p) ((p) == MXC_WDT0 ? 0 : (p) == MXC_WDT1 ? 1 : -1)
346#define MXC_BASE_AESKEYS ((uint32_t)0x40005000UL)
347#define MXC_AESKEYS ((mxc_aeskeys_regs_t *)MXC_BASE_AESKEYS)
350#define MXC_BASE_AESKEY MXC_BASE_AESKEYS
351#define MXC_AESKEY ((mxc_aes_key_regs_t *)MXC_BASE_AESKEY)
355#define MXC_BASE_TRIMSIR ((uint32_t)0x40005400UL)
356#define MXC_TRIMSIR ((mxc_trimsir_regs_t *)MXC_BASE_TRIMSIR)
360#define MXC_BASE_GCFR ((uint32_t)0x40005800UL)
361#define MXC_GCFR ((mxc_gcfr_regs_t *)MXC_BASE_GCFR)
365#define MXC_BASE_RTC ((uint32_t)0x40006000UL)
366#define MXC_RTC ((mxc_rtc_regs_t *)MXC_BASE_RTC)
370#define MXC_CFG_WUT_INSTANCES (2)
372#define MXC_BASE_WUT0 ((uint32_t)0x40006400UL)
373#define MXC_WUT0 ((mxc_wut_regs_t *)MXC_BASE_WUT0)
374#define MXC_WUT MXC_WUT0
375#define MXC_BASE_WUT1 ((uint32_t)0x40006600UL)
376#define MXC_WUT1 ((mxc_wut_regs_t *)MXC_BASE_WUT1)
380#define MXC_BASE_PWRSEQ ((uint32_t)0x40006800UL)
381#define MXC_PWRSEQ ((mxc_pwrseq_regs_t *)MXC_BASE_PWRSEQ)
385#define MXC_BASE_MCR ((uint32_t)0x40006C00UL)
386#define MXC_MCR ((mxc_mcr_regs_t *)MXC_BASE_MCR)
390#define MXC_CFG_GPIO_INSTANCES (5)
391#define MXC_CFG_GPIO_PINS_PORT (32)
393#define MXC_BASE_GPIO0 ((uint32_t)0x40008000UL)
394#define MXC_GPIO0 ((mxc_gpio_regs_t *)MXC_BASE_GPIO0)
395#define MXC_BASE_GPIO1 ((uint32_t)0x40009000UL)
396#define MXC_GPIO1 ((mxc_gpio_regs_t *)MXC_BASE_GPIO1)
397#define MXC_BASE_GPIO2 ((uint32_t)0x4000A000UL)
398#define MXC_GPIO2 ((mxc_gpio_regs_t *)MXC_BASE_GPIO2)
399#define MXC_BASE_GPIO3 ((uint32_t)0x40080400UL)
400#define MXC_GPIO3 ((mxc_gpio_regs_t *)MXC_BASE_GPIO3)
402#define MXC_BASE_GPIO4 ((uint32_t)0x4000C000UL)
403#define MXC_GPIO4 ((mxc_gpio_regs_t *)MXC_BASE_GPIO4)
405#define MXC_GPIO_GET_IDX(p) \
406 ((p) == MXC_GPIO0 ? 0 : \
407 (p) == MXC_GPIO1 ? 1 : \
408 (p) == MXC_GPIO2 ? 2 : \
409 (p) == MXC_GPIO3 ? 3 : \
410 (p) == MXC_GPIO4 ? 4 : \
413#define MXC_GPIO_GET_GPIO(i) \
414 ((i) == 0 ? MXC_GPIO0 : \
415 (i) == 1 ? MXC_GPIO1 : \
416 (i) == 2 ? MXC_GPIO2 : \
417 (i) == 3 ? MXC_GPIO3 : \
418 (i) == 4 ? MXC_GPIO4 : \
421#define MXC_GPIO_GET_IRQ(i) \
422 ((i) == 0 ? GPIO0_IRQn : \
423 (i) == 1 ? GPIO1_IRQn : \
424 (i) == 2 ? GPIO2_IRQn : \
425 (i) == 3 ? GPIO3_IRQn : \
426 (i) == 4 ? GPIOWAKE_IRQn : \
431#define SEC(s) (((uint32_t)s) * 1000000UL)
432#define MSEC(ms) (ms * 1000UL)
435#define MXC_CFG_TMR_INSTANCES (6)
437#define MXC_BASE_TMR0 ((uint32_t)0x40010000UL)
438#define MXC_TMR0 ((mxc_tmr_regs_t *)MXC_BASE_TMR0)
439#define MXC_BASE_TMR1 ((uint32_t)0x40011000UL)
440#define MXC_TMR1 ((mxc_tmr_regs_t *)MXC_BASE_TMR1)
441#define MXC_BASE_TMR2 ((uint32_t)0x40012000UL)
442#define MXC_TMR2 ((mxc_tmr_regs_t *)MXC_BASE_TMR2)
443#define MXC_BASE_TMR3 ((uint32_t)0x40013000UL)
444#define MXC_TMR3 ((mxc_tmr_regs_t *)MXC_BASE_TMR3)
445#define MXC_BASE_TMR4 ((uint32_t)0x40080C00UL)
446#define MXC_TMR4 ((mxc_tmr_regs_t *)MXC_BASE_TMR4)
447#define MXC_BASE_TMR5 ((uint32_t)0x40081000UL)
448#define MXC_TMR5 ((mxc_tmr_regs_t *)MXC_BASE_TMR5)
450#define MXC_TMR_GET_IRQ(i) \
451 (IRQn_Type)((i) == 0 ? TMR0_IRQn : \
452 (i) == 1 ? TMR1_IRQn : \
453 (i) == 2 ? TMR2_IRQn : \
454 (i) == 3 ? TMR3_IRQn : \
455 (i) == 4 ? TMR4_IRQn : \
456 (i) == 5 ? TMR5_IRQn : \
459#define MXC_TMR_GET_BASE(i) \
460 ((i) == 0 ? MXC_BASE_TMR0 : \
461 (i) == 1 ? MXC_BASE_TMR1 : \
462 (i) == 2 ? MXC_BASE_TMR2 : \
463 (i) == 3 ? MXC_BASE_TMR3 : \
464 (i) == 4 ? MXC_BASE_TMR4 : \
465 (i) == 5 ? MXC_BASE_TMR5 : \
468#define MXC_TMR_GET_TMR(i) \
469 ((i) == 0 ? MXC_TMR0 : \
470 (i) == 1 ? MXC_TMR1 : \
471 (i) == 2 ? MXC_TMR2 : \
472 (i) == 3 ? MXC_TMR3 : \
473 (i) == 4 ? MXC_TMR4 : \
474 (i) == 5 ? MXC_TMR5 : \
477#define MXC_TMR_GET_IDX(p) \
478 ((p) == MXC_TMR0 ? 0 : \
479 (p) == MXC_TMR1 ? 1 : \
480 (p) == MXC_TMR2 ? 2 : \
481 (p) == MXC_TMR3 ? 3 : \
482 (p) == MXC_TMR4 ? 4 : \
483 (p) == MXC_TMR5 ? 5 : \
488#define MXC_I2C_INSTANCES (3)
490#define MXC_BASE_I2C0 ((uint32_t)0x4001D000UL)
491#define MXC_I2C0 ((mxc_i2c_regs_t *)MXC_BASE_I2C0)
492#define MXC_BASE_I2C1 ((uint32_t)0x4001E000UL)
493#define MXC_I2C1 ((mxc_i2c_regs_t *)MXC_BASE_I2C1)
494#define MXC_BASE_I2C2 ((uint32_t)0x4001F000UL)
495#define MXC_I2C2 ((mxc_i2c_regs_t *)MXC_BASE_I2C2)
497#define MXC_I2C_GET_IRQ(i) \
498 (IRQn_Type)((i) == 0 ? I2C0_IRQn : (i) == 1 ? I2C1_IRQn : (i) == 2 ? I2C2_IRQn : 0)
500#define MXC_I2C_GET_BASE(i) \
501 ((i) == 0 ? MXC_BASE_I2C0 : (i) == 1 ? MXC_BASE_I2C1 : (i) == 2 ? MXC_BASE_I2C2 : 0)
503#define MXC_I2C_GET_I2C(i) ((i) == 0 ? MXC_I2C0 : (i) == 1 ? MXC_I2C1 : (i) == 2 ? MXC_I2C2 : 0)
505#define MXC_I2C_GET_IDX(p) ((p) == MXC_I2C0 ? 0 : (p) == MXC_I2C1 ? 1 : (p) == MXC_I2C2 ? 2 : -1)
507#define MXC_I2C_FIFO_DEPTH (8)
511#define MXC_BASE_SPIXFM ((uint32_t)0x40026000UL)
512#define MXC_SPIXFM ((mxc_spixfm_regs_t *)MXC_BASE_SPIXFM)
516#define MXC_CFG_SPIXFC_FIFO_DEPTH (16)
518#define MXC_BASE_SPIXFC ((uint32_t)0x40027000UL)
519#define MXC_SPIXFC ((mxc_spixfc_regs_t *)MXC_BASE_SPIXFC)
520#define MXC_BASE_SPIXFC_FIFO ((uint32_t)0x400BC000UL)
521#define MXC_SPIXFC_FIFO ((mxc_spixfc_fifo_regs_t *)MXC_BASE_SPIXFC_FIFO)
525#define MXC_DMA_CHANNELS (16)
526#define MXC_DMA_INSTANCES (1)
528#define MXC_BASE_DMA ((uint32_t)0x40028000UL)
529#define MXC_DMA ((mxc_dma_regs_t *)MXC_BASE_DMA)
531#define MXC_DMA_GET_IDX(p) ((p) == MXC_DMA ? 0 : -1)
533#define MXC_DMA_CH_GET_IRQ(i) \
534 ((IRQn_Type)(((i) == 0) ? DMA0_IRQn : \
535 ((i) == 1) ? DMA1_IRQn : \
536 ((i) == 2) ? DMA2_IRQn : \
537 ((i) == 3) ? DMA3_IRQn : \
538 ((i) == 4) ? DMA4_IRQn : \
539 ((i) == 5) ? DMA5_IRQn : \
540 ((i) == 6) ? DMA6_IRQn : \
541 ((i) == 7) ? DMA7_IRQn : \
542 ((i) == 8) ? DMA8_IRQn : \
543 ((i) == 9) ? DMA9_IRQn : \
544 ((i) == 10) ? DMA10_IRQn : \
545 ((i) == 11) ? DMA11_IRQn : \
546 ((i) == 12) ? DMA12_IRQn : \
547 ((i) == 13) ? DMA13_IRQn : \
548 ((i) == 14) ? DMA14_IRQn : \
549 ((i) == 15) ? DMA15_IRQn : \
554#define MXC_FLC_INSTANCES (2)
556#define MXC_BASE_FLC0 ((uint32_t)0x40029000UL)
557#define MXC_FLC0 ((mxc_flc_regs_t *)MXC_BASE_FLC0)
558#define MXC_FLC MXC_FLC0
559#define MXC_BASE_FLC1 ((uint32_t)0x40029400UL)
560#define MXC_FLC1 ((mxc_flc_regs_t *)MXC_BASE_FLC1)
562#define MXC_FLC_GET_IRQ(i) (IRQn_Type)((i) == 0 ? FLC0_IRQn : (i) == 1 ? FLC1_IRQn : 0)
564#define MXC_FLC_GET_BASE(i) ((i) == 0 ? MXC_BASE_FLC0 : (i) == 1 ? MXC_BASE_FLC1 : 0)
566#define MXC_FLC_GET_FLC(i) ((i) == 0 ? MXC_FLC0 : (i) == 1 ? MXC_FLC1 : 0)
568#define MXC_FLC_GET_IDX(p) ((p) == MXC_FLC0 ? 0 : (p) == MXC_FLC1 ? 1 : -1)
572#define MXC_ICC_INSTANCES (2)
574#define MXC_BASE_ICC0 ((uint32_t)0x4002A000UL)
575#define MXC_ICC0 ((mxc_icc_regs_t *)MXC_BASE_ICC0)
577#define MXC_BASE_ICC1 ((uint32_t)0x4002A800UL)
578#define MXC_ICC1 ((mxc_icc_regs_t *)MXC_BASE_ICC1)
580#define MXC_ICC MXC_ICC0
585#define MXC_BASE_SFCC ((uint32_t)0x4002F000UL)
586#define MXC_SFCC ((mxc_icc_regs_t *)MXC_BASE_SFCC)
590#define MXC_BASE_EMCC ((uint32_t)0x40033000UL)
591#define MXC_EMCC ((mxc_emcc_regs_t *)MXC_BASE_EMCC)
595#define MXC_BASE_ADC ((uint32_t)0x40034000UL)
596#define MXC_ADC ((mxc_adc_regs_t *)MXC_BASE_ADC)
597#define MXC_ADC_MAX_CLOCK 8000000
601#define MXC_BASE_HPB ((uint32_t)0x40039000UL)
602#define MXC_HPB ((mxc_hpb_regs_t *)MXC_BASE_HPB)
606#define MXC_BASE_SPIXR ((uint32_t)0x4003A000UL)
607#define MXC_SPIXR ((mxc_spixr_regs_t *)MXC_BASE_SPIXR)
611#define MXC_CFG_PT_INSTANCES (16)
613#define MXC_BASE_PTG ((uint32_t)0x4003C000UL)
614#define MXC_PTG ((mxc_ptg_regs_t *)MXC_BASE_PTG)
615#define MXC_BASE_PT0 ((uint32_t)0x4003C020UL)
616#define MXC_PT0 ((mxc_pt_regs_t *)MXC_BASE_PT0)
617#define MXC_BASE_PT1 ((uint32_t)0x4003C040UL)
618#define MXC_PT1 ((mxc_pt_regs_t *)MXC_BASE_PT1)
619#define MXC_BASE_PT2 ((uint32_t)0x4003C060UL)
620#define MXC_PT2 ((mxc_pt_regs_t *)MXC_BASE_PT2)
621#define MXC_BASE_PT3 ((uint32_t)0x4003C080UL)
622#define MXC_PT3 ((mxc_pt_regs_t *)MXC_BASE_PT3)
623#define MXC_BASE_PT4 ((uint32_t)0x4003C0A0UL)
624#define MXC_PT4 ((mxc_pt_regs_t *)MXC_BASE_PT4)
625#define MXC_BASE_PT5 ((uint32_t)0x4003C0C0UL)
626#define MXC_PT5 ((mxc_pt_regs_t *)MXC_BASE_PT5)
627#define MXC_BASE_PT6 ((uint32_t)0x4003C0E0UL)
628#define MXC_PT6 ((mxc_pt_regs_t *)MXC_BASE_PT6)
629#define MXC_BASE_PT7 ((uint32_t)0x4003C100UL)
630#define MXC_PT7 ((mxc_pt_regs_t *)MXC_BASE_PT7)
631#define MXC_BASE_PT8 ((uint32_t)0x4003C120UL)
632#define MXC_PT8 ((mxc_pt_regs_t *)MXC_BASE_PT8)
633#define MXC_BASE_PT9 ((uint32_t)0x4003C140UL)
634#define MXC_PT9 ((mxc_pt_regs_t *)MXC_BASE_PT9)
635#define MXC_BASE_PT10 ((uint32_t)0x4003C160UL)
636#define MXC_PT10 ((mxc_pt_regs_t *)MXC_BASE_PT10)
637#define MXC_BASE_PT11 ((uint32_t)0x4003C180UL)
638#define MXC_PT11 ((mxc_pt_regs_t *)MXC_BASE_PT11)
639#define MXC_BASE_PT12 ((uint32_t)0x4003C1A0UL)
640#define MXC_PT12 ((mxc_pt_regs_t *)MXC_BASE_PT12)
641#define MXC_BASE_PT13 ((uint32_t)0x4003C1C0UL)
642#define MXC_PT13 ((mxc_pt_regs_t *)MXC_BASE_PT13)
643#define MXC_BASE_PT14 ((uint32_t)0x4003C1E0UL)
644#define MXC_PT14 ((mxc_pt_regs_t *)MXC_BASE_PT14)
645#define MXC_BASE_PT15 ((uint32_t)0x4003C200UL)
646#define MXC_PT15 ((mxc_pt_regs_t *)MXC_BASE_PT15)
648#define MXC_PT_GET_BASE(i) \
649 ((i) == 0 ? MXC_BASE_PT0 : \
650 (i) == 1 ? MXC_BASE_PT1 : \
651 (i) == 2 ? MXC_BASE_PT2 : \
652 (i) == 3 ? MXC_BASE_PT3 : \
653 (i) == 4 ? MXC_BASE_PT4 : \
654 (i) == 5 ? MXC_BASE_PT5 : \
655 (i) == 6 ? MXC_BASE_PT6 : \
656 (i) == 7 ? MXC_BASE_PT7 : \
657 (i) == 8 ? MXC_BASE_PT8 : \
658 (i) == 9 ? MXC_BASE_PT9 : \
659 (i) == 10 ? MXC_BASE_PT10 : \
660 (i) == 11 ? MXC_BASE_PT11 : \
661 (i) == 12 ? MXC_BASE_PT12 : \
662 (i) == 13 ? MXC_BASE_PT13 : \
663 (i) == 14 ? MXC_BASE_PT14 : \
664 (i) == 15 ? MXC_BASE_PT15 : \
667#define MXC_PT_GET_PT(i) \
668 ((i) == 0 ? MXC_PT0 : \
669 (i) == 1 ? MXC_PT1 : \
670 (i) == 2 ? MXC_PT2 : \
671 (i) == 3 ? MXC_PT3 : \
672 (i) == 4 ? MXC_PT4 : \
673 (i) == 5 ? MXC_PT5 : \
674 (i) == 6 ? MXC_PT6 : \
675 (i) == 7 ? MXC_PT7 : \
676 (i) == 8 ? MXC_PT8 : \
677 (i) == 9 ? MXC_PT9 : \
678 (i) == 10 ? MXC_PT10 : \
679 (i) == 11 ? MXC_PT11 : \
680 (i) == 12 ? MXC_PT12 : \
681 (i) == 13 ? MXC_PT13 : \
682 (i) == 14 ? MXC_PT14 : \
683 (i) == 15 ? MXC_PT15 : \
686#define MXC_PT_GET_IDX(p) \
687 ((p) == MXC_PT0 ? 0 : \
688 (p) == MXC_PT1 ? 1 : \
689 (p) == MXC_PT2 ? 2 : \
690 (p) == MXC_PT3 ? 3 : \
691 (p) == MXC_PT4 ? 4 : \
692 (p) == MXC_PT5 ? 5 : \
693 (p) == MXC_PT6 ? 6 : \
694 (p) == MXC_PT7 ? 7 : \
695 (p) == MXC_PT8 ? 8 : \
696 (p) == MXC_PT9 ? 9 : \
697 (p) == MXC_PT10 ? 10 : \
698 (p) == MXC_PT11 ? 11 : \
699 (p) == MXC_PT12 ? 12 : \
700 (p) == MXC_PT13 ? 13 : \
701 (p) == MXC_PT14 ? 14 : \
702 (p) == MXC_PT15 ? 15 : \
707#define MXC_BASE_OWM ((uint32_t)0x4003D000UL)
708#define MXC_OWM ((mxc_owm_regs_t *)MXC_BASE_OWM)
712#define MXC_CFG_SEMA_INSTANCES (8)
714#define MXC_BASE_SEMA ((uint32_t)0x4003E000UL)
715#define MXC_SEMA ((mxc_sema_regs_t *)MXC_BASE_SEMA)
719#define MXC_UART_INSTANCES (4)
720#define MXC_UART_FIFO_DEPTH (8)
722#define MXC_BASE_UART0 ((uint32_t)0x40042000UL)
723#define MXC_UART0 ((mxc_uart_regs_t *)MXC_BASE_UART0)
724#define MXC_BASE_UART1 ((uint32_t)0x40043000UL)
725#define MXC_UART1 ((mxc_uart_regs_t *)MXC_BASE_UART1)
726#define MXC_BASE_UART2 ((uint32_t)0x40044000UL)
727#define MXC_UART2 ((mxc_uart_regs_t *)MXC_BASE_UART2)
728#define MXC_BASE_UART3 ((uint32_t)0x40081400UL)
729#define MXC_UART3 ((mxc_uart_regs_t *)MXC_BASE_UART3)
731#define MXC_UART_GET_IRQ(i) \
732 (IRQn_Type)((i) == 0 ? UART0_IRQn : \
733 (IRQn_Type)(i) == 1 ? UART1_IRQn : \
734 (IRQn_Type)(i) == 2 ? UART2_IRQn : \
735 (IRQn_Type)(i) == 3 ? UART3_IRQn : \
738#define MXC_UART_GET_BASE(i) \
739 ((i) == 0 ? MXC_BASE_UART0 : \
740 (i) == 1 ? MXC_BASE_UART1 : \
741 (i) == 2 ? MXC_BASE_UART2 : \
742 (i) == 3 ? MXC_BASE_UART3 : \
745#define MXC_UART_GET_UART(i) \
746 ((i) == 0 ? MXC_UART0 : (i) == 1 ? MXC_UART1 : (i) == 2 ? MXC_UART2 : (i) == 3 ? MXC_UART3 : 0)
748#define MXC_UART_GET_IDX(p) \
749 ((p) == MXC_UART0 ? 0 : (p) == MXC_UART1 ? 1 : (p) == MXC_UART2 ? 2 : (p) == MXC_UART3 ? 3 : -1)
754#define MXC_SPI_INSTANCES (5)
756#define MXC_SPI_INSTANCES (3)
758#define MXC_SPI_SS_INSTANCES (4)
759#define MXC_SPI_FIFO_DEPTH (32)
761#define MXC_BASE_SPI0 ((uint32_t)0x40046000UL)
762#define MXC_SPI0 ((mxc_spi_regs_t *)MXC_BASE_SPI0)
763#define MXC_BASE_SPI1 ((uint32_t)0x40047000UL)
764#define MXC_SPI1 ((mxc_spi_regs_t *)MXC_BASE_SPI1)
765#define MXC_BASE_SPI2 ((uint32_t)0x40048000UL)
766#define MXC_SPI2 ((mxc_spi_regs_t *)MXC_BASE_SPI2)
769#define MXC_BASE_SPI3 ((uint32_t)0x400BE000UL)
770#define MXC_SPI3 ((mxc_spi_regs_t *)MXC_BASE_SPI3)
771#define MXC_BASE_SPI4 ((uint32_t)0x400BE400UL)
772#define MXC_SPI4 ((mxc_spi_regs_t *)MXC_BASE_SPI4)
774#define MXC_SPI_GET_IDX(p) \
775 ((p) == MXC_SPI0 ? 0 : \
776 (p) == MXC_SPI1 ? 1 : \
777 (p) == MXC_SPI2 ? 2 : \
778 (p) == MXC_SPI3 ? 3 : \
779 (p) == MXC_SPI4 ? 4 : \
782#define MXC_SPI_GET_BASE(i) \
783 ((i) == 0 ? MXC_BASE_SPI0 : \
784 (i) == 1 ? MXC_BASE_SPI1 : \
785 (i) == 2 ? MXC_BASE_SPI2 : \
786 (i) == 3 ? MXC_BASE_SPI3 : \
787 (i) == 4 ? MXC_BASE_SPI4 : \
790#define MXC_SPI_GET_SPI(i) \
791 ((i) == 0 ? MXC_SPI0 : \
792 (i) == 1 ? MXC_SPI1 : \
793 (i) == 2 ? MXC_SPI2 : \
794 (i) == 3 ? MXC_SPI3 : \
795 (i) == 4 ? MXC_SPI4 : \
798#define MXC_SPI_GET_IRQ(i) \
799 (IRQn_Type)((i) == 0 ? SPI0_IRQn : \
800 (i) == 1 ? SPI1_IRQn : \
801 (i) == 2 ? SPI2_IRQn : \
802 (i) == 3 ? SPI3_IRQn : \
803 (i) == 4 ? SPI4_IRQn : \
807#define MXC_SPI_GET_IDX(p) ((p) == MXC_SPI0 ? 0 : (p) == MXC_SPI1 ? 1 : (p) == MXC_SPI2 ? 2 : -1)
809#define MXC_SPI_GET_BASE(i) \
810 ((i) == 0 ? MXC_BASE_SPI0 : (i) == 1 ? MXC_BASE_SPI1 : (i) == 2 ? MXC_BASE_SPI2 : 0)
812#define MXC_SPI_GET_SPI(i) ((i) == 0 ? MXC_SPI0 \
813 (i) == 1 ? MXC_SPI1 \
814 (i) == 2 ? MXC_SPI2 : 0)
816#define MXC_SPI_GET_IRQ(i) \
817 (IRQn_Type)((i) == 0 ? SPI0_IRQn : (i) == 1 ? SPI1_IRQn : (i) == 2 ? SPI2_IRQn : 0)
823#define MXC_BASE_TRNG ((uint32_t)0x4004D000UL)
824#define MXC_TRNG ((mxc_trng_regs_t *)MXC_BASE_TRNG)
828#define MXC_BASE_I2S ((uint32_t)0x40060000UL)
829#define MXC_I2S ((mxc_i2s_regs_t *)MXC_BASE_I2S)
833#define MXC_BASE_USBHS ((uint32_t)0x400B1000UL)
834#define MXC_USBHS ((mxc_usbhs_regs_t *)MXC_BASE_USBHS)
835#define MXC_USBHS_NUM_EP 12
836#define MXC_USBHS_NUM_DMA 8
837#define MXC_USBHS_MAX_PACKET 512
841 MXC_USB_CLOCK_SYS_DIV_10 = 0,
842 MXC_USB_CLOCK_EXTCLK = 1,
843 MXC_USB_CLOCK_ERFO = 2
852#define mxc_usb_clock_t _mxc_usb_clock_t
856#define MXC_BASE_LPGCR ((uint32_t)0x40080000UL)
857#define MXC_LPGCR ((mxc_lpgcr_regs_t *)MXC_BASE_LPGCR)
861#define MXC_BASE_LPCMP ((uint32_t)0x40088000UL)
862#define MXC_LPCMP ((mxc_lpcmp_regs_t *)MXC_BASE_LPCMP)
866#define MXC_CAN_INSTANCES (2)
868#define MXC_BASE_CAN0 ((uint32_t)0x40064000UL)
869#define MXC_CAN0 ((mxc_can_regs_t *)MXC_BASE_CAN0)
870#define MXC_BASE_CAN1 ((uint32_t)0x40065000UL)
871#define MXC_CAN1 ((mxc_can_regs_t *)MXC_BASE_CAN1)
873#define MXC_CAN_GET_IDX(p) ((p) == MXC_CAN0 ? 0 : (p) == MXC_CAN1 ? 1 : -1)
875#define MXC_CAN_GET_BASE(i) ((i) == 0 ? MXC_BASE_CAN0 : (i) == 1 ? MXC_BASE_CAN1 : 0)
877#define MXC_CAN_GET_CAN(i) ((i) == 0 ? MXC_CAN0 : (i) == 1 ? MXC_CAN1 : 0)
879#define MXC_CAN_GET_IRQ(i) (IRQn_Type)((i) == 0 ? CAN0_IRQn : (i) == 1 ? CAN1_IRQn : 0)
884#define MXC_F_BIT_0 (1 << 0)
885#define MXC_F_BIT_1 (1 << 1)
886#define MXC_F_BIT_2 (1 << 2)
887#define MXC_F_BIT_3 (1 << 3)
888#define MXC_F_BIT_4 (1 << 4)
889#define MXC_F_BIT_5 (1 << 5)
890#define MXC_F_BIT_6 (1 << 6)
891#define MXC_F_BIT_7 (1 << 7)
892#define MXC_F_BIT_8 (1 << 8)
893#define MXC_F_BIT_9 (1 << 9)
894#define MXC_F_BIT_10 (1 << 10)
895#define MXC_F_BIT_11 (1 << 11)
896#define MXC_F_BIT_12 (1 << 12)
897#define MXC_F_BIT_13 (1 << 13)
898#define MXC_F_BIT_14 (1 << 14)
899#define MXC_F_BIT_15 (1 << 15)
900#define MXC_F_BIT_16 (1 << 16)
901#define MXC_F_BIT_17 (1 << 17)
902#define MXC_F_BIT_18 (1 << 18)
903#define MXC_F_BIT_19 (1 << 19)
904#define MXC_F_BIT_20 (1 << 20)
905#define MXC_F_BIT_21 (1 << 21)
906#define MXC_F_BIT_22 (1 << 22)
907#define MXC_F_BIT_23 (1 << 23)
908#define MXC_F_BIT_24 (1 << 24)
909#define MXC_F_BIT_25 (1 << 25)
910#define MXC_F_BIT_26 (1 << 26)
911#define MXC_F_BIT_27 (1 << 27)
912#define MXC_F_BIT_28 (1 << 28)
913#define MXC_F_BIT_29 (1 << 29)
914#define MXC_F_BIT_30 (1 << 30)
915#define MXC_F_BIT_31 (1 << 31)
920#define BITBAND(reg, bit) \
921 ((0xf0000000 & (uint32_t)(reg)) + 0x2000000 + (((uint32_t)(reg)&0x0fffffff) << 5) + \
924#define MXC_CLRBIT(reg, bit) (*(volatile uint32_t *)BITBAND(reg, bit) = 0)
925#define MXC_SETBIT(reg, bit) (*(volatile uint32_t *)BITBAND(reg, bit) = 1)
926#define MXC_GETBIT(reg, bit) (*(volatile uint32_t *)BITBAND(reg, bit))
928#define MXC_SETFIELD(reg, mask, setting) (reg = ((reg) & ~(mask)) | ((setting) & (mask)))
934#define SCB_CPACR_CP10_Pos 20
935#define SCB_CPACR_CP10_Msk (0x3UL << SCB_CPACR_CP10_Pos)
936#define SCB_CPACR_CP11_Pos 22
937#define SCB_CPACR_CP11_Msk (0x3UL << SCB_CPACR_CP11_Pos)