21#ifndef LIBRARIES_CMSIS_DEVICE_MAXIM_MAX78000_INCLUDE_MAX78000_H_
22#define LIBRARIES_CMSIS_DEVICE_MAXIM_MAX78000_INCLUDE_MAX78000_H_
25#define TARGET_NUM 78000
43#define __weak __attribute__((weak))
46#elif defined(__CC_ARM)
48#define inline __inline
54#if !defined __riscv && !defined RV32
55 NonMaskableInt_IRQn = -14,
57 MemoryManagement_IRQn = -12,
59 UsageFault_IRQn = -10,
61 DebugMonitor_IRQn = -4,
240#define MXC_IRQ_COUNT (MXC_IRQ_EXT_COUNT + 16)
248#define __CM4_REV 0x0100
249#define __MPU_PRESENT 1
250#define __NVIC_PRIO_BITS 3
251#define __Vendor_SysTickConfig 0
252#define __FPU_PRESENT 1
258#include <core_rv32.h>
266#include "system_max78000.h"
272#define MXC_ROM_MEM_BASE 0x00000000UL
273#define MXC_ROM_MEM_SIZE 0x00020000UL
274#define MXC_FLASH0_MEM_BASE 0x10000000UL
275#define MXC_FLASH_MEM_BASE MXC_FLASH0_MEM_BASE
276#define MXC_FLASH_PAGE_SIZE 0x00002000UL
277#define MXC_FLASH_MEM_SIZE 0x00080000UL
278#define MXC_INFO0_MEM_BASE 0x10800000UL
279#define MXC_INFO_MEM_BASE MXC_INFO0_MEM_BASE
280#define MXC_INFO_MEM_SIZE 0x00004000UL
281#define MXC_SRAM_MEM_BASE 0x20000000UL
282#define MXC_SRAM_MEM_SIZE 0x00020000UL
294#define MXC_BASE_GCR ((uint32_t)0x40000000UL)
295#define MXC_GCR ((mxc_gcr_regs_t *)MXC_BASE_GCR)
299#define MXC_BASE_SIR ((uint32_t)0x40000400UL)
300#define MXC_SIR ((mxc_sir_regs_t *)MXC_BASE_SIR)
304#define MXC_BASE_FCR ((uint32_t)0x40000800UL)
305#define MXC_FCR ((mxc_fcr_regs_t *)MXC_BASE_FCR)
309#define MXC_CFG_WDT_INSTANCES (2)
311#define MXC_BASE_WDT0 ((uint32_t)0x40003000UL)
312#define MXC_WDT0 ((mxc_wdt_regs_t *)MXC_BASE_WDT0)
313#define MXC_BASE_WDT1 ((uint32_t)0x40080800UL)
314#define MXC_WDT1 ((mxc_wdt_regs_t *)MXC_BASE_WDT1)
318#define MXC_BASE_DVS ((uint32_t)0x40003C00UL)
319#define MXC_DVS ((mxc_dvs_regs_t *)MXC_BASE_DVS)
323#define MXC_BASE_SIMO ((uint32_t)0x40004400UL)
324#define MXC_SIMO ((mxc_simo_regs_t *)MXC_BASE_SIMO)
328#define MXC_BASE_TRIMSIR ((uint32_t)0x40005400UL)
329#define MXC_TRIMSIR ((mxc_trimsir_regs_t *)MXC_BASE_TRIMSIR)
333#define MXC_BASE_GCFR ((uint32_t)0x40005800UL)
334#define MXC_GCFR ((mxc_gcfr_regs_t *)MXC_BASE_GCFR)
335#define MXC_BBFC MXC_GCFR
339#define MXC_BASE_RTC ((uint32_t)0x40006000UL)
340#define MXC_RTC ((mxc_rtc_regs_t *)MXC_BASE_RTC)
344#define MXC_BASE_WUT ((uint32_t)0x40006400UL)
345#define MXC_WUT ((mxc_wut_regs_t *)MXC_BASE_WUT)
349#define MXC_BASE_PWRSEQ ((uint32_t)0x40006800UL)
350#define MXC_PWRSEQ ((mxc_pwrseq_regs_t *)MXC_BASE_PWRSEQ)
354#define MXC_BASE_MCR ((uint32_t)0x40006C00UL)
355#define MXC_MCR ((mxc_mcr_regs_t *)MXC_BASE_MCR)
359#define MXC_BASE_AES ((uint32_t)0x40007400UL)
360#define MXC_AES ((mxc_aes_regs_t *)MXC_BASE_AES)
364#define MXC_BASE_AESKEYS ((uint32_t)0x40007800UL)
365#define MXC_AESKEYS ((mxc_aeskeys_regs_t *)MXC_BASE_AESKEYS)
368#define MXC_BASE_AESKEY MXC_BASE_AESKEYS
369#define MXC_AESKEY ((mxc_aes_key_regs_t *)MXC_BASE_AESKEY)
373#define MXC_CFG_GPIO_INSTANCES (4)
374#define MXC_CFG_GPIO_PINS_PORT (32)
376#define MXC_BASE_GPIO0 ((uint32_t)0x40008000UL)
377#define MXC_GPIO0 ((mxc_gpio_regs_t *)MXC_BASE_GPIO0)
378#define MXC_BASE_GPIO1 ((uint32_t)0x40009000UL)
379#define MXC_GPIO1 ((mxc_gpio_regs_t *)MXC_BASE_GPIO1)
380#define MXC_BASE_GPIO2 ((uint32_t)0x40080400UL)
381#define MXC_GPIO2 ((mxc_gpio_regs_t *)MXC_BASE_GPIO2)
382#define MXC_BASE_GPIO3 ((uint32_t)0x40080600UL)
383#define MXC_GPIO3 ((mxc_gpio_regs_t *)MXC_BASE_GPIO3)
385#define MXC_GPIO_GET_IDX(p) \
386 ((p) == MXC_GPIO0 ? 0 : (p) == MXC_GPIO1 ? 1 : (p) == MXC_GPIO2 ? 2 : (p) == MXC_GPIO3 ? 3 : -1)
388#define MXC_GPIO_GET_GPIO(i) \
389 ((i) == 0 ? MXC_GPIO0 : (i) == 1 ? MXC_GPIO1 : (i) == 2 ? MXC_GPIO2 : (i) == 3 ? MXC_GPIO3 : 0)
391#define MXC_GPIO_GET_IRQ(i) \
392 ((i) == 0 ? GPIO0_IRQn : \
393 (i) == 1 ? GPIO1_IRQn : \
394 (i) == 2 ? GPIO2_IRQn : \
395 (i) == 3 ? GPIOWAKE_IRQn : \
398#define GPIOWake_IRQn GPIOWAKE_IRQn
399#define GPIOWake_IRQHandler GPIOWAKE_IRQHandler
403#define MXC_BASE_PCIF ((uint32_t)0x4000E000UL)
404#define MXC_PCIF ((mxc_cameraif_regs_t *)MXC_BASE_PCIF)
408#define MXC_BASE_CRC ((uint32_t)0x4000F000UL)
409#define MXC_CRC ((mxc_crc_regs_t *)MXC_BASE_CRC)
413#define SEC(s) (((uint32_t)s) * 1000000UL)
414#define MSEC(ms) (ms * 1000UL)
417#define MXC_CFG_TMR_INSTANCES (6)
419#define MXC_BASE_TMR0 ((uint32_t)0x40010000UL)
420#define MXC_TMR0 ((mxc_tmr_regs_t *)MXC_BASE_TMR0)
421#define MXC_BASE_TMR1 ((uint32_t)0x40011000UL)
422#define MXC_TMR1 ((mxc_tmr_regs_t *)MXC_BASE_TMR1)
423#define MXC_BASE_TMR2 ((uint32_t)0x40012000UL)
424#define MXC_TMR2 ((mxc_tmr_regs_t *)MXC_BASE_TMR2)
425#define MXC_BASE_TMR3 ((uint32_t)0x40013000UL)
426#define MXC_TMR3 ((mxc_tmr_regs_t *)MXC_BASE_TMR3)
427#define MXC_BASE_TMR4 ((uint32_t)0x40080C00UL)
428#define MXC_TMR4 ((mxc_tmr_regs_t *)MXC_BASE_TMR4)
429#define MXC_BASE_TMR5 ((uint32_t)0x40081000UL)
430#define MXC_TMR5 ((mxc_tmr_regs_t *)MXC_BASE_TMR5)
432#define MXC_TMR_GET_IRQ(i) \
433 (IRQn_Type)((i) == 0 ? TMR0_IRQn : \
434 (i) == 1 ? TMR1_IRQn : \
435 (i) == 2 ? TMR2_IRQn : \
436 (i) == 3 ? TMR3_IRQn : \
437 (i) == 4 ? TMR4_IRQn : \
438 (i) == 5 ? TMR5_IRQn : \
441#define MXC_TMR_GET_BASE(i) \
442 ((i) == 0 ? MXC_BASE_TMR0 : \
443 (i) == 1 ? MXC_BASE_TMR1 : \
444 (i) == 2 ? MXC_BASE_TMR2 : \
445 (i) == 3 ? MXC_BASE_TMR3 : \
446 (i) == 4 ? MXC_BASE_TMR4 : \
447 (i) == 5 ? MXC_BASE_TMR5 : \
450#define MXC_TMR_GET_TMR(i) \
451 ((i) == 0 ? MXC_TMR0 : \
452 (i) == 1 ? MXC_TMR1 : \
453 (i) == 2 ? MXC_TMR2 : \
454 (i) == 3 ? MXC_TMR3 : \
455 (i) == 4 ? MXC_TMR4 : \
456 (i) == 5 ? MXC_TMR5 : \
459#define MXC_TMR_GET_IDX(p) \
460 ((p) == MXC_TMR0 ? 0 : \
461 (p) == MXC_TMR1 ? 1 : \
462 (p) == MXC_TMR2 ? 2 : \
463 (p) == MXC_TMR3 ? 3 : \
464 (p) == MXC_TMR4 ? 4 : \
465 (p) == MXC_TMR5 ? 5 : \
470#define MXC_I2C_INSTANCES (3)
472#define MXC_BASE_I2C0 ((uint32_t)0x4001D000UL)
473#define MXC_I2C0 ((mxc_i2c_regs_t *)MXC_BASE_I2C0)
474#define MXC_BASE_I2C1 ((uint32_t)0x4001E000UL)
475#define MXC_I2C1 ((mxc_i2c_regs_t *)MXC_BASE_I2C1)
476#define MXC_BASE_I2C2 ((uint32_t)0x4001F000UL)
477#define MXC_I2C2 ((mxc_i2c_regs_t *)MXC_BASE_I2C2)
479#define MXC_I2C_GET_IRQ(i) \
480 (IRQn_Type)((i) == 0 ? I2C0_IRQn : (i) == 1 ? I2C1_IRQn : (i) == 2 ? I2C2_IRQn : 0)
482#define MXC_I2C_GET_BASE(i) \
483 ((i) == 0 ? MXC_BASE_I2C0 : (i) == 1 ? MXC_BASE_I2C1 : (i) == 2 ? MXC_BASE_I2C2 : 0)
485#define MXC_I2C_GET_TMR(i) ((i) == 0 ? MXC_I2C0 : (i) == 1 ? MXC_I2C1 : (i) == 2 ? MXC_I2C2 : 0)
487#define MXC_I2C_GET_IDX(p) ((p) == MXC_I2C0 ? 0 : (p) == MXC_I2C1 ? 1 : (p) == MXC_I2C2 ? 2 : -1)
488#define MXC_I2C_FIFO_DEPTH (8)
492#define MXC_DMA_CHANNELS (16)
493#define MXC_DMA_INSTANCES (1)
495#define MXC_BASE_DMA ((uint32_t)0x40028000UL)
496#define MXC_DMA ((mxc_dma_regs_t *)MXC_BASE_DMA)
498#define MXC_DMA_GET_IDX(p) ((p) == MXC_DMA ? 0 : -1)
500#define MXC_DMA_CH_GET_IRQ(i) \
501 ((IRQn_Type)(((i) == 0) ? DMA0_IRQn : \
502 ((i) == 1) ? DMA1_IRQn : \
503 ((i) == 2) ? DMA2_IRQn : \
504 ((i) == 3) ? DMA3_IRQn : \
509#define MXC_FLC_INSTANCES (1)
511#define MXC_BASE_FLC0 ((uint32_t)0x40029000UL)
512#define MXC_FLC0 ((mxc_flc_regs_t *)MXC_BASE_FLC0)
513#define MXC_FLC MXC_FLC0
515#define MXC_FLC_GET_IRQ(i) (IRQn_Type)((i) == 0 ? FLC0_IRQn : 0)
517#define MXC_FLC_GET_BASE(i) ((i) == 0 ? MXC_BASE_FLC0 : 0)
519#define MXC_FLC_GET_FLC(i) ((i) == 0 ? MXC_FLC0 : 0)
521#define MXC_FLC_GET_IDX(p) ((p) == MXC_FLC0 ? 0 : -1)
525#define MXC_ICC_INSTANCES (2)
527#define MXC_BASE_ICC0 ((uint32_t)0x4002A000UL)
528#define MXC_ICC0 ((mxc_icc_regs_t *)MXC_BASE_ICC0)
530#define MXC_BASE_ICC1 ((uint32_t)0x4002A800UL)
531#define MXC_ICC1 ((mxc_icc_regs_t *)MXC_BASE_ICC1)
533#define MXC_ICC MXC_ICC0
538#define MXC_BASE_ADC ((uint32_t)0x40034000UL)
539#define MXC_ADC ((mxc_adc_regs_t *)MXC_BASE_ADC)
540#define MXC_ADC_MAX_CLOCK 8000000
544#define MXC_CFG_PT_INSTANCES (4)
546#define MXC_BASE_PTG ((uint32_t)0x4003C000UL)
547#define MXC_PTG ((mxc_ptg_regs_t *)MXC_BASE_PTG)
548#define MXC_BASE_PT0 ((uint32_t)0x4003C020UL)
549#define MXC_PT0 ((mxc_pt_regs_t *)MXC_BASE_PT0)
550#define MXC_BASE_PT1 ((uint32_t)0x4003C040UL)
551#define MXC_PT1 ((mxc_pt_regs_t *)MXC_BASE_PT1)
552#define MXC_BASE_PT2 ((uint32_t)0x4003C060UL)
553#define MXC_PT2 ((mxc_pt_regs_t *)MXC_BASE_PT2)
554#define MXC_BASE_PT3 ((uint32_t)0x4003C080UL)
555#define MXC_PT3 ((mxc_pt_regs_t *)MXC_BASE_PT3)
557#define MXC_PT_GET_BASE(i) \
558 ((i) == 0 ? MXC_BASE_PT0 : \
559 (i) == 1 ? MXC_BASE_PT1 : \
560 (i) == 2 ? MXC_BASE_PT2 : \
561 (i) == 3 ? MXC_BASE_PT3 : \
564#define MXC_PT_GET_PT(i) \
565 ((i) == 0 ? MXC_PT0 : (i) == 1 ? MXC_PT1 : (i) == 2 ? MXC_PT2 : (i) == 3 ? MXC_PT3 : 0)
567#define MXC_PT_GET_IDX(p) \
568 ((p) == MXC_PT0 ? 0 : (p) == MXC_PT1 ? 1 : (p) == MXC_PT2 ? 2 : (p) == MXC_PT3 ? 3 : -1)
572#define MXC_BASE_OWM ((uint32_t)0x4003D000UL)
573#define MXC_OWM ((mxc_owm_regs_t *)MXC_BASE_OWM)
577#define MXC_CFG_SEMA_INSTANCES (8)
579#define MXC_BASE_SEMA ((uint32_t)0x4003E000UL)
580#define MXC_SEMA ((mxc_sema_regs_t *)MXC_BASE_SEMA)
584#define MXC_UART_INSTANCES (4)
585#define MXC_UART_FIFO_DEPTH (8)
587#define MXC_BASE_UART0 ((uint32_t)0x40042000UL)
588#define MXC_UART0 ((mxc_uart_regs_t *)MXC_BASE_UART0)
589#define MXC_BASE_UART1 ((uint32_t)0x40043000UL)
590#define MXC_UART1 ((mxc_uart_regs_t *)MXC_BASE_UART1)
591#define MXC_BASE_UART2 ((uint32_t)0x40044000UL)
592#define MXC_UART2 ((mxc_uart_regs_t *)MXC_BASE_UART2)
593#define MXC_BASE_UART3 ((uint32_t)0x40081400UL)
594#define MXC_UART3 ((mxc_uart_regs_t *)MXC_BASE_UART3)
596#define MXC_UART_GET_IRQ(i) \
597 (IRQn_Type)((i) == 0 ? UART0_IRQn : \
598 (i) == 1 ? UART1_IRQn : \
599 (i) == 2 ? UART2_IRQn : \
600 (i) == 3 ? UART3_IRQn : \
603#define MXC_UART_GET_BASE(i) \
604 ((i) == 0 ? MXC_BASE_UART0 : \
605 (i) == 1 ? MXC_BASE_UART1 : \
606 (i) == 2 ? MXC_BASE_UART2 : \
607 (i) == 3 ? MXC_BASE_UART3 : \
610#define MXC_UART_GET_UART(i) \
611 ((i) == 0 ? MXC_UART0 : (i) == 1 ? MXC_UART1 : (i) == 2 ? MXC_UART2 : (i) == 3 ? MXC_UART3 : 0)
613#define MXC_UART_GET_IDX(p) \
614 ((p) == MXC_UART0 ? 0 : (p) == MXC_UART1 ? 1 : (p) == MXC_UART2 ? 2 : (p) == MXC_UART3 ? 3 : -1)
619#define MXC_SPI_INSTANCES (2)
621#define MXC_SPI_INSTANCES (1)
623#define MXC_SPI_SS_INSTANCES (4)
624#define MXC_SPI_FIFO_DEPTH (32)
626#define MXC_BASE_SPI1 ((uint32_t)0x40046000UL)
627#define MXC_SPI1 ((mxc_spi_regs_t *)MXC_BASE_SPI1)
629#define MXC_BASE_SPI0 ((uint32_t)0x400BE000UL)
630#define MXC_SPI0 ((mxc_spi_regs_t *)MXC_BASE_SPI0)
633#define MXC_SPI_GET_IDX(p) ((p) == MXC_SPI1 ? 0 : (p) == MXC_SPI0 ? 1 : -1)
635#define MXC_SPI_GET_BASE(i) ((i) == 0 ? MXC_BASE_SPI1 : (i) == 1 ? MXC_BASE_SPI0 : 0)
637#define MXC_SPI_GET_SPI(i) ((i) == 0 ? MXC_SPI1 : (i) == 1 ? MXC_SPI0 : 0)
639#define MXC_SPI_GET_IRQ(i) (IRQn_Type)((i) == 0 ? SPI1_IRQn : (i) == 1 ? SPI0_IRQn : 0)
642#define MXC_SPI_GET_IDX(p) ((p) == MXC_SPI1 ? 0 : -1)
644#define MXC_SPI_GET_BASE(i) ((i) == 0 ? MXC_BASE_SPI1 : 0)
646#define MXC_SPI_GET_SPI(i) ((i) == 0 ? MXC_SPI1 : 0)
648#define MXC_SPI_GET_IRQ(i) (IRQn_Type)((i) == 0 ? SPI1_IRQn : 0)
654#define MXC_BASE_TRNG ((uint32_t)0x4004D000UL)
655#define MXC_TRNG ((mxc_trng_regs_t *)MXC_BASE_TRNG)
659#define MXC_BASE_I2S ((uint32_t)0x40060000UL)
660#define MXC_I2S ((mxc_i2s_regs_t *)MXC_BASE_I2S)
664#define MXC_BASE_LPGCR ((uint32_t)0x40080000UL)
665#define MXC_LPGCR ((mxc_lpgcr_regs_t *)MXC_BASE_LPGCR)
669#define MXC_BASE_LPCMP ((uint32_t)0x40088000UL)
670#define MXC_LPCMP ((mxc_lpcmp_regs_t *)MXC_BASE_LPCMP)
676#define MXC_S_GCR_PCLKDIV_CNNCLKSEL_PCLK (0 << MXC_F_GCR_PCLKDIV_CNNCLKSEL_POS)
680#define MXC_F_BIT_0 (1 << 0)
681#define MXC_F_BIT_1 (1 << 1)
682#define MXC_F_BIT_2 (1 << 2)
683#define MXC_F_BIT_3 (1 << 3)
684#define MXC_F_BIT_4 (1 << 4)
685#define MXC_F_BIT_5 (1 << 5)
686#define MXC_F_BIT_6 (1 << 6)
687#define MXC_F_BIT_7 (1 << 7)
688#define MXC_F_BIT_8 (1 << 8)
689#define MXC_F_BIT_9 (1 << 9)
690#define MXC_F_BIT_10 (1 << 10)
691#define MXC_F_BIT_11 (1 << 11)
692#define MXC_F_BIT_12 (1 << 12)
693#define MXC_F_BIT_13 (1 << 13)
694#define MXC_F_BIT_14 (1 << 14)
695#define MXC_F_BIT_15 (1 << 15)
696#define MXC_F_BIT_16 (1 << 16)
697#define MXC_F_BIT_17 (1 << 17)
698#define MXC_F_BIT_18 (1 << 18)
699#define MXC_F_BIT_19 (1 << 19)
700#define MXC_F_BIT_20 (1 << 20)
701#define MXC_F_BIT_21 (1 << 21)
702#define MXC_F_BIT_22 (1 << 22)
703#define MXC_F_BIT_23 (1 << 23)
704#define MXC_F_BIT_24 (1 << 24)
705#define MXC_F_BIT_25 (1 << 25)
706#define MXC_F_BIT_26 (1 << 26)
707#define MXC_F_BIT_27 (1 << 27)
708#define MXC_F_BIT_28 (1 << 28)
709#define MXC_F_BIT_29 (1 << 29)
710#define MXC_F_BIT_30 (1 << 30)
711#define MXC_F_BIT_31 (1 << 31)
715#define BITBAND(reg, bit) \
716 ((0xf0000000 & (uint32_t)(reg)) + 0x2000000 + (((uint32_t)(reg)&0x0fffffff) << 5) + \
719#define MXC_CLRBIT(reg, bit) (*(volatile uint32_t *)BITBAND(reg, bit) = 0)
720#define MXC_SETBIT(reg, bit) (*(volatile uint32_t *)BITBAND(reg, bit) = 1)
721#define MXC_GETBIT(reg, bit) (*(volatile uint32_t *)BITBAND(reg, bit))
723#define MXC_SETFIELD(reg, mask, setting) (reg = ((reg) & ~(mask)) | ((setting) & (mask)))
729#define SCB_CPACR_CP10_Pos 20
730#define SCB_CPACR_CP10_Msk (0x3UL << SCB_CPACR_CP10_Pos)
731#define SCB_CPACR_CP11_Pos 22
732#define SCB_CPACR_CP11_Msk (0x3UL << SCB_CPACR_CP11_Pos)
Registers, Bit Masks and Bit Positions for the GCR Peripheral Module.