forked from xuos/xiuos
				
			Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into jerryscript
This commit is contained in:
		
						commit
						267707c920
					
				| 
						 | 
				
			
			@ -7,7 +7,8 @@ MAKEFLAGS += --no-print-directory
 | 
			
		|||
 | 
			
		||||
riscv_support := kd233 maix-go hifive1-rev-B gapuino gd32vf103-rvstar rv32m1-vega aiit-riscv64-board xidatong-riscv64 edu-riscv64 ch32v307vct6
 | 
			
		||||
arm_support += stm32f407-st-discovery stm32f407zgt6 stm32f103-nano nuvoton-m2354 ok1052-c imxrt1176-sbc aiit-arm32-board xidatong-arm32 xiwangtong-arm32 edu-arm32
 | 
			
		||||
emulator_support += hifive1-emulator k210-emulator cortex-m0-emulator cortex-m3-emulator cortex-m4-emulator
 | 
			
		||||
emulator_support += hifive1-emulator k210-emulator cortex-m0-emulator cortex-m3-emulator cortex-m4-emulator cortex-m7-emulator
 | 
			
		||||
 | 
			
		||||
support := $(riscv_support) $(arm_support) $(emulator_support) 
 | 
			
		||||
SRC_DIR :=
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -35,6 +35,11 @@ SRC_DIR := shared
 | 
			
		|||
SRC_DIR += cortex-m7
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(CONFIG_BOARD_CORTEX_V2M_EVB),y)
 | 
			
		||||
SRC_DIR := shared
 | 
			
		||||
SRC_DIR += cortex-m7
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(CONFIG_BOARD_IMXRT1176_SBC_EVB),y)
 | 
			
		||||
SRC_DIR := shared
 | 
			
		||||
SRC_DIR += cortex-m7
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,8 @@
 | 
			
		|||
ifeq ($(CONFIG_BOARD_CORTEX_M7_EVB),y)
 | 
			
		||||
SRC_FILES := boot.S  interrupt.c interrupt_vector.S
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(CONFIG_BOARD_CORTEX_V2M_EVB),y)
 | 
			
		||||
SRC_DIR += V2M
 | 
			
		||||
endif
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_FILES := boot.S  interrupt.c interrupt_vector.S
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,39 @@
 | 
			
		|||
/*
 | 
			
		||||
* Copyright (c) 2020 AIIT XUOS Lab
 | 
			
		||||
* XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
* You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
*        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
* See the Mulan PSL v2 for more details.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#ifndef ARCH_INTERRUPT_H__
 | 
			
		||||
#define ARCH_INTERRUPT_H__
 | 
			
		||||
 | 
			
		||||
#include <xs_base.h>
 | 
			
		||||
 | 
			
		||||
#define ARCH_MAX_IRQ_NUM (256)
 | 
			
		||||
 | 
			
		||||
//#define ARCH_IRQ_NUM_OFFSET 0
 | 
			
		||||
 | 
			
		||||
//#define SYSTICK_IRQN       15
 | 
			
		||||
//#define UART1_IRQn         36
 | 
			
		||||
//#define UART2_IRQn         37
 | 
			
		||||
 | 
			
		||||
#define ARCH_IRQ_NUM_OFFSET 16
 | 
			
		||||
 | 
			
		||||
#define SYSTICK_IRQN       -1
 | 
			
		||||
#define UART0RX_IRQn        0
 | 
			
		||||
#define UART0TX_IRQn        1
 | 
			
		||||
#define UART1RX_IRQn        2
 | 
			
		||||
 | 
			
		||||
// #define USB1_IRQn          113
 | 
			
		||||
// #define USB2_IRQn          112
 | 
			
		||||
 | 
			
		||||
int32 ArchEnableHwIrq(uint32 irq_num);
 | 
			
		||||
int32 ArchDisableHwIrq(uint32 irq_num);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,204 @@
 | 
			
		|||
/* ------------------------------------------------------------------------- */
 | 
			
		||||
/*  @file:    startup_MIMXRT1052.s                                           */
 | 
			
		||||
/*  @purpose: CMSIS Cortex-M7 Core Device Startup File                       */
 | 
			
		||||
/*            MIMXRT1052                                                     */
 | 
			
		||||
/*  @version: 1.0                                                            */
 | 
			
		||||
/*  @date:    2018-9-21                                                      */
 | 
			
		||||
/*  @build:   b180921                                                        */
 | 
			
		||||
/* ------------------------------------------------------------------------- */
 | 
			
		||||
/*                                                                           */
 | 
			
		||||
/* Copyright 1997-2016 Freescale Semiconductor, Inc.                         */
 | 
			
		||||
/* Copyright 2016-2018 NXP                                                   */
 | 
			
		||||
/* All rights reserved.                                                      */
 | 
			
		||||
/*                                                                           */
 | 
			
		||||
/* SPDX-License-Identifier: BSD-3-Clause                                     */
 | 
			
		||||
/*****************************************************************************/
 | 
			
		||||
/* Version: GCC for ARM Embedded Processors                                  */
 | 
			
		||||
/*****************************************************************************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file boot.S
 | 
			
		||||
* @brief Cortex-M7 start function
 | 
			
		||||
* @version 1.0 
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2021-05-28
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*************************************************
 | 
			
		||||
File name: boot.S
 | 
			
		||||
Description: Contex-M7 start function function
 | 
			
		||||
Others: take startup_MIMXRT1052.s for references
 | 
			
		||||
History: 
 | 
			
		||||
1. Date: 2021-05-28
 | 
			
		||||
Author: AIIT XUOS Lab
 | 
			
		||||
Modification: 
 | 
			
		||||
1. add OS entry function
 | 
			
		||||
*************************************************/
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
    .arch armv7-m
 | 
			
		||||
    .text
 | 
			
		||||
    .thumb
 | 
			
		||||
 | 
			
		||||
/* Reset Handler */
 | 
			
		||||
 | 
			
		||||
    .thumb_func
 | 
			
		||||
    .align 2
 | 
			
		||||
    .globl   Reset_Handler
 | 
			
		||||
    .weak    Reset_Handler
 | 
			
		||||
    .type    Reset_Handler, %function
 | 
			
		||||
Reset_Handler:
 | 
			
		||||
#ifdef __BOOTLOADER /* BOOT */
 | 
			
		||||
    cpsid   i               /* Mask interrupts */
 | 
			
		||||
    .equ    VTOR, 0xE000ED08
 | 
			
		||||
    ldr     r0, =VTOR
 | 
			
		||||
    ldr     r1, =__isr_vector
 | 
			
		||||
    str     r1, [r0]
 | 
			
		||||
    ldr     r2, [r1]
 | 
			
		||||
    msr     msp, r2
 | 
			
		||||
 | 
			
		||||
    ldr   r0,=SystemInit
 | 
			
		||||
    blx   r0
 | 
			
		||||
 | 
			
		||||
/*     Loop to copy data from read only memory to RAM. The ranges
 | 
			
		||||
 *      of copy from/to are specified by following symbols evaluated in
 | 
			
		||||
 *      linker script.
 | 
			
		||||
 *      __bootloader_end: End of code section, i.e., begin of data sections to copy from.
 | 
			
		||||
 *      __data_start__/__data_end__: RAM address range that data should be
 | 
			
		||||
 *      __noncachedata_start__/__noncachedata_end__ : none cachable region
 | 
			
		||||
 *      copied to. Both must be aligned to 4 bytes boundary.  */
 | 
			
		||||
 | 
			
		||||
    ldr    r1, =__etext
 | 
			
		||||
    ldr    r2, =__data_start__
 | 
			
		||||
    ldr    r3, =__data_end__
 | 
			
		||||
 | 
			
		||||
    /* Here are two copies of loop implemenations. First one favors code size
 | 
			
		||||
    * and the second one favors performance. Default uses the first one.
 | 
			
		||||
    * Change to "#if 0" to use the second one */
 | 
			
		||||
.LoopCopy0:
 | 
			
		||||
    cmp     r2, r3
 | 
			
		||||
    ittt    lt
 | 
			
		||||
    ldrlt   r0, [r1], #4
 | 
			
		||||
    strlt   r0, [r2], #4
 | 
			
		||||
    blt    .LoopCopy0
 | 
			
		||||
 | 
			
		||||
    /*     This part of work usually is done in C library startup code. Otherwise,
 | 
			
		||||
    *     define this macro to enable it in this startup.
 | 
			
		||||
    *
 | 
			
		||||
    *     Loop to zero out BSS section, which uses following symbols
 | 
			
		||||
    *     in linker script:
 | 
			
		||||
    *      __bss_start__: start of BSS section. Must align to 4
 | 
			
		||||
    *      __bss_end__: end of BSS section. Must align to 4
 | 
			
		||||
    */
 | 
			
		||||
    ldr r1, =__bss_start__
 | 
			
		||||
    ldr r2, =__bss_end__
 | 
			
		||||
 | 
			
		||||
    movs    r0, 0
 | 
			
		||||
.LoopCopy1:
 | 
			
		||||
    cmp     r1, r2
 | 
			
		||||
    itt    lt
 | 
			
		||||
    strlt   r0, [r1], #4
 | 
			
		||||
    blt    .LoopCopy1
 | 
			
		||||
 | 
			
		||||
    ldr   r0,=ota_entry
 | 
			
		||||
    blx   r0
 | 
			
		||||
#else /* APP */
 | 
			
		||||
    cpsid   i               /* Mask interrupts */
 | 
			
		||||
    .equ    VTOR, 0xE000ED08
 | 
			
		||||
    ldr     r0, =VTOR
 | 
			
		||||
    ldr     r1, =__isr_vector
 | 
			
		||||
    str     r1, [r0]
 | 
			
		||||
    ldr     r2, [r1]
 | 
			
		||||
    msr     msp, r2
 | 
			
		||||
#ifndef __NO_SYSTEM_INIT
 | 
			
		||||
    ldr   r0,=SystemInit
 | 
			
		||||
    blx   r0
 | 
			
		||||
#endif
 | 
			
		||||
/*     Loop to copy data from read only memory to RAM. The ranges
 | 
			
		||||
 *      of copy from/to are specified by following symbols evaluated in
 | 
			
		||||
 *      linker script.
 | 
			
		||||
 *      __etext: End of code section, i.e., begin of data sections to copy from.
 | 
			
		||||
 *      __data_start__/__data_end__: RAM address range that data should be
 | 
			
		||||
 *      __noncachedata_start__/__noncachedata_end__ : none cachable region
 | 
			
		||||
 *      copied to. Both must be aligned to 4 bytes boundary.  */
 | 
			
		||||
 | 
			
		||||
    ldr    r1, =__etext
 | 
			
		||||
    ldr    r2, =__data_start__
 | 
			
		||||
    ldr    r3, =__data_end__
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
/* Here are two copies of loop implemenations. First one favors code size
 | 
			
		||||
 * and the second one favors performance. Default uses the first one.
 | 
			
		||||
 * Change to "#if 0" to use the second one */
 | 
			
		||||
.LC0:
 | 
			
		||||
    cmp     r2, r3
 | 
			
		||||
    ittt    lt
 | 
			
		||||
    ldrlt   r0, [r1], #4
 | 
			
		||||
    strlt   r0, [r2], #4
 | 
			
		||||
    blt    .LC0
 | 
			
		||||
#else
 | 
			
		||||
    subs    r3, r2
 | 
			
		||||
    ble    .LC1
 | 
			
		||||
.LC0:
 | 
			
		||||
    subs    r3, #4
 | 
			
		||||
    ldr    r0, [r1, r3]
 | 
			
		||||
    str    r0, [r2, r3]
 | 
			
		||||
    bgt    .LC0
 | 
			
		||||
.LC1:
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef __STARTUP_INITIALIZE_NONCACHEDATA
 | 
			
		||||
    ldr    r2, =__noncachedata_start__
 | 
			
		||||
    ldr    r3, =__noncachedata_init_end__
 | 
			
		||||
#if 1
 | 
			
		||||
.LC2:
 | 
			
		||||
    cmp     r2, r3
 | 
			
		||||
    ittt    lt
 | 
			
		||||
    ldrlt   r0, [r1], #4
 | 
			
		||||
    strlt   r0, [r2], #4
 | 
			
		||||
    blt    .LC2
 | 
			
		||||
#else
 | 
			
		||||
    subs    r3, r2
 | 
			
		||||
    ble    .LC3
 | 
			
		||||
.LC2:
 | 
			
		||||
    subs    r3, #4
 | 
			
		||||
    ldr    r0, [r1, r3]
 | 
			
		||||
    str    r0, [r2, r3]
 | 
			
		||||
    bgt    .LC2
 | 
			
		||||
.LC3:
 | 
			
		||||
#endif
 | 
			
		||||
/* zero inited ncache section initialization */
 | 
			
		||||
    ldr r3, =__noncachedata_end__
 | 
			
		||||
    movs    r0,0
 | 
			
		||||
.LC4:
 | 
			
		||||
    cmp    r2,r3
 | 
			
		||||
    itt    lt
 | 
			
		||||
    strlt   r0,[r2],#4
 | 
			
		||||
    blt    .LC4
 | 
			
		||||
#endif /* __STARTUP_INITIALIZE_NONCACHEDATA */
 | 
			
		||||
 | 
			
		||||
#if 1
 | 
			
		||||
/*     This part of work usually is done in C library startup code. Otherwise,
 | 
			
		||||
 *     define this macro to enable it in this startup.
 | 
			
		||||
 *
 | 
			
		||||
 *     Loop to zero out BSS section, which uses following symbols
 | 
			
		||||
 *     in linker script:
 | 
			
		||||
 *      __bss_start__: start of BSS section. Must align to 4
 | 
			
		||||
 *      __bss_end__: end of BSS section. Must align to 4
 | 
			
		||||
 */
 | 
			
		||||
    ldr r1, =__bss_start__
 | 
			
		||||
    ldr r2, =__bss_end__
 | 
			
		||||
 | 
			
		||||
    movs    r0, 0
 | 
			
		||||
.LC5:
 | 
			
		||||
    cmp     r1, r2
 | 
			
		||||
    itt    lt
 | 
			
		||||
    strlt   r0, [r1], #4
 | 
			
		||||
    blt    .LC5
 | 
			
		||||
#endif /* __STARTUP_CLEAR_BSS */
 | 
			
		||||
 | 
			
		||||
    ldr   r0,=entry
 | 
			
		||||
    blx   r0
 | 
			
		||||
#endif /* MCUBOOT_BOOTLOADER */
 | 
			
		||||
 | 
			
		||||
.size Reset_Handler, . - Reset_Handler
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,89 @@
 | 
			
		|||
/*
 | 
			
		||||
* Copyright (c) 2020 AIIT XUOS Lab
 | 
			
		||||
* XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
* You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
*        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
* See the Mulan PSL v2 for more details.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file interrupt.c
 | 
			
		||||
* @brief support arm cortex-m7 interrupt function
 | 
			
		||||
* @version 1.0 
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2021-05-28
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#include <xs_base.h>
 | 
			
		||||
#include <xs_isr.h>
 | 
			
		||||
#include "fsl_common.h"
 | 
			
		||||
 | 
			
		||||
x_base __attribute__((naked)) DisableLocalInterrupt()
 | 
			
		||||
{
 | 
			
		||||
    asm volatile ("MRS     r0, PRIMASK");
 | 
			
		||||
    asm volatile ("CPSID   I");
 | 
			
		||||
    asm volatile ("BX      LR ");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void __attribute__((naked)) EnableLocalInterrupt(x_base level)
 | 
			
		||||
{
 | 
			
		||||
    asm volatile ("MSR     PRIMASK, r0");
 | 
			
		||||
    asm volatile ("BX      LR");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int32 ArchEnableHwIrq(uint32 irq_num)
 | 
			
		||||
{
 | 
			
		||||
    EnableIRQ(irq_num);
 | 
			
		||||
    return EOK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int32 ArchDisableHwIrq(uint32 irq_num)
 | 
			
		||||
{
 | 
			
		||||
    DisableIRQ(irq_num);
 | 
			
		||||
    return EOK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern  void KTaskOsAssignAfterIrq(void *context);
 | 
			
		||||
 | 
			
		||||
void IsrEntry()
 | 
			
		||||
{
 | 
			
		||||
    uint32 ipsr;
 | 
			
		||||
 | 
			
		||||
    __asm__ volatile("MRS %0, IPSR" : "=r"(ipsr));
 | 
			
		||||
    if (ipsr!=17){
 | 
			
		||||
      KPrintf("%d\n",ipsr);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    isrManager.done->incCounter();
 | 
			
		||||
    isrManager.done->handleIrq(ipsr);
 | 
			
		||||
    KTaskOsAssignAfterIrq(NONE);
 | 
			
		||||
    isrManager.done->decCounter();
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void UsageFault_Handler(int irqn, void *arg)
 | 
			
		||||
{
 | 
			
		||||
  /* Go to infinite loop when Usage Fault exception occurs */
 | 
			
		||||
  while (1)
 | 
			
		||||
  {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BusFault_Handler(int irqn, void *arg)
 | 
			
		||||
{
 | 
			
		||||
  /* Go to infinite loop when Bus Fault exception occurs */
 | 
			
		||||
  while (1)
 | 
			
		||||
  {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void NMI_Handler(int irqn, void *arg)
 | 
			
		||||
{
 | 
			
		||||
    while (1)
 | 
			
		||||
  {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,319 @@
 | 
			
		|||
/* ------------------------------------------------------------------------- */
 | 
			
		||||
/*  @file:    startup_MIMXRT1052.s                                           */
 | 
			
		||||
/*  @purpose: CMSIS Cortex-M7 Core Device Startup File                       */
 | 
			
		||||
/*            MIMXRT1052                                                     */
 | 
			
		||||
/*  @version: 1.0                                                            */
 | 
			
		||||
/*  @date:    2018-9-21                                                      */
 | 
			
		||||
/*  @build:   b180921                                                        */
 | 
			
		||||
/* ------------------------------------------------------------------------- */
 | 
			
		||||
/*                                                                           */
 | 
			
		||||
/* Copyright 1997-2016 Freescale Semiconductor, Inc.                         */
 | 
			
		||||
/* Copyright 2016-2018 NXP                                                   */
 | 
			
		||||
/* All rights reserved.                                                      */
 | 
			
		||||
/*                                                                           */
 | 
			
		||||
/* SPDX-License-Identifier: BSD-3-Clause                                     */
 | 
			
		||||
/*****************************************************************************/
 | 
			
		||||
/* Version: GCC for ARM Embedded Processors                                  */
 | 
			
		||||
/*****************************************************************************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file interrupt_vector.S
 | 
			
		||||
* @brief vector table for Cortex M7
 | 
			
		||||
* @version 1.0 
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2021-05-28
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*************************************************
 | 
			
		||||
File name: interrupt_vector.S
 | 
			
		||||
Description: vector table for a Cortex M7
 | 
			
		||||
Others: 
 | 
			
		||||
History: 
 | 
			
		||||
1. Date: 2021-05-28
 | 
			
		||||
Author: AIIT XUOS Lab
 | 
			
		||||
Modification: 
 | 
			
		||||
1. add IsrEntry as default isr function
 | 
			
		||||
*************************************************/
 | 
			
		||||
 | 
			
		||||
    .syntax unified
 | 
			
		||||
    .arch armv7-m
 | 
			
		||||
 | 
			
		||||
    .section .isr_vector, "a"
 | 
			
		||||
    .align 2
 | 
			
		||||
    .globl __isr_vector
 | 
			
		||||
__isr_vector:
 | 
			
		||||
    .long    __StackTop                       /*     Initial Stack Pointer */
 | 
			
		||||
    .long    Reset_Handler                      /*     Reset Handler */
 | 
			
		||||
    .long   NMI_Handler                                     /* NMI Handler*/
 | 
			
		||||
    .long   HardFaultHandler                               /* Hard Fault Handler*/
 | 
			
		||||
    .long   MemFaultHandler                               /* MPU Fault Handler*/
 | 
			
		||||
    .long   BusFault_Handler                                /* Bus Fault Handler*/
 | 
			
		||||
    .long   UsageFault_Handler                              /* Usage Fault Handler*/
 | 
			
		||||
    .long    0                                  /*     Reserved */
 | 
			
		||||
    .long    0                                  /*     Reserved */
 | 
			
		||||
    .long    0                                  /*     Reserved */
 | 
			
		||||
    .long    0                                  /*     Reserved */
 | 
			
		||||
    .long    SVC_Handler                        /*  -5 SVC Handler */
 | 
			
		||||
    .long    DebugMon_Handler                   /*  -4 Debug Monitor Handler */
 | 
			
		||||
    .long    0                                  /*     Reserved */
 | 
			
		||||
    .long    PendSV_Handler                     /*  -2 PendSV Handler */
 | 
			
		||||
    .long    SysTick_Handler                    /*  -1 SysTick Handler */
 | 
			
		||||
 | 
			
		||||
    /* Interrupts */
 | 
			
		||||
    .long    UART0RX_Handler                    /*   0 UART 0 receive interrupt */
 | 
			
		||||
    .long    UART0TX_Handler                    /*   1 UART 0 transmit interrupt */
 | 
			
		||||
    .long    UART1RX_Handler                    /*   2 UART 1 receive interrupt */
 | 
			
		||||
    .long    UART1TX_Handler                    /*   3 UART 1 transmit interrupt */
 | 
			
		||||
    .long    UART2RX_Handler                    /*   4 UART 2 receive interrupt */
 | 
			
		||||
    .long    UART2TX_Handler                    /*   5 UART 2 transmit interrupt */
 | 
			
		||||
    .long    GPIO0ALL_Handler                   /*   6 GPIO 0 combined interrupt */
 | 
			
		||||
    .long    GPIO1ALL_Handler                   /*   7 GPIO 1 combined interrupt */
 | 
			
		||||
    .long    TIMER0_Handler                     /*   8 Timer 0 interrupt */
 | 
			
		||||
    .long    TIMER1_Handler                     /*   9 Timer 1 interrupt */
 | 
			
		||||
    .long    DUALTIMER_Handler                  /*  10 Dual Timer interrupt */
 | 
			
		||||
    .long    SPI_0_1_Handler                    /*  11 SPI 0, 1 interrupt */
 | 
			
		||||
    .long    UART_0_1_2_OVF_Handler             /*  12 UART overflow (0, 1 & 2) interrupt */
 | 
			
		||||
    .long    ETHERNET_Handler                   /*  13 Ethernet interrupt */
 | 
			
		||||
    .long    I2S_Handler                        /*  14 Audio I2S interrupt */
 | 
			
		||||
    .long    TOUCHSCREEN_Handler                /*  15 Touch Screen interrupt */
 | 
			
		||||
    .long    GPIO2_Handler                      /*  16 GPIO 2 combined interrupt */
 | 
			
		||||
    .long    GPIO3_Handler                      /*  17 GPIO 3 combined interrupt */
 | 
			
		||||
    .long    UART3RX_Handler                    /*  18 UART 3 receive interrupt */
 | 
			
		||||
    .long    UART3TX_Handler                    /*  19 UART 3 transmit interrupt */
 | 
			
		||||
    .long    UART4RX_Handler                    /*  20 UART 4 receive interrupt */
 | 
			
		||||
    .long    UART4TX_Handler                    /*  21 UART 4 transmit interrupt */
 | 
			
		||||
    .long    SPI_2_Handler                      /*  22 SPI 2 interrupt */
 | 
			
		||||
    .long    SPI_3_4_Handler                    /*  23 SPI 3, 4 interrupt */
 | 
			
		||||
    .long    GPIO0_0_Handler                    /*  24 GPIO 0 individual interrupt ( 0) */
 | 
			
		||||
    .long    GPIO0_1_Handler                    /*  25 GPIO 0 individual interrupt ( 1) */
 | 
			
		||||
    .long    GPIO0_2_Handler                    /*  26 GPIO 0 individual interrupt ( 2) */
 | 
			
		||||
    .long    GPIO0_3_Handler                    /*  27 GPIO 0 individual interrupt ( 3) */
 | 
			
		||||
    .long    GPIO0_4_Handler                    /*  28 GPIO 0 individual interrupt ( 4) */
 | 
			
		||||
    .long    GPIO0_5_Handler                    /*  29 GPIO 0 individual interrupt ( 5) */
 | 
			
		||||
    .long    GPIO0_6_Handler                    /*  30 GPIO 0 individual interrupt ( 6) */
 | 
			
		||||
    .long    GPIO0_7_Handler                    /*  31 GPIO 0 individual interrupt ( 7) */
 | 
			
		||||
    .long    0                                  /*  32 Reserved */
 | 
			
		||||
    .long    0                                  /*  33 Reserved */
 | 
			
		||||
    .long    0                                  /*  34 Reserved */
 | 
			
		||||
    .long    0                                  /*  35 Reserved */
 | 
			
		||||
    .long    0                                  /*  36 Reserved */
 | 
			
		||||
    .long    0                                  /*  37 Reserved */
 | 
			
		||||
    .long    0                                  /*  38 Reserved */
 | 
			
		||||
    .long    0                                  /*  39 Reserved */
 | 
			
		||||
    .long    0                                  /*  40 Reserved */
 | 
			
		||||
    .long    0                                  /*  41 Reserved */
 | 
			
		||||
    .long    0                                  /*  42 Reserved */
 | 
			
		||||
    .long    0                                  /*  43 Reserved */
 | 
			
		||||
    .long    0                                  /*  44 Reserved */
 | 
			
		||||
    .long    0                                  /*  45 Reserved */
 | 
			
		||||
    .long    0                                  /*  46 Reserved */
 | 
			
		||||
    .long    0                                  /*  47 Reserved */
 | 
			
		||||
    .long    0                                  /*  48 Reserved */
 | 
			
		||||
    .long    0                                  /*  49 Reserved */
 | 
			
		||||
    .long    0                                  /*  50 Reserved */
 | 
			
		||||
    .long    0                                  /*  51 Reserved */
 | 
			
		||||
    .long    0                                  /*  52 Reserved */
 | 
			
		||||
    .long    0                                  /*  53 Reserved */
 | 
			
		||||
    .long    0                                  /*  54 Reserved */
 | 
			
		||||
    .long    0                                  /*  55 Reserved */
 | 
			
		||||
    .long    0                                  /*  56 Reserved */
 | 
			
		||||
    .long    0                                  /*  57 Reserved */
 | 
			
		||||
    .long    0                                  /*  58 Reserved */
 | 
			
		||||
    .long    0                                  /*  59 Reserved */
 | 
			
		||||
    .long    0                                  /*  60 Reserved */
 | 
			
		||||
    .long    0                                  /*  61 Reserved */
 | 
			
		||||
    .long    0                                  /*  62 Reserved */
 | 
			
		||||
    .long    0                                  /*  63 Reserved */
 | 
			
		||||
    .long    0                                  /*  64 Reserved */
 | 
			
		||||
    .long    0                                  /*  65 Reserved */
 | 
			
		||||
    .long    0                                  /*  66 Reserved */
 | 
			
		||||
    .long    0                                  /*  67 Reserved */
 | 
			
		||||
    .long    0                                  /*  68 Reserved */
 | 
			
		||||
    .long    0                                  /*  69 Reserved */
 | 
			
		||||
    .long    0                                  /*  70 Reserved */
 | 
			
		||||
    .long    0                                  /*  71 Reserved */
 | 
			
		||||
    .long    0                                  /*  72 Reserved */
 | 
			
		||||
    .long    0                                  /*  73 Reserved */
 | 
			
		||||
    .long    0                                  /*  74 Reserved */
 | 
			
		||||
    .long    0                                  /*  75 Reserved */
 | 
			
		||||
    .long    0                                  /*  76 Reserved */
 | 
			
		||||
    .long    0                                  /*  77 Reserved */
 | 
			
		||||
    .long    0                                  /*  78 Reserved */
 | 
			
		||||
    .long    0                                  /*  79 Reserved */
 | 
			
		||||
    .long    0                                  /*  80 Reserved */
 | 
			
		||||
    .long    0                                  /*  81 Reserved */
 | 
			
		||||
    .long    0                                  /*  82 Reserved */
 | 
			
		||||
    .long    0                                  /*  83 Reserved */
 | 
			
		||||
    .long    0                                  /*  84 Reserved */
 | 
			
		||||
    .long    0                                  /*  85 Reserved */
 | 
			
		||||
    .long    0                                  /*  86 Reserved */
 | 
			
		||||
    .long    0                                  /*  87 Reserved */
 | 
			
		||||
    .long    0                                  /*  88 Reserved */
 | 
			
		||||
    .long    0                                  /*  89 Reserved */
 | 
			
		||||
    .long    0                                  /*  90 Reserved */
 | 
			
		||||
    .long    0                                  /*  91 Reserved */
 | 
			
		||||
    .long    0                                  /*  92 Reserved */
 | 
			
		||||
    .long    0                                  /*  93 Reserved */
 | 
			
		||||
    .long    0                                  /*  94 Reserved */
 | 
			
		||||
    .long    0                                  /*  95 Reserved */
 | 
			
		||||
    .long    0                                  /*  96 Reserved */
 | 
			
		||||
    .long    0                                  /*  97 Reserved */
 | 
			
		||||
    .long    0                                  /*  98 Reserved */
 | 
			
		||||
    .long    0                                  /*  99 Reserved */
 | 
			
		||||
    .long    0                                  /* 100 Reserved */
 | 
			
		||||
    .long    0                                  /* 101 Reserved */
 | 
			
		||||
    .long    0                                  /* 102 Reserved */
 | 
			
		||||
    .long    0                                  /* 103 Reserved */
 | 
			
		||||
    .long    0                                  /* 104 Reserved */
 | 
			
		||||
    .long    0                                  /* 105 Reserved */
 | 
			
		||||
    .long    0                                  /* 106 Reserved */
 | 
			
		||||
    .long    0                                  /* 107 Reserved */
 | 
			
		||||
    .long    0                                  /* 108 Reserved */
 | 
			
		||||
    .long    0                                  /* 109 Reserved */
 | 
			
		||||
    .long    0                                  /* 110 Reserved */
 | 
			
		||||
    .long    0                                  /* 111 Reserved */
 | 
			
		||||
    .long    0                                  /* 112 Reserved */
 | 
			
		||||
    .long    0                                  /* 113 Reserved */
 | 
			
		||||
    .long    0                                  /* 114 Reserved */
 | 
			
		||||
    .long    0                                  /* 115 Reserved */
 | 
			
		||||
    .long    0                                  /* 116 Reserved */
 | 
			
		||||
    .long    0                                  /* 117 Reserved */
 | 
			
		||||
    .long    0                                  /* 118 Reserved */
 | 
			
		||||
    .long    0                                  /* 119 Reserved */
 | 
			
		||||
    .long    0                                  /* 120 Reserved */
 | 
			
		||||
    .long    0                                  /* 121 Reserved */
 | 
			
		||||
    .long    0                                  /* 122 Reserved */
 | 
			
		||||
    .long    0                                  /* 123 Reserved */
 | 
			
		||||
    .long    0                                  /* 124 Reserved */
 | 
			
		||||
    .long    0                                  /* 125 Reserved */
 | 
			
		||||
    .long    0                                  /* 126 Reserved */
 | 
			
		||||
    .long    0                                  /* 127 Reserved */
 | 
			
		||||
    .long    0                                  /* 128 Reserved */
 | 
			
		||||
    .long    0                                  /* 129 Reserved */
 | 
			
		||||
    .long    0                                  /* 130 Reserved */
 | 
			
		||||
    .long    0                                  /* 131 Reserved */
 | 
			
		||||
    .long    0                                  /* 132 Reserved */
 | 
			
		||||
    .long    0                                  /* 133 Reserved */
 | 
			
		||||
    .long    0                                  /* 134 Reserved */
 | 
			
		||||
    .long    0                                  /* 135 Reserved */
 | 
			
		||||
    .long    0                                  /* 136 Reserved */
 | 
			
		||||
    .long    0                                  /* 137 Reserved */
 | 
			
		||||
    .long    0                                  /* 138 Reserved */
 | 
			
		||||
    .long    0                                  /* 139 Reserved */
 | 
			
		||||
    .long    0                                  /* 140 Reserved */
 | 
			
		||||
    .long    0                                  /* 141 Reserved */
 | 
			
		||||
    .long    0                                  /* 142 Reserved */
 | 
			
		||||
    .long    0                                  /* 143 Reserved */
 | 
			
		||||
    .long    0                                  /* 144 Reserved */
 | 
			
		||||
    .long    0                                  /* 145 Reserved */
 | 
			
		||||
    .long    0                                  /* 146 Reserved */
 | 
			
		||||
    .long    0                                  /* 147 Reserved */
 | 
			
		||||
    .long    0                                  /* 148 Reserved */
 | 
			
		||||
    .long    0                                  /* 149 Reserved */
 | 
			
		||||
    .long    0                                  /* 150 Reserved */
 | 
			
		||||
    .long    0                                  /* 151 Reserved */
 | 
			
		||||
    .long    0                                  /* 152 Reserved */
 | 
			
		||||
    .long    0                                  /* 153 Reserved */
 | 
			
		||||
    .long    0                                  /* 154 Reserved */
 | 
			
		||||
    .long    0                                  /* 155 Reserved */
 | 
			
		||||
    .long    0                                  /* 156 Reserved */
 | 
			
		||||
    .long    0                                  /* 157 Reserved */
 | 
			
		||||
    .long    0                                  /* 158 Reserved */
 | 
			
		||||
    .long    0                                  /* 159 Reserved */
 | 
			
		||||
    .long    0                                  /* 160 Reserved */
 | 
			
		||||
    .long    0                                  /* 161 Reserved */
 | 
			
		||||
    .long    0                                  /* 162 Reserved */
 | 
			
		||||
    .long    0                                  /* 163 Reserved */
 | 
			
		||||
    .long    0                                  /* 164 Reserved */
 | 
			
		||||
    .long    0                                  /* 165 Reserved */
 | 
			
		||||
    .long    0                                  /* 166 Reserved */
 | 
			
		||||
    .long    0                                  /* 167 Reserved */
 | 
			
		||||
    .long    0                                  /* 168 Reserved */
 | 
			
		||||
    .long    0                                  /* 169 Reserved */
 | 
			
		||||
    .long    0                                  /* 170 Reserved */
 | 
			
		||||
    .long    0                                  /* 171 Reserved */
 | 
			
		||||
    .long    0                                  /* 172 Reserved */
 | 
			
		||||
    .long    0                                  /* 173 Reserved */
 | 
			
		||||
    .long    0                                  /* 174 Reserved */
 | 
			
		||||
    .long    0                                  /* 175 Reserved */
 | 
			
		||||
    .long    0                                  /* 176 Reserved */
 | 
			
		||||
    .long    0                                  /* 177 Reserved */
 | 
			
		||||
    .long    0                                  /* 178 Reserved */
 | 
			
		||||
    .long    0                                  /* 179 Reserved */
 | 
			
		||||
    .long    0                                  /* 180 Reserved */
 | 
			
		||||
    .long    0                                  /* 181 Reserved */
 | 
			
		||||
    .long    0                                  /* 182 Reserved */
 | 
			
		||||
    .long    0                                  /* 183 Reserved */
 | 
			
		||||
    .long    0                                  /* 184 Reserved */
 | 
			
		||||
    .long    0                                  /* 185 Reserved */
 | 
			
		||||
    .long    0                                  /* 186 Reserved */
 | 
			
		||||
    .long    0                                  /* 187 Reserved */
 | 
			
		||||
    .long    0                                  /* 188 Reserved */
 | 
			
		||||
    .long    0                                  /* 189 Reserved */
 | 
			
		||||
    .long    0                                  /* 190 Reserved */
 | 
			
		||||
    .long    0                                  /* 191 Reserved */
 | 
			
		||||
    .long    0                                  /* 192 Reserved */
 | 
			
		||||
    .long    0                                  /* 193 Reserved */
 | 
			
		||||
    .long    0                                  /* 194 Reserved */
 | 
			
		||||
    .long    0                                  /* 195 Reserved */
 | 
			
		||||
    .long    0                                  /* 196 Reserved */
 | 
			
		||||
    .long    0                                  /* 197 Reserved */
 | 
			
		||||
    .long    0                                  /* 198 Reserved */
 | 
			
		||||
    .long    0                                  /* 199 Reserved */
 | 
			
		||||
    .long    0                                  /* 200 Reserved */
 | 
			
		||||
    .long    0                                  /* 201 Reserved */
 | 
			
		||||
    .long    0                                  /* 202 Reserved */
 | 
			
		||||
    .long    0                                  /* 203 Reserved */
 | 
			
		||||
    .long    0                                  /* 204 Reserved */
 | 
			
		||||
    .long    0                                  /* 205 Reserved */
 | 
			
		||||
    .long    0                                  /* 206 Reserved */
 | 
			
		||||
    .long    0                                  /* 207 Reserved */
 | 
			
		||||
    .long    0                                  /* 208 Reserved */
 | 
			
		||||
    .long    0                                  /* 209 Reserved */
 | 
			
		||||
    .long    0                                  /* 210 Reserved */
 | 
			
		||||
    .long    0                                  /* 211 Reserved */
 | 
			
		||||
    .long    0                                  /* 212 Reserved */
 | 
			
		||||
    .long    0                                  /* 213 Reserved */
 | 
			
		||||
    .long    0                                  /* 214 Reserved */
 | 
			
		||||
    .long    0                                  /* 215 Reserved */
 | 
			
		||||
    .long    0                                  /* 216 Reserved */
 | 
			
		||||
    .long    0                                  /* 217 Reserved */
 | 
			
		||||
    .long    0                                  /* 218 Reserved */
 | 
			
		||||
    .long    0                                  /* 219 Reserved */
 | 
			
		||||
    .long    0                                  /* 220 Reserved */
 | 
			
		||||
    .long    0                                  /* 221 Reserved */
 | 
			
		||||
    .long    0                                  /* 222 Reserved */
 | 
			
		||||
    .long    0                                  /* 223 Reserved */
 | 
			
		||||
    #if defined CMSDK_CM7_VHT || defined CMSDK_CM7_SP_VHT || defined CMSDK_CM7_DP_VHT
 | 
			
		||||
    .long    ARM_VSI0_Handler                   /* 224 VSI 0 interrupt */
 | 
			
		||||
    .long    ARM_VSI1_Handler                   /* 225 VSI 1 interrupt */
 | 
			
		||||
    .long    ARM_VSI2_Handler                   /* 226 VSI 2 interrupt */
 | 
			
		||||
    .long    ARM_VSI3_Handler                   /* 227 VSI 3 interrupt */
 | 
			
		||||
    .long    ARM_VSI4_Handler                   /* 228 VSI 4 interrupt */
 | 
			
		||||
    .long    ARM_VSI5_Handler                   /* 229 VSI 5 interrupt */
 | 
			
		||||
    .long    ARM_VSI6_Handler                   /* 230 VSI 6 interrupt */
 | 
			
		||||
    .long    ARM_VSI7_Handler                   /* 231 VSI 7 interrupt */
 | 
			
		||||
    #else
 | 
			
		||||
    .long    0                                  /* 224 reserved */
 | 
			
		||||
    .long    0                                  /* 225 reserved */
 | 
			
		||||
    .long    0                                  /* 226 reserved */
 | 
			
		||||
    .long    0                                  /* 227 reserved */
 | 
			
		||||
    .long    0                                  /* 228 reserved */
 | 
			
		||||
    .long    0                                  /* 229 reserved */
 | 
			
		||||
    .long    0                                  /* 230 reserved */
 | 
			
		||||
    .long    0                                  /* 231 reserved */
 | 
			
		||||
    #endif
 | 
			
		||||
    .long    0                                  /* 232 reserved */
 | 
			
		||||
    .long    0                                  /* 233 reserved */
 | 
			
		||||
    .long    0                                  /* 234 reserved */
 | 
			
		||||
    .long    0                                  /* 235 reserved */
 | 
			
		||||
    .long    0                                  /* 236 reserved */
 | 
			
		||||
    .long    0                                  /* 237 reserved */
 | 
			
		||||
    .long    0                                  /* 238 reserved */
 | 
			
		||||
    .long    0                                  /* 239 reserved */
 | 
			
		||||
 | 
			
		||||
    .size    __isr_vector, . - __isr_vector
 | 
			
		||||
 | 
			
		||||
    .text
 | 
			
		||||
    .thumb
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,294 @@
 | 
			
		|||
#
 | 
			
		||||
# Automatically generated file; DO NOT EDIT.
 | 
			
		||||
# XiZi_IIoT Project Configuration
 | 
			
		||||
#
 | 
			
		||||
CONFIG_BOARD_CORTEX_M7_EVB=y
 | 
			
		||||
CONFIG_ARCH_ARM=y
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# xidatong-arm32 feature
 | 
			
		||||
#
 | 
			
		||||
CONFIG_BSP_USING_LPUART=y
 | 
			
		||||
CONFIG_BSP_USING_LPUART1=y
 | 
			
		||||
CONFIG_SERIAL_BUS_NAME_1="uart1"
 | 
			
		||||
CONFIG_SERIAL_DRV_NAME_1="uart1_drv"
 | 
			
		||||
CONFIG_SERIAL_1_DEVICE_NAME_0="uart1_dev1"
 | 
			
		||||
CONFIG_BSP_USING_LPUART2=y
 | 
			
		||||
CONFIG_SERIAL_BUS_NAME_2="uart2"
 | 
			
		||||
CONFIG_SERIAL_DRV_NAME_2="uart2_drv"
 | 
			
		||||
CONFIG_SERIAL_2_DEVICE_NAME_0="uart2_dev2"
 | 
			
		||||
CONFIG_BSP_USING_LPUART3=y
 | 
			
		||||
CONFIG_SERIAL_BUS_NAME_3="uart3"
 | 
			
		||||
CONFIG_SERIAL_DRV_NAME_3="uart3_drv"
 | 
			
		||||
CONFIG_SERIAL_3_DEVICE_NAME_0="uart3_dev3"
 | 
			
		||||
# CONFIG_BSP_USING_LPUART4 is not set
 | 
			
		||||
# CONFIG_BSP_USING_LPUART8 is not set
 | 
			
		||||
# CONFIG_BSP_USING_CH438 is not set
 | 
			
		||||
CONFIG_BSP_USING_GPIO=y
 | 
			
		||||
CONFIG_PIN_BUS_NAME="pin"
 | 
			
		||||
CONFIG_PIN_DRIVER_NAME="pin_drv"
 | 
			
		||||
CONFIG_PIN_DEVICE_NAME="pin_dev"
 | 
			
		||||
# CONFIG_BSP_USING_I2C is not set
 | 
			
		||||
# CONFIG_BSP_USING_LWIP is not set
 | 
			
		||||
# CONFIG_BSP_USING_SEMC is not set
 | 
			
		||||
# CONFIG_BSP_USING_SDIO is not set
 | 
			
		||||
# CONFIG_BSP_USING_LCD is not set
 | 
			
		||||
# CONFIG_BSP_USING_TOUCH is not set
 | 
			
		||||
# CONFIG_BSP_USING_USB is not set
 | 
			
		||||
# CONFIG_BSP_USING_WDT is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# config default board resources
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# config board app name
 | 
			
		||||
#
 | 
			
		||||
CONFIG_BOARD_APP_NAME="/XiUOS_xidatong_app.bin"
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# config board service table
 | 
			
		||||
#
 | 
			
		||||
CONFIG_SERVICE_TABLE_ADDRESS=0x2007F0000
 | 
			
		||||
CONFIG___STACKSIZE__=4096
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# config board peripheral
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_MOUNT_SDCARD is not set
 | 
			
		||||
# CONFIG_MOUNT_USB is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Hardware feature
 | 
			
		||||
#
 | 
			
		||||
CONFIG_RESOURCES_SERIAL=y
 | 
			
		||||
CONFIG_SERIAL_USING_DMA=y
 | 
			
		||||
CONFIG_SERIAL_RB_BUFSZ=128
 | 
			
		||||
CONFIG_RESOURCES_PIN=y
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Kernel feature
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# separate compile(choose none for compile once)
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_SEPARATE_COMPILE is not set
 | 
			
		||||
# CONFIG_COMPILER_APP is not set
 | 
			
		||||
# CONFIG_APP_STARTUP_FROM_SDCARD is not set
 | 
			
		||||
CONFIG_APP_STARTUP_FROM_FLASH=y
 | 
			
		||||
# CONFIG_COMPILER_KERNEL is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Memory Management
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_KERNEL_MEMBLOCK is not set
 | 
			
		||||
CONFIG_MEM_ALIGN_SIZE=8
 | 
			
		||||
# CONFIG_MEM_EXTERN_SRAM is not set
 | 
			
		||||
CONFIG_MM_PAGE_SIZE=4096
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Using small memory allocator
 | 
			
		||||
#
 | 
			
		||||
CONFIG_KERNEL_SMALL_MEM_ALLOC=y
 | 
			
		||||
CONFIG_SMALL_NUMBER_32B=64
 | 
			
		||||
CONFIG_SMALL_NUMBER_64B=32
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Task feature
 | 
			
		||||
#
 | 
			
		||||
CONFIG_USER_APPLICATION=y
 | 
			
		||||
# CONFIG_TASK_ISOLATION is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Inter-Task communication
 | 
			
		||||
#
 | 
			
		||||
CONFIG_KERNEL_SEMAPHORE=y
 | 
			
		||||
CONFIG_KERNEL_MUTEX=y
 | 
			
		||||
CONFIG_KERNEL_EVENT=y
 | 
			
		||||
CONFIG_KERNEL_MESSAGEQUEUE=y
 | 
			
		||||
# CONFIG_KERNEL_SOFTTIMER is not set
 | 
			
		||||
CONFIG_SCHED_POLICY_RR_REMAINSLICE=y
 | 
			
		||||
# CONFIG_SCHED_POLICY_RR is not set
 | 
			
		||||
# CONFIG_SCHED_POLICY_FIFO is not set
 | 
			
		||||
# CONFIG_KTASK_PRIORITY_8 is not set
 | 
			
		||||
CONFIG_KTASK_PRIORITY_32=y
 | 
			
		||||
# CONFIG_KTASK_PRIORITY_256 is not set
 | 
			
		||||
CONFIG_KTASK_PRIORITY_MAX=32
 | 
			
		||||
CONFIG_TICK_PER_SECOND=1000
 | 
			
		||||
CONFIG_KERNEL_STACK_OVERFLOW_CHECK=y
 | 
			
		||||
CONFIG_IDLE_KTASK_STACKSIZE=1024
 | 
			
		||||
CONFIG_ZOMBIE_KTASK_STACKSIZE=2048
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Kernel Console
 | 
			
		||||
#
 | 
			
		||||
CONFIG_KERNEL_CONSOLE=y
 | 
			
		||||
CONFIG_KERNEL_BANNER=y
 | 
			
		||||
CONFIG_KERNEL_CONSOLEBUF_SIZE=128
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Kernel Hook
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_KERNEL_HOOK is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Command shell
 | 
			
		||||
#
 | 
			
		||||
CONFIG_TOOL_SHELL=y
 | 
			
		||||
CONFIG_SHELL_ENTER_CR=y
 | 
			
		||||
CONFIG_SHELL_ENTER_LF=y
 | 
			
		||||
CONFIG_SHELL_ENTER_CR_AND_LF=y
 | 
			
		||||
# CONFIG_SHELL_ENTER_CRLF is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Set shell user control
 | 
			
		||||
#
 | 
			
		||||
CONFIG_SHELL_DEFAULT_USER="letter"
 | 
			
		||||
CONFIG_SHELL_DEFAULT_USER_PASSWORD=""
 | 
			
		||||
CONFIG_SHELL_LOCK_TIMEOUT=10000
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Set shell config param
 | 
			
		||||
#
 | 
			
		||||
CONFIG_SHELL_TASK_STACK_SIZE=4096
 | 
			
		||||
CONFIG_SHELL_TASK_PRIORITY=20
 | 
			
		||||
CONFIG_SHELL_MAX_NUMBER=5
 | 
			
		||||
CONFIG_SHELL_PARAMETER_MAX_NUMBER=8
 | 
			
		||||
CONFIG_SHELL_HISTORY_MAX_NUMBER=5
 | 
			
		||||
CONFIG_SHELL_PRINT_BUFFER=128
 | 
			
		||||
CONFIG_SHELL_HELP_SHOW_PERMISSION=y
 | 
			
		||||
# CONFIG_SHELL_HELP_LIST_USER is not set
 | 
			
		||||
CONFIG_SHELL_HELP_LIST_VAR=y
 | 
			
		||||
# CONFIG_SHELL_HELP_LIST_KEY is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Kernel data structure Manage
 | 
			
		||||
#
 | 
			
		||||
CONFIG_KERNEL_QUEUEMANAGE=y
 | 
			
		||||
CONFIG_KERNEL_WORKQUEUE=y
 | 
			
		||||
CONFIG_WORKQUEUE_KTASK_STACKSIZE=2048
 | 
			
		||||
CONFIG_WORKQUEUE_KTASK_PRIORITY=23
 | 
			
		||||
CONFIG_QUEUE_MAX=16
 | 
			
		||||
CONFIG_KERNEL_WAITQUEUE=y
 | 
			
		||||
CONFIG_KERNEL_DATAQUEUE=y
 | 
			
		||||
# CONFIG_KERNEL_CIRCULAR_AREA is not set
 | 
			
		||||
# CONFIG_KERNEL_AVL_TREE is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Kernel components init
 | 
			
		||||
#
 | 
			
		||||
CONFIG_KERNEL_COMPONENTS_INIT=y
 | 
			
		||||
CONFIG_ENV_INIT_KTASK_STACK_SIZE=8192
 | 
			
		||||
CONFIG_KERNEL_USER_MAIN=y
 | 
			
		||||
CONFIG_NAME_NUM_MAX=32
 | 
			
		||||
# CONFIG_KERNEL_DEBUG is not set
 | 
			
		||||
# CONFIG_ARCH_SMP is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# hash table config
 | 
			
		||||
#
 | 
			
		||||
CONFIG_ID_HTABLE_SIZE=16
 | 
			
		||||
CONFIG_ID_NUM_MAX=128
 | 
			
		||||
# CONFIG_KERNEL_TEST is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Lib
 | 
			
		||||
#
 | 
			
		||||
CONFIG_LIB=y
 | 
			
		||||
CONFIG_LIB_POSIX=y
 | 
			
		||||
CONFIG_LIB_NEWLIB=y
 | 
			
		||||
# CONFIG_LIB_MUSLLIB is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# C++ features
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_LIB_CPLUSPLUS is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# File system
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_FS_VFS=y
 | 
			
		||||
# CONFIG_VFS_USING_WORKDIR=y
 | 
			
		||||
# CONFIG_FS_VFS_DEVFS=y
 | 
			
		||||
# CONFIG_FS_VFS_FATFS=y
 | 
			
		||||
# CONFIG_FS_CH376 is not set
 | 
			
		||||
# CONFIG_FS_LWEXT4 is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# APP_Framework
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Framework
 | 
			
		||||
#
 | 
			
		||||
CONFIG_TRANSFORM_LAYER_ATTRIUBUTE=y
 | 
			
		||||
CONFIG_ADD_XIZI_FEATURES=y
 | 
			
		||||
# CONFIG_ADD_NUTTX_FEATURES is not set
 | 
			
		||||
# CONFIG_ADD_RTTHREAD_FEATURES is not set
 | 
			
		||||
# CONFIG_SUPPORT_SENSOR_FRAMEWORK is not set
 | 
			
		||||
# CONFIG_SUPPORT_CONNECTION_FRAMEWORK is not set
 | 
			
		||||
# CONFIG_SUPPORT_KNOWING_FRAMEWORK is not set
 | 
			
		||||
# CONFIG_SUPPORT_CONTROL_FRAMEWORK is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Security
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_CRYPTO is not set
 | 
			
		||||
# CONFIG_MBEDTLS is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Applications
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# config stack size and priority of main task
 | 
			
		||||
#
 | 
			
		||||
CONFIG_MAIN_KTASK_STACK_SIZE=4096
 | 
			
		||||
CONFIG_MAIN_KTASK_PRIORITY=16
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# ota app 
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_APPLICATION_OTA is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# test app
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_USER_TEST is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# connection app
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_APPLICATION_CONNECTION is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# control app
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# knowing app
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_APPLICATION_KNOWING is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# sensor app
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_APPLICATION_SENSOR is not set
 | 
			
		||||
# CONFIG_USING_EMBEDDED_DATABASE_APP is not set
 | 
			
		||||
# CONFIG_APP_USING_WEBNET is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# lib
 | 
			
		||||
#
 | 
			
		||||
CONFIG_APP_SELECT_NEWLIB=y
 | 
			
		||||
# CONFIG_APP_SELECT_OTHER_LIB is not set
 | 
			
		||||
# CONFIG_LIB_USING_CJSON is not set
 | 
			
		||||
# CONFIG_LIB_USING_QUEUE is not set
 | 
			
		||||
# CONFIG_LIB_LV is not set
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# LVGL configuration
 | 
			
		||||
#
 | 
			
		||||
# CONFIG_LV_CONF_MINIMAL is not set
 | 
			
		||||
# CONFIG_USING_EMBEDDED_DATABASE is not set
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,61 @@
 | 
			
		|||
mainmenu "XiZi_IIoT Project Configuration"
 | 
			
		||||
 | 
			
		||||
config BSP_DIR
 | 
			
		||||
    string
 | 
			
		||||
    option env="BSP_ROOT"
 | 
			
		||||
    default "."
 | 
			
		||||
 | 
			
		||||
config KERNEL_DIR
 | 
			
		||||
    string
 | 
			
		||||
    option env="KERNEL_ROOT"
 | 
			
		||||
    default "../.."
 | 
			
		||||
 | 
			
		||||
config BOARD_CORTEX_V2M_EVB
 | 
			
		||||
    bool
 | 
			
		||||
    select  ARCH_ARM
 | 
			
		||||
    default y
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
source "$KERNEL_DIR/arch/Kconfig"
 | 
			
		||||
 | 
			
		||||
menu "cortex-m7-emulator feature"
 | 
			
		||||
    source "$BSP_DIR/third_party_driver/Kconfig"
 | 
			
		||||
    
 | 
			
		||||
    menu "config default board resources"
 | 
			
		||||
        menu "config board app name"
 | 
			
		||||
            config BOARD_APP_NAME
 | 
			
		||||
                string "config board app name"
 | 
			
		||||
                default "/XiUOS_cortex-m7-emulator_app.bin"
 | 
			
		||||
        endmenu
 | 
			
		||||
 | 
			
		||||
        menu "config board service table"
 | 
			
		||||
            config SERVICE_TABLE_ADDRESS
 | 
			
		||||
                hex "board service table address"
 | 
			
		||||
                default 0x20000000
 | 
			
		||||
        endmenu
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
    endmenu
 | 
			
		||||
 | 
			
		||||
    config __STACKSIZE__
 | 
			
		||||
        int "stack size for interrupt"
 | 
			
		||||
        default 4096
 | 
			
		||||
 | 
			
		||||
    menu "config board peripheral"
 | 
			
		||||
        config MOUNT_SDCARD
 | 
			
		||||
            bool
 | 
			
		||||
            default n
 | 
			
		||||
        config MOUNT_USB
 | 
			
		||||
            bool
 | 
			
		||||
            default n
 | 
			
		||||
    endmenu
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
endmenu
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
menu "Hardware feature"
 | 
			
		||||
source "$KERNEL_DIR/resources/Kconfig"
 | 
			
		||||
endmenu
 | 
			
		||||
 | 
			
		||||
source "$KERNEL_DIR/Kconfig"
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
SRC_FILES := board.c
 | 
			
		||||
 | 
			
		||||
SRC_DIR := third_party_driver
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,208 @@
 | 
			
		|||
# 从零开始构建矽璓工业物联操作系统:使用ARM架构的cortex-m7 emulator
 | 
			
		||||
 | 
			
		||||
[XiUOS](http://xuos.io/) (X Industrial Ubiquitous Operating System) 矽璓XiUOS是一款面向智慧车间的工业物联网操作系统,主要由一个极简的微型实时操作系统内核和其上的工业物联框架构成,通过高效管理工业物联网设备、支撑工业物联应用,在生产车间内实现智能化的“感知环境、联网传输、知悉识别、控制调整”,促进以工业设备和工业控制系统为核心的人、机、物深度互联,帮助提升生产线的数字化和智能化水平。
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## 1. 简介
 | 
			
		||||
 | 
			
		||||
QEMU 是一个通用的开源模拟器和虚拟化工具。目前QEMU已经可以较完整的支持ARM cortex-m4架构。XiUOS同样支持运行在QEMU上
 | 
			
		||||
 | 
			
		||||
| 硬件     | 描述          |
 | 
			
		||||
| -------- | ------------- |
 | 
			
		||||
| 芯片型号 | mps2-an500 |
 | 
			
		||||
| 架构     | cortex-m7     |
 | 
			
		||||
| 主频     | 168MHz        |
 | 
			
		||||
| 片内SRAM | 100+KB        |
 | 
			
		||||
| 外设支持 | UART、GPIO    |
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## 2. 开发环境搭建
 | 
			
		||||
 | 
			
		||||
### 推荐使用:
 | 
			
		||||
 | 
			
		||||
**操作系统:** ubuntu18.04 [https://ubuntu.com/download/desktop](https://ubuntu.com/download/desktop)
 | 
			
		||||
 | 
			
		||||
更新`ubuntu 18.04`源的方法:(根据自身情况而定,可以不更改)
 | 
			
		||||
 | 
			
		||||
第一步:打开sources.list文件
 | 
			
		||||
 | 
			
		||||
```c
 | 
			
		||||
sudo vim /etc/apt/sources.list
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
第二步:将以下内容复制到sources.list文件
 | 
			
		||||
 | 
			
		||||
```c
 | 
			
		||||
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
 | 
			
		||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
 | 
			
		||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
 | 
			
		||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
 | 
			
		||||
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
 | 
			
		||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
 | 
			
		||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
 | 
			
		||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
 | 
			
		||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
 | 
			
		||||
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
第三步:更新源和系统软件
 | 
			
		||||
 | 
			
		||||
```c
 | 
			
		||||
sudo apt-get update
 | 
			
		||||
sudo apt-get upgrade
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**开发工具推荐使用 VSCode   ,VScode下载地址为:** VSCode  [https://code.visualstudio.com/](https://code.visualstudio.com/),推荐下载地址为 [http://vscode.cdn.azure.cn/stable/3c4e3df9e89829dce27b7b5c24508306b151f30d/code_1.55.2-1618307277_amd64.deb](http://vscode.cdn.azure.cn/stable/3c4e3df9e89829dce27b7b5c24508306b151f30d/code_1.55.2-1618307277_amd64.deb)
 | 
			
		||||
 | 
			
		||||
### 依赖包安装:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
$ sudo apt install build-essential pkg-config  git
 | 
			
		||||
$ sudo apt install gcc make libncurses5-dev openssl libssl-dev bison flex libelf-dev autoconf libtool gperf libc6-dev
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
**XiUOS操作系统源码下载:** XiUOS [https://www.gitlink.org.cn/xuos/xiuos](https://www.gitlink.org.cn/xuos/xiuos)
 | 
			
		||||
 | 
			
		||||
新建一个空文件夹并进入文件夹中,并下载源码,具体命令如下:
 | 
			
		||||
 | 
			
		||||
```c
 | 
			
		||||
mkdir test  &&  cd test
 | 
			
		||||
git clone https://gitlink.org.cn/xuos/xiuos.git
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
1、打开XiUOS源码文件包可以看到以下目录:
 | 
			
		||||
| 名称 | 说明 |
 | 
			
		||||
| -- | -- |
 | 
			
		||||
| APP_Framework | 应用代码 |
 | 
			
		||||
| Ubiquitous | 板级支持包,支持NuttX、RT-Thread和XiZi内核 |
 | 
			
		||||
 | 
			
		||||
2、打开XiZi内核源码文件包可以看到以下目录:
 | 
			
		||||
| 名称 | 说明 |
 | 
			
		||||
| -- | -- |
 | 
			
		||||
| arch | 架构代码 |
 | 
			
		||||
| board | 板级支持包 |
 | 
			
		||||
| fs | 文件系统 |
 | 
			
		||||
| kernel | 内核源码 |
 | 
			
		||||
| lib | 第三方库源码 |
 | 
			
		||||
| resources | 驱动文件 |
 | 
			
		||||
| tool | 系统工具 |
 | 
			
		||||
 | 
			
		||||
使用VScode打开代码,具体操作步骤为:在源码文件夹下打开系统终端,输入`code .`即可打开VScode开发环境,如下图所示:
 | 
			
		||||
 | 
			
		||||
<div align= "center">
 | 
			
		||||
<img src="img/vscode.jpg"  width =1000>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
### 裁减配置工具的下载
 | 
			
		||||
 | 
			
		||||
裁减配置工具:
 | 
			
		||||
 | 
			
		||||
**工具地址:** kconfig-frontends [https://www.gitlink.org.cn/xuos/kconfig-frontends](https://www.gitlink.org.cn/xuos/kconfig-frontends),下载与安装的具体命令如下:
 | 
			
		||||
 | 
			
		||||
```c
 | 
			
		||||
mkdir kfrontends  && cd kfrontends
 | 
			
		||||
git clone https://gitlink.org.cn/xuos/kconfig-frontends.git
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
下载源码后按以下步骤执行软件安装:
 | 
			
		||||
 | 
			
		||||
```c
 | 
			
		||||
cd kconfig-frontends
 | 
			
		||||
./xs_build.sh
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### 编译工具链:
 | 
			
		||||
 | 
			
		||||
ARM: arm-none-eabi(`gcc version 6.3.1`),默认安装到Ubuntu的/usr/bin/arm-none-eabi-,使用如下命令行下载和安装。
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
$ sudo apt install gcc-arm-none-eabi
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## 3. 编译说明
 | 
			
		||||
 | 
			
		||||
### 编辑环境:`Ubuntu18.04`
 | 
			
		||||
 | 
			
		||||
### 编译工具链:`arm-none-eabi-gcc`
 | 
			
		||||
 | 
			
		||||
使用`VScode`打开工程的方法有多种,本文介绍一种快捷键,在项目目录下将`code .`输入linux系统命令终端即可打开目标项目
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
编译步骤:
 | 
			
		||||
 | 
			
		||||
1.在VScode命令终端中执行以下命令,生成配置文件
 | 
			
		||||
 | 
			
		||||
```c
 | 
			
		||||
cd ./Ubiquitous/XiZi
 | 
			
		||||
make BOARD=cortex-m7-emulator distclean
 | 
			
		||||
make BOARD=cortex-m7-emulator menuconfig
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
2.在menuconfig界面配置需要关闭和开启的功能,按回车键进入下级菜单,按Y键选中需要开启的功能,按N键选中需要关闭的功能,配置结束后保存并退出(本例旨在演示简单的输出例程,所以没有需要配置的选项,双击快捷键ESC退出配置)
 | 
			
		||||
 | 
			
		||||
<div align= "center">
 | 
			
		||||
<img src="img/menuconfig.png"  width =1000>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
退出时选择`yes`保存上面所配置的内容,如下图所示:
 | 
			
		||||
 | 
			
		||||
<div align= "center">
 | 
			
		||||
<img src="img/menuconfig1.png"  width =1000>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
3.继续执行以下命令,进行编译
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
make BOARD=cortex-m7-emulator
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
4.如果编译正确无误,会产生XiZi-cortex-m7-emulator.elf、XiZi-cortex-m7-emulator.bin文件。
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## 4. 运行
 | 
			
		||||
 | 
			
		||||
### 4.1 安装QEMU
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo apt install qemu-system-arm
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### 4.2 运行结果
 | 
			
		||||
 | 
			
		||||
通过以下命令启动QEMU并加载XiUOS ELF文件
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
qemu-system-arm -machine mps2-an500 -nographic -kernel build/XiZi-cortex-m7-emulator.elf
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
QEMU运行起来后将会在终端上看到信息打印输出
 | 
			
		||||
 | 
			
		||||
<div align= "center">
 | 
			
		||||
<img src="img/terminal.png"  width =1000>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
### 4.3 调试
 | 
			
		||||
 | 
			
		||||
通过QEMU可以方便的对XiUOS进行调试,首先安装gdb调试工具
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
sudo apt install gdb-multiarch
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
并通过以下命令启动QEMU
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
qemu-system-arm -machine mps2-an500 -nographic -kernel build/XiZi-cortex-m7-emulator.elf -s -S
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
然后要重新开启另一个linux系统终端一个终端,执行`riscv-none-embed-gdb`命令
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
gdb-multiarch build/XiZi-cortex-m7-emulator.elf -ex "target remote localhost:1234"
 | 
			
		||||
```
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,202 @@
 | 
			
		|||
/*
 | 
			
		||||
* Copyright (c) 2020 AIIT XUOS Lab
 | 
			
		||||
* XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
* You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
*        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
* See the Mulan PSL v2 for more details.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file board.c
 | 
			
		||||
* @brief support cortex-m7-emulator-board init configure and start-up
 | 
			
		||||
* @version 1.0 
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2023-09-27
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*************************************************
 | 
			
		||||
File name: board.c
 | 
			
		||||
Description: support cortex-m7-emulator-board init configure and driver/task/... init
 | 
			
		||||
Others: 
 | 
			
		||||
History: 
 | 
			
		||||
1. Date: 2023-09-27
 | 
			
		||||
Author: AIIT XUOS Lab
 | 
			
		||||
Modification: 
 | 
			
		||||
1. support cortex-m7-emulator-board InitBoardHardware
 | 
			
		||||
*************************************************/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "board.h"
 | 
			
		||||
#include "clock_config.h"
 | 
			
		||||
#include <device.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef BSP_USING_LPUART
 | 
			
		||||
#include <connect_uart.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef BSP_USING_GPIO
 | 
			
		||||
#include <connect_gpio.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern uint32_t SystemCoreClock;
 | 
			
		||||
/* MPU configuration. */
 | 
			
		||||
void BOARD_ConfigMPU(void)
 | 
			
		||||
{
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    /* Disable MPU */
 | 
			
		||||
    ARM_MPU_Disable();
 | 
			
		||||
 | 
			
		||||
    /* MPU configure:
 | 
			
		||||
     * Use ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable,
 | 
			
		||||
     * SubRegionDisable, Size)
 | 
			
		||||
     * API in mpu_armv7.h.
 | 
			
		||||
     * param DisableExec       Instruction access (XN) disable bit,0=instruction fetches enabled, 1=instruction fetches
 | 
			
		||||
     * disabled.
 | 
			
		||||
     * param AccessPermission  Data access permissions, allows you to configure read/write access for User and
 | 
			
		||||
     * Privileged mode.
 | 
			
		||||
     *      Use MACROS defined in mpu_armv7.h:
 | 
			
		||||
     * ARM_MPU_AP_NONE/ARM_MPU_AP_PRIV/ARM_MPU_AP_URO/ARM_MPU_AP_FULL/ARM_MPU_AP_PRO/ARM_MPU_AP_RO
 | 
			
		||||
     * Combine TypeExtField/IsShareable/IsCacheable/IsBufferable to configure MPU memory access attributes.
 | 
			
		||||
     *  TypeExtField  IsShareable  IsCacheable  IsBufferable   Memory Attribtue    Shareability        Cache
 | 
			
		||||
     *     0             x           0           0             Strongly Ordered    shareable
 | 
			
		||||
     *     0             x           0           1              Device             shareable
 | 
			
		||||
     *     0             0           1           0              Normal             not shareable   Outer and inner write
 | 
			
		||||
     * through no write allocate
 | 
			
		||||
     *     0             0           1           1              Normal             not shareable   Outer and inner write
 | 
			
		||||
     * back no write allocate
 | 
			
		||||
     *     0             1           1           0              Normal             shareable       Outer and inner write
 | 
			
		||||
     * through no write allocate
 | 
			
		||||
     *     0             1           1           1              Normal             shareable       Outer and inner write
 | 
			
		||||
     * back no write allocate
 | 
			
		||||
     *     1             0           0           0              Normal             not shareable   outer and inner
 | 
			
		||||
     * noncache
 | 
			
		||||
     *     1             1           0           0              Normal             shareable       outer and inner
 | 
			
		||||
     * noncache
 | 
			
		||||
     *     1             0           1           1              Normal             not shareable   outer and inner write
 | 
			
		||||
     * back write/read acllocate
 | 
			
		||||
     *     1             1           1           1              Normal             shareable       outer and inner write
 | 
			
		||||
     * back write/read acllocate
 | 
			
		||||
     *     2             x           0           0              Device              not shareable
 | 
			
		||||
     *  Above are normal use settings, if your want to see more details or want to config different inner/outter cache
 | 
			
		||||
     * policy.
 | 
			
		||||
     *  please refer to Table 4-55 /4-56 in arm cortex-M7 generic user guide <dui0646b_cortex_m7_dgug.pdf>
 | 
			
		||||
     * param SubRegionDisable  Sub-region disable field. 0=sub-region is enabled, 1=sub-region is disabled.
 | 
			
		||||
     * param Size              Region size of the region to be configured. use ARM_MPU_REGION_SIZE_xxx MACRO in
 | 
			
		||||
     * mpu_armv7.h.
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
    // /* Region 0 setting: Memory with Device type, not shareable, non-cacheable. */
 | 
			
		||||
    // MPU->RBAR = ARM_MPU_RBAR(0, 0xC0000000U);
 | 
			
		||||
    // MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB);
 | 
			
		||||
 | 
			
		||||
    /* Region 1 setting: Memory with Device type, not shareable,  non-cacheable. */
 | 
			
		||||
    MPU->RBAR = ARM_MPU_RBAR(0, 0x20000000U);
 | 
			
		||||
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_256MB);
 | 
			
		||||
 | 
			
		||||
/* Region 2 setting */
 | 
			
		||||
#if defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)
 | 
			
		||||
    /* Setting Memory with Normal type, not shareable, outer/inner write back. */
 | 
			
		||||
    MPU->RBAR = ARM_MPU_RBAR(2, 0x60000000U);
 | 
			
		||||
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_RO, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_64MB);
 | 
			
		||||
#else
 | 
			
		||||
    /* Setting Memory with Device type, not shareable, non-cacheable. */
 | 
			
		||||
    MPU->RBAR = ARM_MPU_RBAR(1, 0x20000000U);
 | 
			
		||||
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_RO, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_64MB);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    /* Region 3 setting: Memory with Device type, not shareable, non-cacheable. */
 | 
			
		||||
    MPU->RBAR = ARM_MPU_RBAR(2, 0x00000000U);
 | 
			
		||||
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);
 | 
			
		||||
 | 
			
		||||
    /* Region 4 setting: Memory with Normal type, not shareable, outer/inner write back */
 | 
			
		||||
    MPU->RBAR = ARM_MPU_RBAR(3, 0x00000000U);
 | 
			
		||||
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB);
 | 
			
		||||
 | 
			
		||||
    /* Region 5 setting: Memory with Normal type, not shareable, outer/inner write back */
 | 
			
		||||
    MPU->RBAR = ARM_MPU_RBAR(4, 0x20000000U);
 | 
			
		||||
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_128KB);
 | 
			
		||||
 | 
			
		||||
    /* Region 6 setting: Memory with Normal type, not shareable, outer/inner write back */
 | 
			
		||||
    MPU->RBAR = ARM_MPU_RBAR(5, 0x20200000U);
 | 
			
		||||
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_256KB);
 | 
			
		||||
 | 
			
		||||
/* The define sets the cacheable memory to shareable,
 | 
			
		||||
 * this suggestion is referred from chapter 2.2.1 Memory regions,
 | 
			
		||||
 * types and attributes in Cortex-M7 Devices, Generic User Guide */
 | 
			
		||||
#if defined(SDRAM_IS_SHAREABLE)
 | 
			
		||||
    /* Region 7 setting: Memory with Normal type, shareable, outer/inner write back */
 | 
			
		||||
    MPU->RBAR = ARM_MPU_RBAR(7, 0x80000000U);
 | 
			
		||||
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 1, 1, 1, 0, ARM_MPU_REGION_SIZE_32MB);
 | 
			
		||||
#else
 | 
			
		||||
    /* Region 7 setting: Memory with Normal type, not shareable, outer/inner write back */
 | 
			
		||||
    MPU->RBAR = ARM_MPU_RBAR(6, 0x21000000U);
 | 
			
		||||
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_2MB);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    /* Region 8 setting, set last 2MB of SDRAM can't be accessed by cache, glocal variables which are not expected to be
 | 
			
		||||
     * accessed by cache can be put here */
 | 
			
		||||
    /* Memory with Normal type, not shareable, non-cacheable */
 | 
			
		||||
    MPU->RBAR = ARM_MPU_RBAR(7, 0x21200000U);
 | 
			
		||||
    MPU->RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 1, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_2MB);
 | 
			
		||||
 | 
			
		||||
    /* Enable MPU */
 | 
			
		||||
    ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk);
 | 
			
		||||
 | 
			
		||||
    /* Enable I cache and D cache */
 | 
			
		||||
    SCB_EnableDCache();
 | 
			
		||||
    SCB_EnableICache();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* This is the timer interrupt service routine. */
 | 
			
		||||
void SysTick_Handler(int irqn, void *arg)
 | 
			
		||||
{
 | 
			
		||||
    TickAndTaskTimesliceUpdate();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void InitBoardHardware()
 | 
			
		||||
{
 | 
			
		||||
    int i = 0;
 | 
			
		||||
    int ret = 0;
 | 
			
		||||
 | 
			
		||||
    BOARD_ConfigMPU();
 | 
			
		||||
    // BOARD_InitPins();
 | 
			
		||||
    BOARD_BootClockRUN();
 | 
			
		||||
 | 
			
		||||
    NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4);
 | 
			
		||||
    SysTick_Config(SystemCoreClock / TICK_PER_SECOND);
 | 
			
		||||
 | 
			
		||||
    InitBoardMemory((void *)HEAP_BEGIN, (void *)HEAP_END);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef BSP_USING_LPUART
 | 
			
		||||
    Imxrt1052HwUartInit();
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    InstallConsole(KERNEL_CONSOLE_BUS_NAME, KERNEL_CONSOLE_DRV_NAME, KERNEL_CONSOLE_DEVICE_NAME);
 | 
			
		||||
    KPrintf("0");
 | 
			
		||||
    KPrintf("\nconsole init completed.\n");
 | 
			
		||||
    KPrintf("board initialization......\n");
 | 
			
		||||
 | 
			
		||||
    // for(i = 0; _board_init[i].fn != NONE; i++) {
 | 
			
		||||
    //     ret = _board_init[i].fn();
 | 
			
		||||
    //     KPrintf("initialize %s %s\n",_board_init[i].fn_name, ret == 0 ? "success" : "failed");
 | 
			
		||||
    // }
 | 
			
		||||
    KPrintf("board init done.\n");
 | 
			
		||||
    KPrintf("start kernel...\n");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,64 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2017-2018 NXP
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: BSD-3-Clause
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file board.h
 | 
			
		||||
* @brief definecortex-m7-emulator init configure and start-up function
 | 
			
		||||
* @version 1.0
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2021-05-28
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*************************************************
 | 
			
		||||
File name: board.h
 | 
			
		||||
Description: define cortex-m7-emulator init function and struct
 | 
			
		||||
Others:
 | 
			
		||||
History:
 | 
			
		||||
1. Date: 2023-09-27
 | 
			
		||||
Author: AIIT XUOS Lab
 | 
			
		||||
Modification:
 | 
			
		||||
1. define imxrt-board InitBoardHardware
 | 
			
		||||
2. define imxrt-board heap struct
 | 
			
		||||
*************************************************/
 | 
			
		||||
 | 
			
		||||
#ifndef __BOARD_H__
 | 
			
		||||
#define __BOARD_H__
 | 
			
		||||
 | 
			
		||||
#define M7_EMULATOR
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
#include <xizi.h>
 | 
			
		||||
#include <arch_interrupt.h>
 | 
			
		||||
#include "fsl_common.h"
 | 
			
		||||
#include "xsconfig.h"
 | 
			
		||||
 | 
			
		||||
#define NVIC_PRIORITYGROUP_0         0x00000007U /*!< 0 bits for pre-emption priority
 | 
			
		||||
                                                      4 bits for subpriority */
 | 
			
		||||
#define NVIC_PRIORITYGROUP_1         0x00000006U /*!< 1 bits for pre-emption priority
 | 
			
		||||
                                                      3 bits for subpriority */
 | 
			
		||||
#define NVIC_PRIORITYGROUP_2         0x00000005U /*!< 2 bits for pre-emption priority
 | 
			
		||||
                                                      2 bits for subpriority */
 | 
			
		||||
#define NVIC_PRIORITYGROUP_3         0x00000004U /*!< 3 bits for pre-emption priority
 | 
			
		||||
                                                      1 bits for subpriority */
 | 
			
		||||
#define NVIC_PRIORITYGROUP_4         0x00000003U /*!< 4 bits for pre-emption priority*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
extern int heap_start;
 | 
			
		||||
extern int heap_end;
 | 
			
		||||
#define HEAP_BEGIN          (&heap_start)
 | 
			
		||||
#define HEAP_END            (&heap_end)
 | 
			
		||||
 | 
			
		||||
#define HEAP_SIZE           ((uint32_t)HEAP_END - (uint32_t)HEAP_BEGIN)
 | 
			
		||||
 | 
			
		||||
void InitBoardHardware(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif /* _BOARD_H_ */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
export CROSS_COMPILE ?=/usr/bin/arm-none-eabi-
 | 
			
		||||
 | 
			
		||||
export CFLAGS := -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -fgnu89-inline -Wa,-mimplicit-it=thumb -Werror
 | 
			
		||||
export AFLAGS := -c -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -x assembler-with-cpp -Wa,-mimplicit-it=thumb  -gdwarf-2
 | 
			
		||||
export LFLAGS := -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-cortex-m7-emulator.map,-cref,-u,Reset_Handler -T $(BSP_ROOT)/link.lds
 | 
			
		||||
export CXXFLAGS := -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Dgcc -O0 -gdwarf-2 -g -Werror
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export APPLFLAGS := -mcpu=cortex-m7 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wl,--gc-sections,-Map=XiZi-app.map,-cref,-u, -T $(BSP_ROOT)/link_userspace.lds
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export DEFINES := -DHAVE_CCONFIG_H  -DCPU_MIMXRT1052CVL5B
 | 
			
		||||
 | 
			
		||||
export ARCH = arm
 | 
			
		||||
export MCU = cortex-m7
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 15 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 30 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 18 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 52 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 56 KiB  | 
| 
						 | 
				
			
			@ -0,0 +1,252 @@
 | 
			
		|||
/*
 | 
			
		||||
** ###################################################################
 | 
			
		||||
**     Processors:          MIMXRT1052CVJ5B
 | 
			
		||||
**                          MIMXRT1052CVL5B
 | 
			
		||||
**                          MIMXRT1052DVJ6B
 | 
			
		||||
**                          MIMXRT1052DVL6B
 | 
			
		||||
**
 | 
			
		||||
**     Compiler:            GNU C Compiler
 | 
			
		||||
**     Reference manual:    IMXRT1050RM Rev.1, 03/2018
 | 
			
		||||
**     Version:             rev. 1.0, 2018-09-21
 | 
			
		||||
**     Build:               b180921
 | 
			
		||||
**
 | 
			
		||||
**     Abstract:
 | 
			
		||||
**         Linker file for the GNU C Compiler
 | 
			
		||||
**
 | 
			
		||||
**     Copyright 2016 Freescale Semiconductor, Inc.
 | 
			
		||||
**     Copyright 2016-2018 NXP
 | 
			
		||||
**     All rights reserved.
 | 
			
		||||
**
 | 
			
		||||
**     SPDX-License-Identifier: BSD-3-Clause
 | 
			
		||||
**
 | 
			
		||||
**     http:                 www.nxp.com
 | 
			
		||||
**     mail:                 support@nxp.com
 | 
			
		||||
**
 | 
			
		||||
** ###################################################################
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file link.lds
 | 
			
		||||
* @brief cortex-m7 emulator Linker script
 | 
			
		||||
* @version 1.0
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2021-09-27
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*************************************************
 | 
			
		||||
File name: link.lds
 | 
			
		||||
Description: cortex-m7 emulator Linker script
 | 
			
		||||
Others: take MIMXRT1052xxxxx_flexspi_nor.ld for references
 | 
			
		||||
History:
 | 
			
		||||
1. Date: 2021-09-27
 | 
			
		||||
Author: AIIT XUOS Lab
 | 
			
		||||
Modification:
 | 
			
		||||
1. add shell cmd table and g_service_table
 | 
			
		||||
*************************************************/
 | 
			
		||||
 | 
			
		||||
/* Entry Point */
 | 
			
		||||
ENTRY(Reset_Handler)
 | 
			
		||||
 | 
			
		||||
STACK_SIZE = 0x400;
 | 
			
		||||
 | 
			
		||||
/* Specify the memory areas */
 | 
			
		||||
MEMORY
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
 | 
			
		||||
  m_text                (RX)  : ORIGIN = 0x00000400, LENGTH = 0x000FDC00
 | 
			
		||||
  m_data                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00020000
 | 
			
		||||
  m_data2               (RW)  : ORIGIN = 0x20200000, LENGTH = 0x00060000
 | 
			
		||||
 | 
			
		||||
  m_sdram               (RW)  : ORIGIN = 0x21000000, LENGTH = 0x00200000
 | 
			
		||||
  m_nocache             (RW)  : ORIGIN = 0x21200000, LENGTH = 0x00200000
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Define output sections */
 | 
			
		||||
SECTIONS
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  /* The startup code goes first into internal RAM */
 | 
			
		||||
  .interrupts :
 | 
			
		||||
  {
 | 
			
		||||
    __VECTOR_TABLE = .;
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    KEEP(*(.isr_vector))     /* Startup code */
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
  } > m_interrupts
 | 
			
		||||
 | 
			
		||||
  __VECTOR_RAM = __VECTOR_TABLE;
 | 
			
		||||
  __RAM_VECTOR_TABLE_SIZE_BYTES = 0x0;
 | 
			
		||||
 | 
			
		||||
  /* The program code and other data goes into internal RAM */
 | 
			
		||||
  .text :
 | 
			
		||||
  {
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    *(.text)                 /* .text sections (code) */
 | 
			
		||||
    *(.text*)                /* .text* sections (code) */
 | 
			
		||||
    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
 | 
			
		||||
    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
 | 
			
		||||
    *(.glue_7)               /* glue arm to thumb code */
 | 
			
		||||
    *(.glue_7t)              /* glue thumb to arm code */
 | 
			
		||||
    *(.eh_frame)
 | 
			
		||||
    KEEP (*(.init))
 | 
			
		||||
    KEEP (*(.fini))
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /* section information for  shell */
 | 
			
		||||
        . = ALIGN(4);
 | 
			
		||||
        _shell_command_start = .;
 | 
			
		||||
        KEEP (*(shellCommand))
 | 
			
		||||
        _shell_command_end = .;
 | 
			
		||||
        . = ALIGN(4);
 | 
			
		||||
 | 
			
		||||
        __isrtbl_idx_start = .;
 | 
			
		||||
        KEEP(*(.isrtbl.idx))
 | 
			
		||||
        __isrtbl_start = .;
 | 
			
		||||
        KEEP(*(.isrtbl))
 | 
			
		||||
        __isrtbl_end = .;
 | 
			
		||||
        . = ALIGN(4);
 | 
			
		||||
 | 
			
		||||
        PROVIDE(g_service_table_start = ABSOLUTE(.));
 | 
			
		||||
        KEEP(*(.g_service_table))
 | 
			
		||||
        PROVIDE(g_service_table_end = ABSOLUTE(.));
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .ARM.extab :
 | 
			
		||||
  {
 | 
			
		||||
    *(.ARM.extab* .gnu.linkonce.armextab.*)
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .ARM :
 | 
			
		||||
  {
 | 
			
		||||
    __exidx_start = .;
 | 
			
		||||
    *(.ARM.exidx*)
 | 
			
		||||
    __exidx_end = .;
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
 .ctors :
 | 
			
		||||
  {
 | 
			
		||||
    __CTOR_LIST__ = .;
 | 
			
		||||
    /* gcc uses crtbegin.o to find the start of
 | 
			
		||||
       the constructors, so we make sure it is
 | 
			
		||||
       first.  Because this is a wildcard, it
 | 
			
		||||
       doesn't matter if the user does not
 | 
			
		||||
       actually link against crtbegin.o; the
 | 
			
		||||
       linker won't look for a file to match a
 | 
			
		||||
       wildcard.  The wildcard also means that it
 | 
			
		||||
       doesn't matter which directory crtbegin.o
 | 
			
		||||
       is in.  */
 | 
			
		||||
    KEEP (*crtbegin.o(.ctors))
 | 
			
		||||
    KEEP (*crtbegin?.o(.ctors))
 | 
			
		||||
    /* We don't want to include the .ctor section from
 | 
			
		||||
       from the crtend.o file until after the sorted ctors.
 | 
			
		||||
       The .ctor section from the crtend file contains the
 | 
			
		||||
       end of ctors marker and it must be last */
 | 
			
		||||
    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
 | 
			
		||||
    KEEP (*(SORT(.ctors.*)))
 | 
			
		||||
    KEEP (*(.ctors))
 | 
			
		||||
    __CTOR_END__ = .;
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .dtors :
 | 
			
		||||
  {
 | 
			
		||||
    __DTOR_LIST__ = .;
 | 
			
		||||
    KEEP (*crtbegin.o(.dtors))
 | 
			
		||||
    KEEP (*crtbegin?.o(.dtors))
 | 
			
		||||
    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
 | 
			
		||||
    KEEP (*(SORT(.dtors.*)))
 | 
			
		||||
    KEEP (*(.dtors))
 | 
			
		||||
    __DTOR_END__ = .;
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .preinit_array :
 | 
			
		||||
  {
 | 
			
		||||
    PROVIDE_HIDDEN (__preinit_array_start = .);
 | 
			
		||||
    KEEP (*(.preinit_array*))
 | 
			
		||||
    PROVIDE_HIDDEN (__preinit_array_end = .);
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .init_array :
 | 
			
		||||
  {
 | 
			
		||||
    PROVIDE_HIDDEN (__init_array_start = .);
 | 
			
		||||
    KEEP (*(SORT(.init_array.*)))
 | 
			
		||||
    KEEP (*(.init_array*))
 | 
			
		||||
    PROVIDE_HIDDEN (__init_array_end = .);
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .fini_array :
 | 
			
		||||
  {
 | 
			
		||||
    PROVIDE_HIDDEN (__fini_array_start = .);
 | 
			
		||||
    KEEP (*(SORT(.fini_array.*)))
 | 
			
		||||
    KEEP (*(.fini_array*))
 | 
			
		||||
    PROVIDE_HIDDEN (__fini_array_end = .);
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  __etext = .;    /* define a global symbol at end of code */
 | 
			
		||||
  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
 | 
			
		||||
 | 
			
		||||
  .data : AT(__DATA_ROM)
 | 
			
		||||
  {
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __DATA_RAM = .;
 | 
			
		||||
    __data_start__ = .;      /* create a global symbol at data start */
 | 
			
		||||
    *(.data)                 /* .data sections */
 | 
			
		||||
    *(.data*)                /* .data* sections */
 | 
			
		||||
    KEEP(*(.jcr*))
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __data_end__ = .;        /* define a global symbol at data end */
 | 
			
		||||
  } > m_data
 | 
			
		||||
 | 
			
		||||
  __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__);
 | 
			
		||||
  .ncache.init : AT(__NDATA_ROM)
 | 
			
		||||
  {
 | 
			
		||||
    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
 | 
			
		||||
    *(NonCacheable.init)
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
 | 
			
		||||
  } > m_nocache
 | 
			
		||||
  . = __noncachedata_init_end__;
 | 
			
		||||
  .ncache :
 | 
			
		||||
  {
 | 
			
		||||
    *(NonCacheable)
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __noncachedata_end__ = .;     /* define a global symbol at ncache data end */
 | 
			
		||||
  } > m_nocache
 | 
			
		||||
 | 
			
		||||
  __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
 | 
			
		||||
  text_end = ORIGIN(m_text) + LENGTH(m_text);
 | 
			
		||||
  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
 | 
			
		||||
 | 
			
		||||
  /* Uninitialized data section */
 | 
			
		||||
  .bss :
 | 
			
		||||
  {
 | 
			
		||||
    /* This is used by the startup in order to initialize the .bss section */
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __START_BSS = .;
 | 
			
		||||
    __bss_start__ = .;
 | 
			
		||||
    *(.bss)
 | 
			
		||||
    *(.bss*)
 | 
			
		||||
    *(COMMON)
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __bss_end__ = .;
 | 
			
		||||
    __END_BSS = .;
 | 
			
		||||
  } > m_data
 | 
			
		||||
 | 
			
		||||
  .stack :
 | 
			
		||||
  {
 | 
			
		||||
    . = ALIGN(8);
 | 
			
		||||
    stack_start = .;
 | 
			
		||||
    . += STACK_SIZE;
 | 
			
		||||
    stack_end = .;
 | 
			
		||||
    __StackTop = .;
 | 
			
		||||
    heap_start = .;
 | 
			
		||||
  } > m_data2
 | 
			
		||||
 | 
			
		||||
  PROVIDE(heap_end = ORIGIN(m_data2) + LENGTH(m_data2));
 | 
			
		||||
 | 
			
		||||
  .ARM.attributes 0 : { *(.ARM.attributes) }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,252 @@
 | 
			
		|||
/*
 | 
			
		||||
** ###################################################################
 | 
			
		||||
**     Processors:          MIMXRT1052CVJ5B
 | 
			
		||||
**                          MIMXRT1052CVL5B
 | 
			
		||||
**                          MIMXRT1052DVJ6B
 | 
			
		||||
**                          MIMXRT1052DVL6B
 | 
			
		||||
**
 | 
			
		||||
**     Compiler:            GNU C Compiler
 | 
			
		||||
**     Reference manual:    IMXRT1050RM Rev.1, 03/2018
 | 
			
		||||
**     Version:             rev. 1.0, 2018-09-21
 | 
			
		||||
**     Build:               b180921
 | 
			
		||||
**
 | 
			
		||||
**     Abstract:
 | 
			
		||||
**         Linker file for the GNU C Compiler
 | 
			
		||||
**
 | 
			
		||||
**     Copyright 2016 Freescale Semiconductor, Inc.
 | 
			
		||||
**     Copyright 2016-2018 NXP
 | 
			
		||||
**     All rights reserved.
 | 
			
		||||
**
 | 
			
		||||
**     SPDX-License-Identifier: BSD-3-Clause
 | 
			
		||||
**
 | 
			
		||||
**     http:                 www.nxp.com
 | 
			
		||||
**     mail:                 support@nxp.com
 | 
			
		||||
**
 | 
			
		||||
** ###################################################################
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file link.lds
 | 
			
		||||
* @brief cortex-m7 emulator Linker script
 | 
			
		||||
* @version 1.0
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2021-09-27
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*************************************************
 | 
			
		||||
File name: link.lds
 | 
			
		||||
Description:cortex-m7 emulator Linker script
 | 
			
		||||
Others: take MIMXRT1052xxxxx_flexspi_nor.ld for references
 | 
			
		||||
History:
 | 
			
		||||
1. Date: 2021-09-27
 | 
			
		||||
Author: AIIT XUOS Lab
 | 
			
		||||
Modification:
 | 
			
		||||
1. add shell cmd table and g_service_table
 | 
			
		||||
*************************************************/
 | 
			
		||||
 | 
			
		||||
/* Entry Point */
 | 
			
		||||
ENTRY(Reset_Handler)
 | 
			
		||||
 | 
			
		||||
STACK_SIZE = 0x400;
 | 
			
		||||
 | 
			
		||||
/* Specify the memory areas */
 | 
			
		||||
MEMORY
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400
 | 
			
		||||
  m_text                (RX)  : ORIGIN = 0x00000400, LENGTH = 0x000FDC00
 | 
			
		||||
  m_data                (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00020000
 | 
			
		||||
  m_data2               (RW)  : ORIGIN = 0x20200000, LENGTH = 0x00060000
 | 
			
		||||
 | 
			
		||||
  m_sdram               (RW)  : ORIGIN = 0x21000000, LENGTH = 0x00200000
 | 
			
		||||
  m_nocache             (RW)  : ORIGIN = 0x21200000, LENGTH = 0x00200000
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Define output sections */
 | 
			
		||||
SECTIONS
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  /* The startup code goes first into internal RAM */
 | 
			
		||||
  .interrupts :
 | 
			
		||||
  {
 | 
			
		||||
    __VECTOR_TABLE = .;
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    KEEP(*(.isr_vector))     /* Startup code */
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
  } > m_interrupts
 | 
			
		||||
 | 
			
		||||
  __VECTOR_RAM = __VECTOR_TABLE;
 | 
			
		||||
  __RAM_VECTOR_TABLE_SIZE_BYTES = 0x0;
 | 
			
		||||
 | 
			
		||||
  /* The program code and other data goes into internal RAM */
 | 
			
		||||
  .text :
 | 
			
		||||
  {
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    *(.text)                 /* .text sections (code) */
 | 
			
		||||
    *(.text*)                /* .text* sections (code) */
 | 
			
		||||
    *(.rodata)               /* .rodata sections (constants, strings, etc.) */
 | 
			
		||||
    *(.rodata*)              /* .rodata* sections (constants, strings, etc.) */
 | 
			
		||||
    *(.glue_7)               /* glue arm to thumb code */
 | 
			
		||||
    *(.glue_7t)              /* glue thumb to arm code */
 | 
			
		||||
    *(.eh_frame)
 | 
			
		||||
    KEEP (*(.init))
 | 
			
		||||
    KEEP (*(.fini))
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /* section information for  shell */
 | 
			
		||||
        . = ALIGN(4);
 | 
			
		||||
        _shell_command_start = .;
 | 
			
		||||
        KEEP (*(shellCommand))
 | 
			
		||||
        _shell_command_end = .;
 | 
			
		||||
        . = ALIGN(4);
 | 
			
		||||
 | 
			
		||||
        __isrtbl_idx_start = .;
 | 
			
		||||
        KEEP(*(.isrtbl.idx))
 | 
			
		||||
        __isrtbl_start = .;
 | 
			
		||||
        KEEP(*(.isrtbl))
 | 
			
		||||
        __isrtbl_end = .;
 | 
			
		||||
        . = ALIGN(4);
 | 
			
		||||
 | 
			
		||||
        PROVIDE(g_service_table_start = ABSOLUTE(.));
 | 
			
		||||
        KEEP(*(.g_service_table))
 | 
			
		||||
        PROVIDE(g_service_table_end = ABSOLUTE(.));
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .ARM.extab :
 | 
			
		||||
  {
 | 
			
		||||
    *(.ARM.extab* .gnu.linkonce.armextab.*)
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .ARM :
 | 
			
		||||
  {
 | 
			
		||||
    __exidx_start = .;
 | 
			
		||||
    *(.ARM.exidx*)
 | 
			
		||||
    __exidx_end = .;
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
 .ctors :
 | 
			
		||||
  {
 | 
			
		||||
    __CTOR_LIST__ = .;
 | 
			
		||||
    /* gcc uses crtbegin.o to find the start of
 | 
			
		||||
       the constructors, so we make sure it is
 | 
			
		||||
       first.  Because this is a wildcard, it
 | 
			
		||||
       doesn't matter if the user does not
 | 
			
		||||
       actually link against crtbegin.o; the
 | 
			
		||||
       linker won't look for a file to match a
 | 
			
		||||
       wildcard.  The wildcard also means that it
 | 
			
		||||
       doesn't matter which directory crtbegin.o
 | 
			
		||||
       is in.  */
 | 
			
		||||
    KEEP (*crtbegin.o(.ctors))
 | 
			
		||||
    KEEP (*crtbegin?.o(.ctors))
 | 
			
		||||
    /* We don't want to include the .ctor section from
 | 
			
		||||
       from the crtend.o file until after the sorted ctors.
 | 
			
		||||
       The .ctor section from the crtend file contains the
 | 
			
		||||
       end of ctors marker and it must be last */
 | 
			
		||||
    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors))
 | 
			
		||||
    KEEP (*(SORT(.ctors.*)))
 | 
			
		||||
    KEEP (*(.ctors))
 | 
			
		||||
    __CTOR_END__ = .;
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .dtors :
 | 
			
		||||
  {
 | 
			
		||||
    __DTOR_LIST__ = .;
 | 
			
		||||
    KEEP (*crtbegin.o(.dtors))
 | 
			
		||||
    KEEP (*crtbegin?.o(.dtors))
 | 
			
		||||
    KEEP (*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors))
 | 
			
		||||
    KEEP (*(SORT(.dtors.*)))
 | 
			
		||||
    KEEP (*(.dtors))
 | 
			
		||||
    __DTOR_END__ = .;
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .preinit_array :
 | 
			
		||||
  {
 | 
			
		||||
    PROVIDE_HIDDEN (__preinit_array_start = .);
 | 
			
		||||
    KEEP (*(.preinit_array*))
 | 
			
		||||
    PROVIDE_HIDDEN (__preinit_array_end = .);
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .init_array :
 | 
			
		||||
  {
 | 
			
		||||
    PROVIDE_HIDDEN (__init_array_start = .);
 | 
			
		||||
    KEEP (*(SORT(.init_array.*)))
 | 
			
		||||
    KEEP (*(.init_array*))
 | 
			
		||||
    PROVIDE_HIDDEN (__init_array_end = .);
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  .fini_array :
 | 
			
		||||
  {
 | 
			
		||||
    PROVIDE_HIDDEN (__fini_array_start = .);
 | 
			
		||||
    KEEP (*(SORT(.fini_array.*)))
 | 
			
		||||
    KEEP (*(.fini_array*))
 | 
			
		||||
    PROVIDE_HIDDEN (__fini_array_end = .);
 | 
			
		||||
  } > m_text
 | 
			
		||||
 | 
			
		||||
  __etext = .;    /* define a global symbol at end of code */
 | 
			
		||||
  __DATA_ROM = .; /* Symbol is used by startup for data initialization */
 | 
			
		||||
 | 
			
		||||
  .data : AT(__DATA_ROM)
 | 
			
		||||
  {
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __DATA_RAM = .;
 | 
			
		||||
    __data_start__ = .;      /* create a global symbol at data start */
 | 
			
		||||
    *(.data)                 /* .data sections */
 | 
			
		||||
    *(.data*)                /* .data* sections */
 | 
			
		||||
    KEEP(*(.jcr*))
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __data_end__ = .;        /* define a global symbol at data end */
 | 
			
		||||
  } > m_data
 | 
			
		||||
 | 
			
		||||
  __NDATA_ROM = __DATA_ROM + (__data_end__ - __data_start__);
 | 
			
		||||
  .ncache.init : AT(__NDATA_ROM)
 | 
			
		||||
  {
 | 
			
		||||
    __noncachedata_start__ = .;   /* create a global symbol at ncache data start */
 | 
			
		||||
    *(NonCacheable.init)
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __noncachedata_init_end__ = .;   /* create a global symbol at initialized ncache data end */
 | 
			
		||||
  } > m_nocache
 | 
			
		||||
  . = __noncachedata_init_end__;
 | 
			
		||||
  .ncache :
 | 
			
		||||
  {
 | 
			
		||||
    *(NonCacheable)
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __noncachedata_end__ = .;     /* define a global symbol at ncache data end */
 | 
			
		||||
  } > m_nocache
 | 
			
		||||
 | 
			
		||||
  __DATA_END = __NDATA_ROM + (__noncachedata_init_end__ - __noncachedata_start__);
 | 
			
		||||
  text_end = ORIGIN(m_text) + LENGTH(m_text);
 | 
			
		||||
  ASSERT(__DATA_END <= text_end, "region m_text overflowed with text and data")
 | 
			
		||||
 | 
			
		||||
  /* Uninitialized data section */
 | 
			
		||||
  .bss :
 | 
			
		||||
  {
 | 
			
		||||
    /* This is used by the startup in order to initialize the .bss section */
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __START_BSS = .;
 | 
			
		||||
    __bss_start__ = .;
 | 
			
		||||
    *(.bss)
 | 
			
		||||
    *(.bss*)
 | 
			
		||||
    *(COMMON)
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __bss_end__ = .;
 | 
			
		||||
    __END_BSS = .;
 | 
			
		||||
  } > m_data
 | 
			
		||||
 | 
			
		||||
  .stack :
 | 
			
		||||
  {
 | 
			
		||||
    . = ALIGN(8);
 | 
			
		||||
    stack_start = .;
 | 
			
		||||
    . += STACK_SIZE;
 | 
			
		||||
    stack_end = .;
 | 
			
		||||
    __StackTop = .;
 | 
			
		||||
    heap_start = .;
 | 
			
		||||
  } > m_data2
 | 
			
		||||
 | 
			
		||||
  PROVIDE(heap_end = ORIGIN(m_data2) + LENGTH(m_data2));
 | 
			
		||||
 | 
			
		||||
  .ARM.attributes 0 : { *(.ARM.attributes) }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,266 @@
 | 
			
		|||
/**************************************************************************//**
 | 
			
		||||
 * @file     cmsis_compiler.h
 | 
			
		||||
 * @brief    CMSIS compiler generic header file
 | 
			
		||||
 * @version  V5.0.4
 | 
			
		||||
 * @date     10. January 2018
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the License); you may
 | 
			
		||||
 * not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 * www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __CMSIS_COMPILER_H
 | 
			
		||||
#define __CMSIS_COMPILER_H
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Arm Compiler 4/5
 | 
			
		||||
 */
 | 
			
		||||
#if   defined ( __CC_ARM )
 | 
			
		||||
  #include "cmsis_armcc.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Arm Compiler 6 (armclang)
 | 
			
		||||
 */
 | 
			
		||||
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
 | 
			
		||||
  #include "cmsis_armclang.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * GNU Compiler
 | 
			
		||||
 */
 | 
			
		||||
#elif defined ( __GNUC__ )
 | 
			
		||||
  #include "cmsis_gcc.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * IAR Compiler
 | 
			
		||||
 */
 | 
			
		||||
#elif defined ( __ICCARM__ )
 | 
			
		||||
  #include <cmsis_iccarm.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * TI Arm Compiler
 | 
			
		||||
 */
 | 
			
		||||
#elif defined ( __TI_ARM__ )
 | 
			
		||||
  #include <cmsis_ccs.h>
 | 
			
		||||
 | 
			
		||||
  #ifndef   __ASM
 | 
			
		||||
    #define __ASM                                  __asm
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __INLINE
 | 
			
		||||
    #define __INLINE                               inline
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __STATIC_INLINE
 | 
			
		||||
    #define __STATIC_INLINE                        static inline
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __STATIC_FORCEINLINE
 | 
			
		||||
    #define __STATIC_FORCEINLINE                   __STATIC_INLINE
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __NO_RETURN
 | 
			
		||||
    #define __NO_RETURN                            __attribute__((noreturn))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __USED
 | 
			
		||||
    #define __USED                                 __attribute__((used))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __WEAK
 | 
			
		||||
    #define __WEAK                                 __attribute__((weak))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __PACKED
 | 
			
		||||
    #define __PACKED                               __attribute__((packed))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __PACKED_STRUCT
 | 
			
		||||
    #define __PACKED_STRUCT                        struct __attribute__((packed))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __PACKED_UNION
 | 
			
		||||
    #define __PACKED_UNION                         union __attribute__((packed))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT32        /* deprecated */
 | 
			
		||||
    struct __attribute__((packed)) T_UINT32 { uint32_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT32(x)                  (((struct T_UINT32 *)(x))->v)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT16_WRITE
 | 
			
		||||
    __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT16_WRITE(addr, val)    (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT16_READ
 | 
			
		||||
    __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT16_READ(addr)          (((const struct T_UINT16_READ *)(const void *)(addr))->v)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT32_WRITE
 | 
			
		||||
    __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT32_WRITE(addr, val)    (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT32_READ
 | 
			
		||||
    __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT32_READ(addr)          (((const struct T_UINT32_READ *)(const void *)(addr))->v)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __ALIGNED
 | 
			
		||||
    #define __ALIGNED(x)                           __attribute__((aligned(x)))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __RESTRICT
 | 
			
		||||
    #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
 | 
			
		||||
    #define __RESTRICT
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * TASKING Compiler
 | 
			
		||||
 */
 | 
			
		||||
#elif defined ( __TASKING__ )
 | 
			
		||||
  /*
 | 
			
		||||
   * The CMSIS functions have been implemented as intrinsics in the compiler.
 | 
			
		||||
   * Please use "carm -?i" to get an up to date list of all intrinsics,
 | 
			
		||||
   * Including the CMSIS ones.
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
  #ifndef   __ASM
 | 
			
		||||
    #define __ASM                                  __asm
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __INLINE
 | 
			
		||||
    #define __INLINE                               inline
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __STATIC_INLINE
 | 
			
		||||
    #define __STATIC_INLINE                        static inline
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __STATIC_FORCEINLINE
 | 
			
		||||
    #define __STATIC_FORCEINLINE                   __STATIC_INLINE
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __NO_RETURN
 | 
			
		||||
    #define __NO_RETURN                            __attribute__((noreturn))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __USED
 | 
			
		||||
    #define __USED                                 __attribute__((used))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __WEAK
 | 
			
		||||
    #define __WEAK                                 __attribute__((weak))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __PACKED
 | 
			
		||||
    #define __PACKED                               __packed__
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __PACKED_STRUCT
 | 
			
		||||
    #define __PACKED_STRUCT                        struct __packed__
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __PACKED_UNION
 | 
			
		||||
    #define __PACKED_UNION                         union __packed__
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT32        /* deprecated */
 | 
			
		||||
    struct __packed__ T_UINT32 { uint32_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT32(x)                  (((struct T_UINT32 *)(x))->v)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT16_WRITE
 | 
			
		||||
    __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT16_WRITE(addr, val)    (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT16_READ
 | 
			
		||||
    __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT16_READ(addr)          (((const struct T_UINT16_READ *)(const void *)(addr))->v)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT32_WRITE
 | 
			
		||||
    __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT32_WRITE(addr, val)    (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT32_READ
 | 
			
		||||
    __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT32_READ(addr)          (((const struct T_UINT32_READ *)(const void *)(addr))->v)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __ALIGNED
 | 
			
		||||
    #define __ALIGNED(x)              __align(x)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __RESTRICT
 | 
			
		||||
    #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
 | 
			
		||||
    #define __RESTRICT
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * COSMIC Compiler
 | 
			
		||||
 */
 | 
			
		||||
#elif defined ( __CSMC__ )
 | 
			
		||||
   #include <cmsis_csm.h>
 | 
			
		||||
 | 
			
		||||
 #ifndef   __ASM
 | 
			
		||||
    #define __ASM                                  _asm
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __INLINE
 | 
			
		||||
    #define __INLINE                               inline
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __STATIC_INLINE
 | 
			
		||||
    #define __STATIC_INLINE                        static inline
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __STATIC_FORCEINLINE
 | 
			
		||||
    #define __STATIC_FORCEINLINE                   __STATIC_INLINE
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __NO_RETURN
 | 
			
		||||
    // NO RETURN is automatically detected hence no warning here
 | 
			
		||||
    #define __NO_RETURN
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __USED
 | 
			
		||||
    #warning No compiler specific solution for __USED. __USED is ignored.
 | 
			
		||||
    #define __USED
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __WEAK
 | 
			
		||||
    #define __WEAK                                 __weak
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __PACKED
 | 
			
		||||
    #define __PACKED                               @packed
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __PACKED_STRUCT
 | 
			
		||||
    #define __PACKED_STRUCT                        @packed struct
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __PACKED_UNION
 | 
			
		||||
    #define __PACKED_UNION                         @packed union
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT32        /* deprecated */
 | 
			
		||||
    @packed struct T_UINT32 { uint32_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT32(x)                  (((struct T_UINT32 *)(x))->v)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT16_WRITE
 | 
			
		||||
    __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT16_WRITE(addr, val)    (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT16_READ
 | 
			
		||||
    __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT16_READ(addr)          (((const struct T_UINT16_READ *)(const void *)(addr))->v)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT32_WRITE
 | 
			
		||||
    __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT32_WRITE(addr, val)    (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __UNALIGNED_UINT32_READ
 | 
			
		||||
    __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
 | 
			
		||||
    #define __UNALIGNED_UINT32_READ(addr)          (((const struct T_UINT32_READ *)(const void *)(addr))->v)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __ALIGNED
 | 
			
		||||
    #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
 | 
			
		||||
    #define __ALIGNED(x)
 | 
			
		||||
  #endif
 | 
			
		||||
  #ifndef   __RESTRICT
 | 
			
		||||
    #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
 | 
			
		||||
    #define __RESTRICT
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
  #error Unknown compiler.
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif /* __CMSIS_COMPILER_H */
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,39 @@
 | 
			
		|||
/**************************************************************************//**
 | 
			
		||||
 * @file     cmsis_version.h
 | 
			
		||||
 * @brief    CMSIS Core(M) Version definitions
 | 
			
		||||
 * @version  V5.0.2
 | 
			
		||||
 * @date     19. April 2017
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the License); you may
 | 
			
		||||
 * not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 * www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#if   defined ( __ICCARM__ )
 | 
			
		||||
  #pragma system_include         /* treat file as system include file for MISRA check */
 | 
			
		||||
#elif defined (__clang__)
 | 
			
		||||
  #pragma clang system_header   /* treat file as system include file */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __CMSIS_VERSION_H
 | 
			
		||||
#define __CMSIS_VERSION_H
 | 
			
		||||
 | 
			
		||||
/*  CMSIS Version definitions */
 | 
			
		||||
#define __CM_CMSIS_VERSION_MAIN  ( 5U)                                      /*!< [31:16] CMSIS Core(M) main version */
 | 
			
		||||
#define __CM_CMSIS_VERSION_SUB   ( 1U)                                      /*!< [15:0]  CMSIS Core(M) sub version */
 | 
			
		||||
#define __CM_CMSIS_VERSION       ((__CM_CMSIS_VERSION_MAIN << 16U) | \
 | 
			
		||||
                                   __CM_CMSIS_VERSION_SUB           )       /*!< CMSIS Core(M) version number */
 | 
			
		||||
#endif
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,197 @@
 | 
			
		|||
/******************************************************************************
 | 
			
		||||
 * @file     mpu_armv7.h
 | 
			
		||||
 * @brief    CMSIS MPU API for Armv7-M MPU
 | 
			
		||||
 * @version  V5.0.4
 | 
			
		||||
 * @date     10. January 2018
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2017-2018 Arm Limited. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the License); you may
 | 
			
		||||
 * not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 * www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
#if   defined ( __ICCARM__ )
 | 
			
		||||
  #pragma system_include         /* treat file as system include file for MISRA check */
 | 
			
		||||
#elif defined (__clang__)
 | 
			
		||||
  #pragma clang system_header    /* treat file as system include file */
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
#ifndef ARM_MPU_ARMV7_H
 | 
			
		||||
#define ARM_MPU_ARMV7_H
 | 
			
		||||
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_32B      ((uint8_t)0x04U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_64B      ((uint8_t)0x05U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_128B     ((uint8_t)0x06U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_256B     ((uint8_t)0x07U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_512B     ((uint8_t)0x08U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_1KB      ((uint8_t)0x09U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_2KB      ((uint8_t)0x0AU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_4KB      ((uint8_t)0x0BU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_8KB      ((uint8_t)0x0CU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_16KB     ((uint8_t)0x0DU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_32KB     ((uint8_t)0x0EU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_64KB     ((uint8_t)0x0FU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_128KB    ((uint8_t)0x10U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_256KB    ((uint8_t)0x11U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_512KB    ((uint8_t)0x12U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_1MB      ((uint8_t)0x13U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_2MB      ((uint8_t)0x14U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_4MB      ((uint8_t)0x15U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_8MB      ((uint8_t)0x16U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_16MB     ((uint8_t)0x17U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_32MB     ((uint8_t)0x18U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_64MB     ((uint8_t)0x19U)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_128MB    ((uint8_t)0x1AU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_256MB    ((uint8_t)0x1BU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_512MB    ((uint8_t)0x1CU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_1GB      ((uint8_t)0x1DU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_2GB      ((uint8_t)0x1EU)
 | 
			
		||||
#define ARM_MPU_REGION_SIZE_4GB      ((uint8_t)0x1FU)
 | 
			
		||||
 | 
			
		||||
#define ARM_MPU_AP_NONE 0U 
 | 
			
		||||
#define ARM_MPU_AP_PRIV 1U
 | 
			
		||||
#define ARM_MPU_AP_URO  2U
 | 
			
		||||
#define ARM_MPU_AP_FULL 3U
 | 
			
		||||
#define ARM_MPU_AP_PRO  5U
 | 
			
		||||
#define ARM_MPU_AP_RO   6U
 | 
			
		||||
 | 
			
		||||
/** MPU Region Base Address Register Value
 | 
			
		||||
*
 | 
			
		||||
* \param Region The region to be configured, number 0 to 15.
 | 
			
		||||
* \param BaseAddress The base address for the region.
 | 
			
		||||
*/
 | 
			
		||||
#define ARM_MPU_RBAR(Region, BaseAddress) \
 | 
			
		||||
  (((BaseAddress) & MPU_RBAR_ADDR_Msk) |  \
 | 
			
		||||
   ((Region) & MPU_RBAR_REGION_Msk)    |  \
 | 
			
		||||
   (MPU_RBAR_VALID_Msk))
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* MPU Region Attribute and Size Register Value
 | 
			
		||||
* 
 | 
			
		||||
* \param DisableExec       Instruction access disable bit, 1= disable instruction fetches.
 | 
			
		||||
* \param AccessPermission  Data access permissions, allows you to configure read/write access for User and Privileged mode.
 | 
			
		||||
* \param TypeExtField      Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral.
 | 
			
		||||
* \param IsShareable       Region is shareable between multiple bus masters.
 | 
			
		||||
* \param IsCacheable       Region is cacheable, i.e. its value may be kept in cache.
 | 
			
		||||
* \param IsBufferable      Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy.
 | 
			
		||||
* \param SubRegionDisable  Sub-region disable field.
 | 
			
		||||
* \param Size              Region size of the region to be configured, for example 4K, 8K.
 | 
			
		||||
*/                         
 | 
			
		||||
#define ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size) \
 | 
			
		||||
  ((((DisableExec     ) << MPU_RASR_XN_Pos)     & MPU_RASR_XN_Msk)     | \
 | 
			
		||||
   (((AccessPermission) << MPU_RASR_AP_Pos)     & MPU_RASR_AP_Msk)     | \
 | 
			
		||||
   (((TypeExtField    ) << MPU_RASR_TEX_Pos)    & MPU_RASR_TEX_Msk)    | \
 | 
			
		||||
   (((IsShareable     ) << MPU_RASR_S_Pos)      & MPU_RASR_S_Msk)      | \
 | 
			
		||||
   (((IsCacheable     ) << MPU_RASR_C_Pos)      & MPU_RASR_C_Msk)      | \
 | 
			
		||||
   (((IsBufferable    ) << MPU_RASR_B_Pos)      & MPU_RASR_B_Msk)      | \
 | 
			
		||||
   (((SubRegionDisable) << MPU_RASR_SRD_Pos)    & MPU_RASR_SRD_Msk)    | \
 | 
			
		||||
   (((Size            ) << MPU_RASR_SIZE_Pos)   & MPU_RASR_SIZE_Msk)   | \
 | 
			
		||||
   (MPU_RASR_ENABLE_Msk))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* Struct for a single MPU Region
 | 
			
		||||
*/
 | 
			
		||||
typedef struct {
 | 
			
		||||
  uint32_t RBAR; //!< The region base address register value (RBAR)
 | 
			
		||||
  uint32_t RASR; //!< The region attribute and size register value (RASR) \ref MPU_RASR
 | 
			
		||||
} ARM_MPU_Region_t;
 | 
			
		||||
    
 | 
			
		||||
/** Enable the MPU.
 | 
			
		||||
* \param MPU_Control Default access permissions for unconfigured regions.
 | 
			
		||||
*/
 | 
			
		||||
__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control)
 | 
			
		||||
{
 | 
			
		||||
  __DSB();
 | 
			
		||||
  __ISB();
 | 
			
		||||
  MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk;
 | 
			
		||||
#ifdef SCB_SHCSR_MEMFAULTENA_Msk
 | 
			
		||||
  SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Disable the MPU.
 | 
			
		||||
*/
 | 
			
		||||
__STATIC_INLINE void ARM_MPU_Disable(void)
 | 
			
		||||
{
 | 
			
		||||
  __DSB();
 | 
			
		||||
  __ISB();
 | 
			
		||||
#ifdef SCB_SHCSR_MEMFAULTENA_Msk
 | 
			
		||||
  SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk;
 | 
			
		||||
#endif
 | 
			
		||||
  MPU->CTRL  &= ~MPU_CTRL_ENABLE_Msk;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Clear and disable the given MPU region.
 | 
			
		||||
* \param rnr Region number to be cleared.
 | 
			
		||||
*/
 | 
			
		||||
__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr)
 | 
			
		||||
{
 | 
			
		||||
  MPU->RNR = rnr;
 | 
			
		||||
  MPU->RASR = 0U;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Configure an MPU region.
 | 
			
		||||
* \param rbar Value for RBAR register.
 | 
			
		||||
* \param rsar Value for RSAR register.
 | 
			
		||||
*/   
 | 
			
		||||
__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rbar, uint32_t rasr)
 | 
			
		||||
{
 | 
			
		||||
  MPU->RBAR = rbar;
 | 
			
		||||
  MPU->RASR = rasr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Configure the given MPU region.
 | 
			
		||||
* \param rnr Region number to be configured.
 | 
			
		||||
* \param rbar Value for RBAR register.
 | 
			
		||||
* \param rsar Value for RSAR register.
 | 
			
		||||
*/   
 | 
			
		||||
__STATIC_INLINE void ARM_MPU_SetRegionEx(uint32_t rnr, uint32_t rbar, uint32_t rasr)
 | 
			
		||||
{
 | 
			
		||||
  MPU->RNR = rnr;
 | 
			
		||||
  MPU->RBAR = rbar;
 | 
			
		||||
  MPU->RASR = rasr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Memcopy with strictly ordered memory access, e.g. for register targets.
 | 
			
		||||
* \param dst Destination data is copied to.
 | 
			
		||||
* \param src Source data is copied from.
 | 
			
		||||
* \param len Amount of data words to be copied.
 | 
			
		||||
*/
 | 
			
		||||
__STATIC_INLINE void orderedCpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len)
 | 
			
		||||
{
 | 
			
		||||
  uint32_t i;
 | 
			
		||||
  for (i = 0U; i < len; ++i) 
 | 
			
		||||
  {
 | 
			
		||||
    dst[i] = src[i];
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Load the given number of MPU regions from a table.
 | 
			
		||||
* \param table Pointer to the MPU configuration table.
 | 
			
		||||
* \param cnt Amount of regions to be configured.
 | 
			
		||||
*/
 | 
			
		||||
__STATIC_INLINE void ARM_MPU_Load(ARM_MPU_Region_t const* table, uint32_t cnt) 
 | 
			
		||||
{
 | 
			
		||||
  const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U;
 | 
			
		||||
  while (cnt > MPU_TYPE_RALIASES) {
 | 
			
		||||
    orderedCpy(&(MPU->RBAR), &(table->RBAR), MPU_TYPE_RALIASES*rowWordSize);
 | 
			
		||||
    table += MPU_TYPE_RALIASES;
 | 
			
		||||
    cnt -= MPU_TYPE_RALIASES;
 | 
			
		||||
  }
 | 
			
		||||
  orderedCpy(&(MPU->RBAR), &(table->RBAR), cnt*rowWordSize);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,201 @@
 | 
			
		|||
                                 Apache License
 | 
			
		||||
                           Version 2.0, January 2004
 | 
			
		||||
                        http://www.apache.org/licenses/
 | 
			
		||||
 | 
			
		||||
   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
 | 
			
		||||
 | 
			
		||||
   1. Definitions.
 | 
			
		||||
 | 
			
		||||
      "License" shall mean the terms and conditions for use, reproduction,
 | 
			
		||||
      and distribution as defined by Sections 1 through 9 of this document.
 | 
			
		||||
 | 
			
		||||
      "Licensor" shall mean the copyright owner or entity authorized by
 | 
			
		||||
      the copyright owner that is granting the License.
 | 
			
		||||
 | 
			
		||||
      "Legal Entity" shall mean the union of the acting entity and all
 | 
			
		||||
      other entities that control, are controlled by, or are under common
 | 
			
		||||
      control with that entity. For the purposes of this definition,
 | 
			
		||||
      "control" means (i) the power, direct or indirect, to cause the
 | 
			
		||||
      direction or management of such entity, whether by contract or
 | 
			
		||||
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
 | 
			
		||||
      outstanding shares, or (iii) beneficial ownership of such entity.
 | 
			
		||||
 | 
			
		||||
      "You" (or "Your") shall mean an individual or Legal Entity
 | 
			
		||||
      exercising permissions granted by this License.
 | 
			
		||||
 | 
			
		||||
      "Source" form shall mean the preferred form for making modifications,
 | 
			
		||||
      including but not limited to software source code, documentation
 | 
			
		||||
      source, and configuration files.
 | 
			
		||||
 | 
			
		||||
      "Object" form shall mean any form resulting from mechanical
 | 
			
		||||
      transformation or translation of a Source form, including but
 | 
			
		||||
      not limited to compiled object code, generated documentation,
 | 
			
		||||
      and conversions to other media types.
 | 
			
		||||
 | 
			
		||||
      "Work" shall mean the work of authorship, whether in Source or
 | 
			
		||||
      Object form, made available under the License, as indicated by a
 | 
			
		||||
      copyright notice that is included in or attached to the work
 | 
			
		||||
      (an example is provided in the Appendix below).
 | 
			
		||||
 | 
			
		||||
      "Derivative Works" shall mean any work, whether in Source or Object
 | 
			
		||||
      form, that is based on (or derived from) the Work and for which the
 | 
			
		||||
      editorial revisions, annotations, elaborations, or other modifications
 | 
			
		||||
      represent, as a whole, an original work of authorship. For the purposes
 | 
			
		||||
      of this License, Derivative Works shall not include works that remain
 | 
			
		||||
      separable from, or merely link (or bind by name) to the interfaces of,
 | 
			
		||||
      the Work and Derivative Works thereof.
 | 
			
		||||
 | 
			
		||||
      "Contribution" shall mean any work of authorship, including
 | 
			
		||||
      the original version of the Work and any modifications or additions
 | 
			
		||||
      to that Work or Derivative Works thereof, that is intentionally
 | 
			
		||||
      submitted to Licensor for inclusion in the Work by the copyright owner
 | 
			
		||||
      or by an individual or Legal Entity authorized to submit on behalf of
 | 
			
		||||
      the copyright owner. For the purposes of this definition, "submitted"
 | 
			
		||||
      means any form of electronic, verbal, or written communication sent
 | 
			
		||||
      to the Licensor or its representatives, including but not limited to
 | 
			
		||||
      communication on electronic mailing lists, source code control systems,
 | 
			
		||||
      and issue tracking systems that are managed by, or on behalf of, the
 | 
			
		||||
      Licensor for the purpose of discussing and improving the Work, but
 | 
			
		||||
      excluding communication that is conspicuously marked or otherwise
 | 
			
		||||
      designated in writing by the copyright owner as "Not a Contribution."
 | 
			
		||||
 | 
			
		||||
      "Contributor" shall mean Licensor and any individual or Legal Entity
 | 
			
		||||
      on behalf of whom a Contribution has been received by Licensor and
 | 
			
		||||
      subsequently incorporated within the Work.
 | 
			
		||||
 | 
			
		||||
   2. Grant of Copyright License. Subject to the terms and conditions of
 | 
			
		||||
      this License, each Contributor hereby grants to You a perpetual,
 | 
			
		||||
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
 | 
			
		||||
      copyright license to reproduce, prepare Derivative Works of,
 | 
			
		||||
      publicly display, publicly perform, sublicense, and distribute the
 | 
			
		||||
      Work and such Derivative Works in Source or Object form.
 | 
			
		||||
 | 
			
		||||
   3. Grant of Patent License. Subject to the terms and conditions of
 | 
			
		||||
      this License, each Contributor hereby grants to You a perpetual,
 | 
			
		||||
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
 | 
			
		||||
      (except as stated in this section) patent license to make, have made,
 | 
			
		||||
      use, offer to sell, sell, import, and otherwise transfer the Work,
 | 
			
		||||
      where such license applies only to those patent claims licensable
 | 
			
		||||
      by such Contributor that are necessarily infringed by their
 | 
			
		||||
      Contribution(s) alone or by combination of their Contribution(s)
 | 
			
		||||
      with the Work to which such Contribution(s) was submitted. If You
 | 
			
		||||
      institute patent litigation against any entity (including a
 | 
			
		||||
      cross-claim or counterclaim in a lawsuit) alleging that the Work
 | 
			
		||||
      or a Contribution incorporated within the Work constitutes direct
 | 
			
		||||
      or contributory patent infringement, then any patent licenses
 | 
			
		||||
      granted to You under this License for that Work shall terminate
 | 
			
		||||
      as of the date such litigation is filed.
 | 
			
		||||
 | 
			
		||||
   4. Redistribution. You may reproduce and distribute copies of the
 | 
			
		||||
      Work or Derivative Works thereof in any medium, with or without
 | 
			
		||||
      modifications, and in Source or Object form, provided that You
 | 
			
		||||
      meet the following conditions:
 | 
			
		||||
 | 
			
		||||
      (a) You must give any other recipients of the Work or
 | 
			
		||||
          Derivative Works a copy of this License; and
 | 
			
		||||
 | 
			
		||||
      (b) You must cause any modified files to carry prominent notices
 | 
			
		||||
          stating that You changed the files; and
 | 
			
		||||
 | 
			
		||||
      (c) You must retain, in the Source form of any Derivative Works
 | 
			
		||||
          that You distribute, all copyright, patent, trademark, and
 | 
			
		||||
          attribution notices from the Source form of the Work,
 | 
			
		||||
          excluding those notices that do not pertain to any part of
 | 
			
		||||
          the Derivative Works; and
 | 
			
		||||
 | 
			
		||||
      (d) If the Work includes a "NOTICE" text file as part of its
 | 
			
		||||
          distribution, then any Derivative Works that You distribute must
 | 
			
		||||
          include a readable copy of the attribution notices contained
 | 
			
		||||
          within such NOTICE file, excluding those notices that do not
 | 
			
		||||
          pertain to any part of the Derivative Works, in at least one
 | 
			
		||||
          of the following places: within a NOTICE text file distributed
 | 
			
		||||
          as part of the Derivative Works; within the Source form or
 | 
			
		||||
          documentation, if provided along with the Derivative Works; or,
 | 
			
		||||
          within a display generated by the Derivative Works, if and
 | 
			
		||||
          wherever such third-party notices normally appear. The contents
 | 
			
		||||
          of the NOTICE file are for informational purposes only and
 | 
			
		||||
          do not modify the License. You may add Your own attribution
 | 
			
		||||
          notices within Derivative Works that You distribute, alongside
 | 
			
		||||
          or as an addendum to the NOTICE text from the Work, provided
 | 
			
		||||
          that such additional attribution notices cannot be construed
 | 
			
		||||
          as modifying the License.
 | 
			
		||||
 | 
			
		||||
      You may add Your own copyright statement to Your modifications and
 | 
			
		||||
      may provide additional or different license terms and conditions
 | 
			
		||||
      for use, reproduction, or distribution of Your modifications, or
 | 
			
		||||
      for any such Derivative Works as a whole, provided Your use,
 | 
			
		||||
      reproduction, and distribution of the Work otherwise complies with
 | 
			
		||||
      the conditions stated in this License.
 | 
			
		||||
 | 
			
		||||
   5. Submission of Contributions. Unless You explicitly state otherwise,
 | 
			
		||||
      any Contribution intentionally submitted for inclusion in the Work
 | 
			
		||||
      by You to the Licensor shall be under the terms and conditions of
 | 
			
		||||
      this License, without any additional terms or conditions.
 | 
			
		||||
      Notwithstanding the above, nothing herein shall supersede or modify
 | 
			
		||||
      the terms of any separate license agreement you may have executed
 | 
			
		||||
      with Licensor regarding such Contributions.
 | 
			
		||||
 | 
			
		||||
   6. Trademarks. This License does not grant permission to use the trade
 | 
			
		||||
      names, trademarks, service marks, or product names of the Licensor,
 | 
			
		||||
      except as required for reasonable and customary use in describing the
 | 
			
		||||
      origin of the Work and reproducing the content of the NOTICE file.
 | 
			
		||||
 | 
			
		||||
   7. Disclaimer of Warranty. Unless required by applicable law or
 | 
			
		||||
      agreed to in writing, Licensor provides the Work (and each
 | 
			
		||||
      Contributor provides its Contributions) on an "AS IS" BASIS,
 | 
			
		||||
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 | 
			
		||||
      implied, including, without limitation, any warranties or conditions
 | 
			
		||||
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
 | 
			
		||||
      PARTICULAR PURPOSE. You are solely responsible for determining the
 | 
			
		||||
      appropriateness of using or redistributing the Work and assume any
 | 
			
		||||
      risks associated with Your exercise of permissions under this License.
 | 
			
		||||
 | 
			
		||||
   8. Limitation of Liability. In no event and under no legal theory,
 | 
			
		||||
      whether in tort (including negligence), contract, or otherwise,
 | 
			
		||||
      unless required by applicable law (such as deliberate and grossly
 | 
			
		||||
      negligent acts) or agreed to in writing, shall any Contributor be
 | 
			
		||||
      liable to You for damages, including any direct, indirect, special,
 | 
			
		||||
      incidental, or consequential damages of any character arising as a
 | 
			
		||||
      result of this License or out of the use or inability to use the
 | 
			
		||||
      Work (including but not limited to damages for loss of goodwill,
 | 
			
		||||
      work stoppage, computer failure or malfunction, or any and all
 | 
			
		||||
      other commercial damages or losses), even if such Contributor
 | 
			
		||||
      has been advised of the possibility of such damages.
 | 
			
		||||
 | 
			
		||||
   9. Accepting Warranty or Additional Liability. While redistributing
 | 
			
		||||
      the Work or Derivative Works thereof, You may choose to offer,
 | 
			
		||||
      and charge a fee for, acceptance of support, warranty, indemnity,
 | 
			
		||||
      or other liability obligations and/or rights consistent with this
 | 
			
		||||
      License. However, in accepting such obligations, You may act only
 | 
			
		||||
      on Your own behalf and on Your sole responsibility, not on behalf
 | 
			
		||||
      of any other Contributor, and only if You agree to indemnify,
 | 
			
		||||
      defend, and hold each Contributor harmless for any liability
 | 
			
		||||
      incurred by, or claims asserted against, such Contributor by reason
 | 
			
		||||
      of your accepting any such warranty or additional liability.
 | 
			
		||||
 | 
			
		||||
   END OF TERMS AND CONDITIONS
 | 
			
		||||
 | 
			
		||||
   APPENDIX: How to apply the Apache License to your work.
 | 
			
		||||
 | 
			
		||||
      To apply the Apache License to your work, attach the following
 | 
			
		||||
      boilerplate notice, with the fields enclosed by brackets "{}"
 | 
			
		||||
      replaced with your own identifying information. (Don't include
 | 
			
		||||
      the brackets!)  The text should be enclosed in the appropriate
 | 
			
		||||
      comment syntax for the file format. We also recommend that a
 | 
			
		||||
      file or class name and description of purpose be included on the
 | 
			
		||||
      same "printed page" as the copyright notice for easier
 | 
			
		||||
      identification within third-party archives.
 | 
			
		||||
 | 
			
		||||
   Copyright {yyyy} {name of copyright owner}
 | 
			
		||||
 | 
			
		||||
   Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
   you may not use this file except in compliance with the License.
 | 
			
		||||
   You may obtain a copy of the License at
 | 
			
		||||
 | 
			
		||||
       http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 | 
			
		||||
   Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
   distributed under the License is distributed on an "AS IS" BASIS,
 | 
			
		||||
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
   See the License for the specific language governing permissions and
 | 
			
		||||
   limitations under the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
menuconfig BSP_USING_LPUART
 | 
			
		||||
    bool "Using UART device"
 | 
			
		||||
    default y
 | 
			
		||||
    select RESOURCES_SERIAL
 | 
			
		||||
    if BSP_USING_LPUART
 | 
			
		||||
        source "$BSP_DIR/third_party_driver/uart/Kconfig"
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_DIR := common  uart
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
SRC_FILES :=  fsl_common.c   system_CMSDK_CM7.c startup_CMSDK_CM7.c clock_config.c
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,70 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2017-2019 NXP
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: BSD-3-Clause
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file clock_config.c
 | 
			
		||||
* @brief support imxrt1052-board clock configure
 | 
			
		||||
* @version 1.0 
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2021-05-29
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * How to setup clock using clock driver functions:
 | 
			
		||||
 *
 | 
			
		||||
 * 1. Call CLOCK_InitXXXPLL() to configure corresponding PLL clock.
 | 
			
		||||
 *
 | 
			
		||||
 * 2. Call CLOCK_InitXXXpfd() to configure corresponding PLL pfd clock.
 | 
			
		||||
 *
 | 
			
		||||
 * 3. Call CLOCK_SetMux() to configure corresponding clock source for target clock out.
 | 
			
		||||
 *
 | 
			
		||||
 * 4. Call CLOCK_SetDiv() to configure corresponding clock divider for target clock out.
 | 
			
		||||
 *
 | 
			
		||||
 * 5. Call CLOCK_SetXtalFreq() to set XTAL frequency based on board settings.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* TEXT BELOW IS USED AS SETTING FOR TOOLS *************************************
 | 
			
		||||
!!GlobalInfo
 | 
			
		||||
product: Clocks v5.0
 | 
			
		||||
processor: MIMXRT1052xxxxB
 | 
			
		||||
package_id: MIMXRT1052DVL6B
 | 
			
		||||
mcu_data: ksdk2_0
 | 
			
		||||
processor_version: 5.0.2
 | 
			
		||||
board: IMXRT1050-EVKB
 | 
			
		||||
 * BE CAREFUL MODIFYING THIS COMMENT - IT IS YAML SETTINGS FOR TOOLS **********/
 | 
			
		||||
 | 
			
		||||
#include "clock_config.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 * Definitions
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 * Variables
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
/* System clock frequency. */
 | 
			
		||||
extern uint32_t SystemCoreClock;
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 ************************ BOARD_InitBootClocks function ************************
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
void BOARD_InitBootClocks(void)
 | 
			
		||||
{
 | 
			
		||||
    BOARD_BootClockRUN();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 * Code for BOARD_BootClockRUN configuration
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
void BOARD_BootClockRUN(void)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,155 @@
 | 
			
		|||
/*
 | 
			
		||||
* Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
 | 
			
		||||
 * Copyright 2016-2018 NXP
 | 
			
		||||
* All rights reserved.
 | 
			
		||||
*
 | 
			
		||||
*
 | 
			
		||||
* SPDX-License-Identifier: BSD-3-Clause
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file fsl_common.c
 | 
			
		||||
 * @brief common drivers
 | 
			
		||||
 * @version 1.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2021.11.11
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "fsl_common.h"
 | 
			
		||||
#define SDK_MEM_MAGIC_NUMBER 12345U
 | 
			
		||||
 | 
			
		||||
typedef struct _mem_align_control_block
 | 
			
		||||
{
 | 
			
		||||
    uint16_t identifier; /*!< Identifier for the memory control block. */
 | 
			
		||||
    uint16_t offset;     /*!< offset from aligned address to real address */
 | 
			
		||||
} mem_align_cb_t;
 | 
			
		||||
 | 
			
		||||
/* Component ID definition, used by tools. */
 | 
			
		||||
#ifndef FSL_COMPONENT_ID
 | 
			
		||||
#define FSL_COMPONENT_ID "platform.drivers.common"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __GIC_PRIO_BITS
 | 
			
		||||
#if defined(ENABLE_RAM_VECTOR_TABLE)
 | 
			
		||||
uint32_t InstallIRQHandler(IRQn_Type irq, uint32_t irqHandler)
 | 
			
		||||
{
 | 
			
		||||
/* Addresses for VECTOR_TABLE and VECTOR_RAM come from the linker file */
 | 
			
		||||
#if defined(__CC_ARM) || defined(__ARMCC_VERSION)
 | 
			
		||||
    extern uint32_t Image$$VECTOR_ROM$$Base[];
 | 
			
		||||
    extern uint32_t Image$$VECTOR_RAM$$Base[];
 | 
			
		||||
    extern uint32_t Image$$RW_m_data$$Base[];
 | 
			
		||||
 | 
			
		||||
#define __VECTOR_TABLE Image$$VECTOR_ROM$$Base
 | 
			
		||||
#define __VECTOR_RAM Image$$VECTOR_RAM$$Base
 | 
			
		||||
#define __RAM_VECTOR_TABLE_SIZE (((uint32_t)Image$$RW_m_data$$Base - (uint32_t)Image$$VECTOR_RAM$$Base))
 | 
			
		||||
#elif defined(__ICCARM__)
 | 
			
		||||
    extern uint32_t __RAM_VECTOR_TABLE_SIZE[];
 | 
			
		||||
    extern uint32_t __VECTOR_TABLE[];
 | 
			
		||||
    extern uint32_t __VECTOR_RAM[];
 | 
			
		||||
#elif defined(__GNUC__)
 | 
			
		||||
    extern uint32_t __VECTOR_TABLE[];
 | 
			
		||||
    extern uint32_t __VECTOR_RAM[];
 | 
			
		||||
    extern uint32_t __RAM_VECTOR_TABLE_SIZE_BYTES[];
 | 
			
		||||
    uint32_t __RAM_VECTOR_TABLE_SIZE = (uint32_t)(__RAM_VECTOR_TABLE_SIZE_BYTES);
 | 
			
		||||
#endif /* defined(__CC_ARM) || defined(__ARMCC_VERSION) */
 | 
			
		||||
    uint32_t n;
 | 
			
		||||
    uint32_t ret;
 | 
			
		||||
    uint32_t irqMaskValue;
 | 
			
		||||
 | 
			
		||||
    irqMaskValue = DisableGlobalIRQ();
 | 
			
		||||
    if (SCB->VTOR != (uint32_t)__VECTOR_RAM)
 | 
			
		||||
    {
 | 
			
		||||
        /* Copy the vector table from ROM to RAM */
 | 
			
		||||
        for (n = 0; n < ((uint32_t)__RAM_VECTOR_TABLE_SIZE) / sizeof(uint32_t); n++)
 | 
			
		||||
        {
 | 
			
		||||
            __VECTOR_RAM[n] = __VECTOR_TABLE[n];
 | 
			
		||||
        }
 | 
			
		||||
        /* Point the VTOR to the position of vector table */
 | 
			
		||||
        SCB->VTOR = (uint32_t)__VECTOR_RAM;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ret = __VECTOR_RAM[irq + 16];
 | 
			
		||||
    /* make sure the __VECTOR_RAM is noncachable */
 | 
			
		||||
    __VECTOR_RAM[irq + 16] = irqHandler;
 | 
			
		||||
 | 
			
		||||
    EnableGlobalIRQ(irqMaskValue);
 | 
			
		||||
 | 
			
		||||
/* Add for ARM errata 838869, affects Cortex-M4, Cortex-M4F Store immediate overlapping
 | 
			
		||||
  exception return operation might vector to incorrect interrupt */
 | 
			
		||||
#if defined __CORTEX_M && (__CORTEX_M == 4U)
 | 
			
		||||
    __DSB();
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
#endif /* ENABLE_RAM_VECTOR_TABLE. */
 | 
			
		||||
#endif /* __GIC_PRIO_BITS. */
 | 
			
		||||
 | 
			
		||||
#if (defined(FSL_FEATURE_SOC_SYSCON_COUNT) && (FSL_FEATURE_SOC_SYSCON_COUNT > 0))
 | 
			
		||||
#if !(defined(FSL_FEATURE_SYSCON_STARTER_DISCONTINUOUS) && FSL_FEATURE_SYSCON_STARTER_DISCONTINUOUS)
 | 
			
		||||
 | 
			
		||||
void EnableDeepSleepIRQ(IRQn_Type interrupt)
 | 
			
		||||
{
 | 
			
		||||
    uint32_t intNumber = (uint32_t)interrupt;
 | 
			
		||||
 | 
			
		||||
    uint32_t index = 0;
 | 
			
		||||
 | 
			
		||||
    while (intNumber >= 32u)
 | 
			
		||||
    {
 | 
			
		||||
        index++;
 | 
			
		||||
        intNumber -= 32u;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    SYSCON->STARTERSET[index] = 1u << intNumber;
 | 
			
		||||
    EnableIRQ(interrupt); /* also enable interrupt at NVIC */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void DisableDeepSleepIRQ(IRQn_Type interrupt)
 | 
			
		||||
{
 | 
			
		||||
    uint32_t intNumber = (uint32_t)interrupt;
 | 
			
		||||
 | 
			
		||||
    DisableIRQ(interrupt); /* also disable interrupt at NVIC */
 | 
			
		||||
    uint32_t index = 0;
 | 
			
		||||
 | 
			
		||||
    while (intNumber >= 32u)
 | 
			
		||||
    {
 | 
			
		||||
        index++;
 | 
			
		||||
        intNumber -= 32u;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    SYSCON->STARTERCLR[index] = 1u << intNumber;
 | 
			
		||||
}
 | 
			
		||||
#endif /* FSL_FEATURE_SYSCON_STARTER_DISCONTINUOUS */
 | 
			
		||||
#endif /* FSL_FEATURE_SOC_SYSCON_COUNT */
 | 
			
		||||
 | 
			
		||||
void *SDK_Malloc(size_t size, size_t alignbytes)
 | 
			
		||||
{
 | 
			
		||||
    mem_align_cb_t *p_cb = NULL;
 | 
			
		||||
    uint32_t alignedsize = SDK_SIZEALIGN(size, alignbytes) + alignbytes + sizeof(mem_align_cb_t);
 | 
			
		||||
    void *p_align_addr, *p_addr = malloc(alignedsize);
 | 
			
		||||
 | 
			
		||||
    if (!p_addr)
 | 
			
		||||
    {
 | 
			
		||||
        return NULL;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    p_align_addr = (void *)SDK_SIZEALIGN((uint32_t)p_addr + sizeof(mem_align_cb_t), alignbytes);
 | 
			
		||||
 | 
			
		||||
    p_cb             = (mem_align_cb_t *)((uint32_t)p_align_addr - 4U);
 | 
			
		||||
    p_cb->identifier = SDK_MEM_MAGIC_NUMBER;
 | 
			
		||||
    p_cb->offset     = (uint32_t)p_align_addr - (uint32_t)p_addr;
 | 
			
		||||
 | 
			
		||||
    return (void *)p_align_addr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void SDK_Free(void *ptr)
 | 
			
		||||
{
 | 
			
		||||
    mem_align_cb_t *p_cb = (mem_align_cb_t *)((uint32_t)ptr - 4U);
 | 
			
		||||
 | 
			
		||||
    if (p_cb->identifier != SDK_MEM_MAGIC_NUMBER)
 | 
			
		||||
    {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    free((void *)((uint32_t)ptr - p_cb->offset));
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,418 @@
 | 
			
		|||
/******************************************************************************
 | 
			
		||||
 * @file     startup_CMSDK_CM7.c
 | 
			
		||||
 * @brief    CMSIS Startup File for CMSDK_M7 Device
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
/* Copyright (c) 2022 ARM LIMITED
 | 
			
		||||
 | 
			
		||||
   All rights reserved.
 | 
			
		||||
   Redistribution and use in source and binary forms, with or without
 | 
			
		||||
   modification, are permitted provided that the following conditions are met:
 | 
			
		||||
   - Redistributions of source code must retain the above copyright
 | 
			
		||||
     notice, this list of conditions and the following disclaimer.
 | 
			
		||||
   - Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
     notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
     documentation and/or other materials provided with the distribution.
 | 
			
		||||
   - Neither the name of ARM nor the names of its contributors may be used
 | 
			
		||||
     to endorse or promote products derived from this software without
 | 
			
		||||
     specific prior written permission.
 | 
			
		||||
   *
 | 
			
		||||
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 | 
			
		||||
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 | 
			
		||||
   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 | 
			
		||||
   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 | 
			
		||||
   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 | 
			
		||||
   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 | 
			
		||||
   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 | 
			
		||||
   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
			
		||||
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 | 
			
		||||
   POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
   ---------------------------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "CMSDK_CM7_SP.h"
 | 
			
		||||
#include "system_CMSDK_CM7.h"
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  External References
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
extern uint32_t __StackTop ;
 | 
			
		||||
 | 
			
		||||
// extern __NO_RETURN void __PROGRAM_START(void);
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  Internal References
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
extern __NO_RETURN void Reset_Handler  (void);
 | 
			
		||||
            void Default_Handler(void);
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  Exception / Interrupt Handler
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
/* Exceptions */
 | 
			
		||||
void NMI_Handler            (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void HardFault_Handler      (void) __attribute__ ((weak));
 | 
			
		||||
void MemManage_Handler      (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void BusFault_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UsageFault_Handler     (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void SVC_Handler            (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void DebugMon_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void PendSV_Handler         (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void SysTick_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
 | 
			
		||||
/* Interrupts */
 | 
			
		||||
void UART0RX_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UART0TX_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UART1RX_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UART1TX_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UART2RX_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UART2TX_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO0ALL_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO1ALL_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void TIMER0_Handler         (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void TIMER1_Handler         (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void DUALTIMER_Handler      (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void SPI_0_1_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UART_0_1_2_OVF_Handler (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void ETHERNET_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void I2S_Handler            (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void TOUCHSCREEN_Handler    (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO2_Handler          (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO3_Handler          (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UART3RX_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UART3TX_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UART4RX_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void UART4TX_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void SPI_2_Handler          (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void SPI_3_4_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO0_0_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO0_1_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO0_2_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO0_3_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO0_4_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO0_5_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO0_6_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void GPIO0_7_Handler        (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
#if defined CMSDK_CM7_VHT || defined CMSDK_CM7_SP_VHT || defined CMSDK_CM7_DP_VHT
 | 
			
		||||
void ARM_VSI0_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void ARM_VSI1_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void ARM_VSI2_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void ARM_VSI3_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void ARM_VSI4_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void ARM_VSI5_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void ARM_VSI6_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
void ARM_VSI7_Handler       (void) __attribute__ ((weak, alias("Default_Handler")));
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  Exception / Interrupt Vector table
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
#if defined ( __GNUC__ )
 | 
			
		||||
#pragma GCC diagnostic push
 | 
			
		||||
#pragma GCC diagnostic ignored "-Wpedantic"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// extern const VECTOR_TABLE_Type __VECTOR_TABLE[256];
 | 
			
		||||
//        const VECTOR_TABLE_Type __VECTOR_TABLE[256] = {
 | 
			
		||||
//   (VECTOR_TABLE_Type)(&__StackTop),       /*     Initial Stack Pointer */
 | 
			
		||||
//   Reset_Handler,                            /*     Reset Handler */
 | 
			
		||||
//   NMI_Handler,                              /* -14 NMI Handler */
 | 
			
		||||
//   HardFault_Handler,                        /* -13 Hard Fault Handler */
 | 
			
		||||
//   MemManage_Handler,                        /* -12 MPU Fault Handler */
 | 
			
		||||
//   BusFault_Handler,                         /* -11 Bus Fault Handler */
 | 
			
		||||
//   UsageFault_Handler,                       /* -10 Usage Fault Handler */
 | 
			
		||||
//   0,                                        /*     Reserved */
 | 
			
		||||
//   0,                                        /*     Reserved */
 | 
			
		||||
//   0,                                        /*     Reserved */
 | 
			
		||||
//   0,                                        /*     Reserved */
 | 
			
		||||
//   SVC_Handler,                              /*  -5 SVC Handler */
 | 
			
		||||
//   DebugMon_Handler,                         /*  -4 Debug Monitor Handler */
 | 
			
		||||
//   0,                                        /*     Reserved */
 | 
			
		||||
//   PendSV_Handler,                           /*  -2 PendSV Handler */
 | 
			
		||||
//   SysTick_Handler,                          /*  -1 SysTick Handler */
 | 
			
		||||
 | 
			
		||||
//   /* Interrupts */
 | 
			
		||||
//   UART0RX_Handler,                          /*   0 UART 0 receive interrupt */
 | 
			
		||||
//   UART0TX_Handler,                          /*   1 UART 0 transmit interrupt */
 | 
			
		||||
//   UART1RX_Handler,                          /*   2 UART 1 receive interrupt */
 | 
			
		||||
//   UART1TX_Handler,                          /*   3 UART 1 transmit interrupt */
 | 
			
		||||
//   UART2RX_Handler,                          /*   4 UART 2 receive interrupt */
 | 
			
		||||
//   UART2TX_Handler,                          /*   5 UART 2 transmit interrupt */
 | 
			
		||||
//   GPIO0ALL_Handler,                         /*   6 GPIO 0 combined interrupt */
 | 
			
		||||
//   GPIO1ALL_Handler,                         /*   7 GPIO 1 combined interrupt */
 | 
			
		||||
//   TIMER0_Handler,                           /*   8 Timer 0 interrupt */
 | 
			
		||||
//   TIMER1_Handler,                           /*   9 Timer 1 interrupt */
 | 
			
		||||
//   DUALTIMER_Handler,                        /*  10 Dual Timer interrupt */
 | 
			
		||||
//   SPI_0_1_Handler,                          /*  11 SPI 0, SPI 1 interrupt */
 | 
			
		||||
//   UART_0_1_2_OVF_Handler,                   /*  12 UART overflow (0, 1 & 2) interrupt */
 | 
			
		||||
//   ETHERNET_Handler,                         /*  13 Ethernet interrupt */
 | 
			
		||||
//   I2S_Handler,                              /*  14 Audio I2S interrupt */
 | 
			
		||||
//   TOUCHSCREEN_Handler,                      /*  15 Touch Screen interrupt */
 | 
			
		||||
//   GPIO2_Handler,                            /*  16 GPIO 2 combined interrupt */
 | 
			
		||||
//   GPIO3_Handler,                            /*  17 GPIO 3 combined interrupt */
 | 
			
		||||
//   UART3RX_Handler,                          /*  18 UART 3 receive interrupt */
 | 
			
		||||
//   UART3TX_Handler,                          /*  19 UART 3 transmit interrupt */
 | 
			
		||||
//   UART4RX_Handler,                          /*  20 UART 4 receive interrupt */
 | 
			
		||||
//   UART4TX_Handler,                          /*  21 UART 4 transmit interrupt */
 | 
			
		||||
//   SPI_2_Handler,                            /*  22 SPI 2 interrupt */
 | 
			
		||||
//   SPI_3_4_Handler,                          /*  23 SPI 3, SPI 4 interrupt */
 | 
			
		||||
//   GPIO0_0_Handler,                          /*  24 GPIO 0 individual interrupt ( 0) */
 | 
			
		||||
//   GPIO0_1_Handler,                          /*  25 GPIO 0 individual interrupt ( 1) */
 | 
			
		||||
//   GPIO0_2_Handler,                          /*  26 GPIO 0 individual interrupt ( 2) */
 | 
			
		||||
//   GPIO0_3_Handler,                          /*  27 GPIO 0 individual interrupt ( 3) */
 | 
			
		||||
//   GPIO0_4_Handler,                          /*  28 GPIO 0 individual interrupt ( 4) */
 | 
			
		||||
//   GPIO0_5_Handler,                          /*  29 GPIO 0 individual interrupt ( 5) */
 | 
			
		||||
//   GPIO0_6_Handler,                          /*  30 GPIO 0 individual interrupt ( 6) */
 | 
			
		||||
//   GPIO0_7_Handler,                          /*  31 GPIO 0 individual interrupt ( 7) */
 | 
			
		||||
//   0,                                        /*  32 Reserved */
 | 
			
		||||
//   0,                                        /*  33 Reserved */
 | 
			
		||||
//   0,                                        /*  34 Reserved */
 | 
			
		||||
//   0,                                        /*  35 Reserved */
 | 
			
		||||
//   0,                                        /*  36 Reserved */
 | 
			
		||||
//   0,                                        /*  37 Reserved */
 | 
			
		||||
//   0,                                        /*  38 Reserved */
 | 
			
		||||
//   0,                                        /*  39 Reserved */
 | 
			
		||||
//   0,                                        /*  40 Reserved */
 | 
			
		||||
//   0,                                        /*  41 Reserved */
 | 
			
		||||
//   0,                                        /*  42 Reserved */
 | 
			
		||||
//   0,                                        /*  43 Reserved */
 | 
			
		||||
//   0,                                        /*  44 Reserved */
 | 
			
		||||
//   0,                                        /*  45 Reserved */
 | 
			
		||||
//   0,                                        /*  46 Reserved */
 | 
			
		||||
//   0,                                        /*  47 Reserved */
 | 
			
		||||
//   0,                                        /*  48 Reserved */
 | 
			
		||||
//   0,                                        /*  49 Reserved */
 | 
			
		||||
//   0,                                        /*  50 Reserved */
 | 
			
		||||
//   0,                                        /*  51 Reserved */
 | 
			
		||||
//   0,                                        /*  52 Reserved */
 | 
			
		||||
//   0,                                        /*  53 Reserved */
 | 
			
		||||
//   0,                                        /*  54 Reserved */
 | 
			
		||||
//   0,                                        /*  55 Reserved */
 | 
			
		||||
//   0,                                        /*  56 Reserved */
 | 
			
		||||
//   0,                                        /*  57 Reserved */
 | 
			
		||||
//   0,                                        /*  58 Reserved */
 | 
			
		||||
//   0,                                        /*  59 Reserved */
 | 
			
		||||
//   0,                                        /*  60 Reserved */
 | 
			
		||||
//   0,                                        /*  61 Reserved */
 | 
			
		||||
//   0,                                        /*  62 Reserved */
 | 
			
		||||
//   0,                                        /*  63 Reserved */
 | 
			
		||||
//   0,                                        /*  64 Reserved */
 | 
			
		||||
//   0,                                        /*  65 Reserved */
 | 
			
		||||
//   0,                                        /*  66 Reserved */
 | 
			
		||||
//   0,                                        /*  67 Reserved */
 | 
			
		||||
//   0,                                        /*  68 Reserved */
 | 
			
		||||
//   0,                                        /*  69 Reserved */
 | 
			
		||||
//   0,                                        /*  70 Reserved */
 | 
			
		||||
//   0,                                        /*  71 Reserved */
 | 
			
		||||
//   0,                                        /*  72 Reserved */
 | 
			
		||||
//   0,                                        /*  73 Reserved */
 | 
			
		||||
//   0,                                        /*  74 Reserved */
 | 
			
		||||
//   0,                                        /*  75 Reserved */
 | 
			
		||||
//   0,                                        /*  76 Reserved */
 | 
			
		||||
//   0,                                        /*  77 Reserved */
 | 
			
		||||
//   0,                                        /*  78 Reserved */
 | 
			
		||||
//   0,                                        /*  79 Reserved */
 | 
			
		||||
//   0,                                        /*  80 Reserved */
 | 
			
		||||
//   0,                                        /*  81 Reserved */
 | 
			
		||||
//   0,                                        /*  82 Reserved */
 | 
			
		||||
//   0,                                        /*  83 Reserved */
 | 
			
		||||
//   0,                                        /*  84 Reserved */
 | 
			
		||||
//   0,                                        /*  85 Reserved */
 | 
			
		||||
//   0,                                        /*  86 Reserved */
 | 
			
		||||
//   0,                                        /*  87 Reserved */
 | 
			
		||||
//   0,                                        /*  88 Reserved */
 | 
			
		||||
//   0,                                        /*  89 Reserved */
 | 
			
		||||
//   0,                                        /*  90 Reserved */
 | 
			
		||||
//   0,                                        /*  91 Reserved */
 | 
			
		||||
//   0,                                        /*  92 Reserved */
 | 
			
		||||
//   0,                                        /*  93 Reserved */
 | 
			
		||||
//   0,                                        /*  94 Reserved */
 | 
			
		||||
//   0,                                        /*  95 Reserved */
 | 
			
		||||
//   0,                                        /*  96 Reserved */
 | 
			
		||||
//   0,                                        /*  97 Reserved */
 | 
			
		||||
//   0,                                        /*  98 Reserved */
 | 
			
		||||
//   0,                                        /*  99 Reserved */
 | 
			
		||||
//   0,                                        /* 100 Reserved */
 | 
			
		||||
//   0,                                        /* 101 Reserved */
 | 
			
		||||
//   0,                                        /* 102 Reserved */
 | 
			
		||||
//   0,                                        /* 103 Reserved */
 | 
			
		||||
//   0,                                        /* 104 Reserved */
 | 
			
		||||
//   0,                                        /* 105 Reserved */
 | 
			
		||||
//   0,                                        /* 106 Reserved */
 | 
			
		||||
//   0,                                        /* 107 Reserved */
 | 
			
		||||
//   0,                                        /* 108 Reserved */
 | 
			
		||||
//   0,                                        /* 109 Reserved */
 | 
			
		||||
//   0,                                        /* 110 Reserved */
 | 
			
		||||
//   0,                                        /* 111 Reserved */
 | 
			
		||||
//   0,                                        /* 112 Reserved */
 | 
			
		||||
//   0,                                        /* 113 Reserved */
 | 
			
		||||
//   0,                                        /* 114 Reserved */
 | 
			
		||||
//   0,                                        /* 115 Reserved */
 | 
			
		||||
//   0,                                        /* 116 Reserved */
 | 
			
		||||
//   0,                                        /* 117 Reserved */
 | 
			
		||||
//   0,                                        /* 118 Reserved */
 | 
			
		||||
//   0,                                        /* 119 Reserved */
 | 
			
		||||
//   0,                                        /* 120 Reserved */
 | 
			
		||||
//   0,                                        /* 121 Reserved */
 | 
			
		||||
//   0,                                        /* 122 Reserved */
 | 
			
		||||
//   0,                                        /* 123 Reserved */
 | 
			
		||||
//   0,                                        /* 124 Reserved */
 | 
			
		||||
//   0,                                        /* 125 Reserved */
 | 
			
		||||
//   0,                                        /* 126 Reserved */
 | 
			
		||||
//   0,                                        /* 127 Reserved */
 | 
			
		||||
//   0,                                        /* 128 Reserved */
 | 
			
		||||
//   0,                                        /* 129 Reserved */
 | 
			
		||||
//   0,                                        /* 130 Reserved */
 | 
			
		||||
//   0,                                        /* 131 Reserved */
 | 
			
		||||
//   0,                                        /* 132 Reserved */
 | 
			
		||||
//   0,                                        /* 133 Reserved */
 | 
			
		||||
//   0,                                        /* 134 Reserved */
 | 
			
		||||
//   0,                                        /* 135 Reserved */
 | 
			
		||||
//   0,                                        /* 136 Reserved */
 | 
			
		||||
//   0,                                        /* 137 Reserved */
 | 
			
		||||
//   0,                                        /* 138 Reserved */
 | 
			
		||||
//   0,                                        /* 139 Reserved */
 | 
			
		||||
//   0,                                        /* 140 Reserved */
 | 
			
		||||
//   0,                                        /* 141 Reserved */
 | 
			
		||||
//   0,                                        /* 142 Reserved */
 | 
			
		||||
//   0,                                        /* 143 Reserved */
 | 
			
		||||
//   0,                                        /* 144 Reserved */
 | 
			
		||||
//   0,                                        /* 145 Reserved */
 | 
			
		||||
//   0,                                        /* 146 Reserved */
 | 
			
		||||
//   0,                                        /* 147 Reserved */
 | 
			
		||||
//   0,                                        /* 148 Reserved */
 | 
			
		||||
//   0,                                        /* 149 Reserved */
 | 
			
		||||
//   0,                                        /* 150 Reserved */
 | 
			
		||||
//   0,                                        /* 151 Reserved */
 | 
			
		||||
//   0,                                        /* 152 Reserved */
 | 
			
		||||
//   0,                                        /* 153 Reserved */
 | 
			
		||||
//   0,                                        /* 154 Reserved */
 | 
			
		||||
//   0,                                        /* 155 Reserved */
 | 
			
		||||
//   0,                                        /* 156 Reserved */
 | 
			
		||||
//   0,                                        /* 157 Reserved */
 | 
			
		||||
//   0,                                        /* 158 Reserved */
 | 
			
		||||
//   0,                                        /* 159 Reserved */
 | 
			
		||||
//   0,                                        /* 160 Reserved */
 | 
			
		||||
//   0,                                        /* 161 Reserved */
 | 
			
		||||
//   0,                                        /* 162 Reserved */
 | 
			
		||||
//   0,                                        /* 163 Reserved */
 | 
			
		||||
//   0,                                        /* 164 Reserved */
 | 
			
		||||
//   0,                                        /* 165 Reserved */
 | 
			
		||||
//   0,                                        /* 166 Reserved */
 | 
			
		||||
//   0,                                        /* 167 Reserved */
 | 
			
		||||
//   0,                                        /* 168 Reserved */
 | 
			
		||||
//   0,                                        /* 169 Reserved */
 | 
			
		||||
//   0,                                        /* 170 Reserved */
 | 
			
		||||
//   0,                                        /* 171 Reserved */
 | 
			
		||||
//   0,                                        /* 172 Reserved */
 | 
			
		||||
//   0,                                        /* 173 Reserved */
 | 
			
		||||
//   0,                                        /* 174 Reserved */
 | 
			
		||||
//   0,                                        /* 175 Reserved */
 | 
			
		||||
//   0,                                        /* 176 Reserved */
 | 
			
		||||
//   0,                                        /* 177 Reserved */
 | 
			
		||||
//   0,                                        /* 178 Reserved */
 | 
			
		||||
//   0,                                        /* 179 Reserved */
 | 
			
		||||
//   0,                                        /* 180 Reserved */
 | 
			
		||||
//   0,                                        /* 181 Reserved */
 | 
			
		||||
//   0,                                        /* 182 Reserved */
 | 
			
		||||
//   0,                                        /* 183 Reserved */
 | 
			
		||||
//   0,                                        /* 184 Reserved */
 | 
			
		||||
//   0,                                        /* 185 Reserved */
 | 
			
		||||
//   0,                                        /* 186 Reserved */
 | 
			
		||||
//   0,                                        /* 187 Reserved */
 | 
			
		||||
//   0,                                        /* 188 Reserved */
 | 
			
		||||
//   0,                                        /* 189 Reserved */
 | 
			
		||||
//   0,                                        /* 190 Reserved */
 | 
			
		||||
//   0,                                        /* 191 Reserved */
 | 
			
		||||
//   0,                                        /* 192 Reserved */
 | 
			
		||||
//   0,                                        /* 193 Reserved */
 | 
			
		||||
//   0,                                        /* 194 Reserved */
 | 
			
		||||
//   0,                                        /* 195 Reserved */
 | 
			
		||||
//   0,                                        /* 196 Reserved */
 | 
			
		||||
//   0,                                        /* 197 Reserved */
 | 
			
		||||
//   0,                                        /* 198 Reserved */
 | 
			
		||||
//   0,                                        /* 199 Reserved */
 | 
			
		||||
//   0,                                        /* 200 Reserved */
 | 
			
		||||
//   0,                                        /* 201 Reserved */
 | 
			
		||||
//   0,                                        /* 202 Reserved */
 | 
			
		||||
//   0,                                        /* 203 Reserved */
 | 
			
		||||
//   0,                                        /* 204 Reserved */
 | 
			
		||||
//   0,                                        /* 205 Reserved */
 | 
			
		||||
//   0,                                        /* 206 Reserved */
 | 
			
		||||
//   0,                                        /* 207 Reserved */
 | 
			
		||||
//   0,                                        /* 208 Reserved */
 | 
			
		||||
//   0,                                        /* 209 Reserved */
 | 
			
		||||
//   0,                                        /* 210 Reserved */
 | 
			
		||||
//   0,                                        /* 211 Reserved */
 | 
			
		||||
//   0,                                        /* 212 Reserved */
 | 
			
		||||
//   0,                                        /* 213 Reserved */
 | 
			
		||||
//   0,                                        /* 214 Reserved */
 | 
			
		||||
//   0,                                        /* 215 Reserved */
 | 
			
		||||
//   0,                                        /* 216 Reserved */
 | 
			
		||||
//   0,                                        /* 217 Reserved */
 | 
			
		||||
//   0,                                        /* 218 Reserved */
 | 
			
		||||
//   0,                                        /* 219 Reserved */
 | 
			
		||||
//   0,                                        /* 220 Reserved */
 | 
			
		||||
//   0,                                        /* 221 Reserved */
 | 
			
		||||
//   0,                                        /* 222 Reserved */
 | 
			
		||||
//   0,                                        /* 223 Reserved */
 | 
			
		||||
// #if defined CMSDK_CM7_VHT || defined CMSDK_CM7_SP_VHT || defined CMSDK_CM7_DP_VHT
 | 
			
		||||
//   ARM_VSI0_Handler,                         /* 224 VSI 0 interrupt */
 | 
			
		||||
//   ARM_VSI1_Handler,                         /* 225 VSI 1 interrupt */
 | 
			
		||||
//   ARM_VSI2_Handler,                         /* 226 VSI 2 interrupt */
 | 
			
		||||
//   ARM_VSI3_Handler,                         /* 227 VSI 3 interrupt */
 | 
			
		||||
//   ARM_VSI4_Handler,                         /* 228 VSI 4 interrupt */
 | 
			
		||||
//   ARM_VSI5_Handler,                         /* 229 VSI 5 interrupt */
 | 
			
		||||
//   ARM_VSI6_Handler,                         /* 230 VSI 6 interrupt */
 | 
			
		||||
//   ARM_VSI7_Handler                          /* 231 VSI 7 interrupt */
 | 
			
		||||
// #else
 | 
			
		||||
//   0,                                        /* 224 Reserved */
 | 
			
		||||
//   0,                                        /* 225 Reserved */
 | 
			
		||||
//   0,                                        /* 226 Reserved */
 | 
			
		||||
//   0,                                        /* 227 Reserved */
 | 
			
		||||
//   0,                                        /* 228 Reserved */
 | 
			
		||||
//   0,                                        /* 229 Reserved */
 | 
			
		||||
//   0,                                        /* 230 Reserved */
 | 
			
		||||
//   0                                         /* 231 Reserved */
 | 
			
		||||
// #endif
 | 
			
		||||
// };
 | 
			
		||||
 | 
			
		||||
#if defined ( __GNUC__ )
 | 
			
		||||
#pragma GCC diagnostic pop
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  Reset Handler called on controller reset
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
// __NO_RETURN void Reset_Handler(void)
 | 
			
		||||
// {
 | 
			
		||||
//   SystemInit();                  
 | 
			
		||||
// }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
 | 
			
		||||
  #pragma clang diagnostic push
 | 
			
		||||
  #pragma clang diagnostic ignored "-Wmissing-noreturn"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  Hard Fault Handler
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
void HardFault_Handler(void)
 | 
			
		||||
{
 | 
			
		||||
  while(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  Default Handler for Exceptions / Interrupts
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
void Default_Handler(void)
 | 
			
		||||
{
 | 
			
		||||
  while(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#if defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
 | 
			
		||||
  #pragma clang diagnostic pop
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,79 @@
 | 
			
		|||
/******************************************************************************
 | 
			
		||||
 * @file     system_CMSDK_CM7.c
 | 
			
		||||
 * @brief    CMSIS System Source File for CMSDK_CM7 Device
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
/* Copyright (c) 2011 - 2022 ARM LIMITED
 | 
			
		||||
 | 
			
		||||
   All rights reserved.
 | 
			
		||||
   Redistribution and use in source and binary forms, with or without
 | 
			
		||||
   modification, are permitted provided that the following conditions are met:
 | 
			
		||||
   - Redistributions of source code must retain the above copyright
 | 
			
		||||
     notice, this list of conditions and the following disclaimer.
 | 
			
		||||
   - Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
     notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
     documentation and/or other materials provided with the distribution.
 | 
			
		||||
   - Neither the name of ARM nor the names of its contributors may be used
 | 
			
		||||
     to endorse or promote products derived from this software without
 | 
			
		||||
     specific prior written permission.
 | 
			
		||||
   *
 | 
			
		||||
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 | 
			
		||||
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 | 
			
		||||
   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 | 
			
		||||
   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 | 
			
		||||
   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 | 
			
		||||
   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 | 
			
		||||
   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 | 
			
		||||
   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
			
		||||
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 | 
			
		||||
   POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
   ---------------------------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
#include "CMSDK_CM7_SP.h"
 | 
			
		||||
#include "system_CMSDK_CM7.h"
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  Define clocks
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
#define  XTAL            (50000000UL)     /* Oscillator frequency */
 | 
			
		||||
 | 
			
		||||
#define  SYSTEM_CLOCK    (XTAL / 2U)
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  Exception / Interrupt Vector table
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
extern const VECTOR_TABLE_Type __VECTOR_TABLE[256];
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  System Core Clock Variable
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
uint32_t SystemCoreClock = SYSTEM_CLOCK;  /* System Core Clock Frequency */
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  System Core Clock update function
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
void SystemCoreClockUpdate (void)
 | 
			
		||||
{
 | 
			
		||||
  SystemCoreClock = SYSTEM_CLOCK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*----------------------------------------------------------------------------
 | 
			
		||||
  System initialization function
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
void SystemInit (void)
 | 
			
		||||
{
 | 
			
		||||
#if defined (__VTOR_PRESENT) && (__VTOR_PRESENT == 1U)
 | 
			
		||||
  SCB->VTOR = (uint32_t) &(__VECTOR_TABLE[0]);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined (__FPU_USED) && (__FPU_USED == 1U)
 | 
			
		||||
  SCB->CPACR |= ((3U << 10U*2U) |           /* enable CP10 Full Access */
 | 
			
		||||
                 (3U << 11U*2U)  );         /* enable CP11 Full Access */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef UNALIGNED_SUPPORT_DISABLE
 | 
			
		||||
  SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  SystemCoreClock = SYSTEM_CLOCK;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,616 @@
 | 
			
		|||
/******************************************************************************
 | 
			
		||||
 * @file     CMSDK_CM7_SP.h
 | 
			
		||||
 * @brief    CMSIS Device Header File for CMSDK_CM7 Device (single precision FPU)
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
/* Copyright (c) 2011 - 2022 ARM LIMITED
 | 
			
		||||
 | 
			
		||||
   All rights reserved.
 | 
			
		||||
   Redistribution and use in source and binary forms, with or without
 | 
			
		||||
   modification, are permitted provided that the following conditions are met:
 | 
			
		||||
   - Redistributions of source code must retain the above copyright
 | 
			
		||||
     notice, this list of conditions and the following disclaimer.
 | 
			
		||||
   - Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
     notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
     documentation and/or other materials provided with the distribution.
 | 
			
		||||
   - Neither the name of ARM nor the names of its contributors may be used
 | 
			
		||||
     to endorse or promote products derived from this software without
 | 
			
		||||
     specific prior written permission.
 | 
			
		||||
   *
 | 
			
		||||
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 | 
			
		||||
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 | 
			
		||||
   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 | 
			
		||||
   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 | 
			
		||||
   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 | 
			
		||||
   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 | 
			
		||||
   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 | 
			
		||||
   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
			
		||||
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 | 
			
		||||
   POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
   ---------------------------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
#ifndef CMSDK_CM7_SP_H
 | 
			
		||||
#define CMSDK_CM7_SP_H
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* -------------------------  Interrupt Number Definition  ------------------------ */
 | 
			
		||||
 | 
			
		||||
typedef enum IRQn
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
/* -------------------  Processor Exceptions Numbers  ----------------------------- */
 | 
			
		||||
  NonMaskableInt_IRQn           = -14,      /*  2 Non Maskable Interrupt */
 | 
			
		||||
  HardFault_IRQn                = -13,      /*  3 HardFault Interrupt */
 | 
			
		||||
  MemoryManagement_IRQn         = -12,      /*  4 Memory Management Interrupt */
 | 
			
		||||
  BusFault_IRQn                 = -11,      /*  5 Bus Fault Interrupt */
 | 
			
		||||
  UsageFault_IRQn               = -10,      /*  6 Usage Fault Interrupt */
 | 
			
		||||
  SVCall_IRQn                   =  -5,      /* 11 SV Call Interrupt */
 | 
			
		||||
  DebugMonitor_IRQn             =  -4,      /* 12 Debug Monitor Interrupt */
 | 
			
		||||
  PendSV_IRQn                   =  -2,      /* 14 Pend SV Interrupt */
 | 
			
		||||
  SysTick_IRQn                  =  -1,      /* 15 System Tick Interrupt */
 | 
			
		||||
 | 
			
		||||
/* -------------------  Processor Interrupt Numbers  ------------------------------ */
 | 
			
		||||
  UART0RX_IRQn                  =   0,      /*    UART 0 receive interrupt */
 | 
			
		||||
  UART0TX_IRQn                  =   1,      /*    UART 0 transmit interrupt */
 | 
			
		||||
  UART1RX_IRQn                  =   2,      /*    UART 1 receive interrupt */
 | 
			
		||||
  UART1TX_IRQn                  =   3,      /*    UART 1 transmit interrupt */
 | 
			
		||||
  UART2RX_IRQn                  =   4,      /*    UART 2 receive interrupt */
 | 
			
		||||
  UART2TX_IRQn                  =   5,      /*    UART 2 transmit interrupt */
 | 
			
		||||
  GPIO0ALL_IRQn                 =   6,      /*    GPIO 0 combined interrupt */
 | 
			
		||||
  GPIO1ALL_IRQn                 =   7,      /*    GPIO 1 combined interrupt */
 | 
			
		||||
  TIMER0_IRQn                   =   8,      /*    Timer 0 interrupt */
 | 
			
		||||
  TIMER1_IRQn                   =   9,      /*    Timer 1 interrupt */
 | 
			
		||||
  DUALTIMER_IRQn                =  10,      /*    Dual Timer interrupt */
 | 
			
		||||
  SPI_0_1_IRQn                  =  11,      /*    SPI 0, SPI 1 interrupt */
 | 
			
		||||
  UART_0_1_2_OVF_IRQn           =  12,      /*    UART overflow (0, 1 & 2) interrupt */
 | 
			
		||||
  ETHERNET_IRQn                 =  13,      /*    Ethernet interrupt */
 | 
			
		||||
  I2S_IRQn                      =  14,      /*    Audio I2S interrupt */
 | 
			
		||||
  TOUCHSCREEN_IRQn              =  15,      /*    Touch Screen interrupt */
 | 
			
		||||
  GPIO2_IRQn                    =  16,      /*    GPIO 2 combined interrupt */
 | 
			
		||||
  GPIO3_IRQn                    =  17,      /*    GPIO 3 combined interrupt */
 | 
			
		||||
  UART3RX_IRQn                  =  18,      /*    UART 3 receive interrupt */
 | 
			
		||||
  UART3TX_IRQn                  =  19,      /*    UART 3 transmit interrupt */
 | 
			
		||||
  UART4RX_IRQn                  =  20,      /*    UART 4 receive interrupt */
 | 
			
		||||
  UART4TX_IRQn                  =  21,      /*    UART 4 transmit interrupt */
 | 
			
		||||
  SPI_2_IRQn                    =  22,      /*    SPI 2 interrupt */
 | 
			
		||||
  SPI_3_4_IRQn                  =  23,      /*    SPI 3, SPI 4 interrupt */
 | 
			
		||||
  GPIO0_0_IRQn                  =  24,      /*    GPIO 0 individual interrupt ( 0) */
 | 
			
		||||
  GPIO0_1_IRQn                  =  25,      /*    GPIO 0 individual interrupt ( 1) */
 | 
			
		||||
  GPIO0_2_IRQn                  =  26,      /*    GPIO 0 individual interrupt ( 2) */
 | 
			
		||||
  GPIO0_3_IRQn                  =  27,      /*    GPIO 0 individual interrupt ( 3) */
 | 
			
		||||
  GPIO0_4_IRQn                  =  28,      /*    GPIO 0 individual interrupt ( 4) */
 | 
			
		||||
  GPIO0_5_IRQn                  =  29,      /*    GPIO 0 individual interrupt ( 5) */
 | 
			
		||||
  GPIO0_6_IRQn                  =  30,      /*    GPIO 0 individual interrupt ( 6) */
 | 
			
		||||
  GPIO0_7_IRQn                  =  31,      /*    GPIO 0 individual interrupt ( 7) */
 | 
			
		||||
#if defined CMSDK_CM7_SP_VHT
 | 
			
		||||
  ARM_VSI0_IRQn                 = 224,      /*    VSI 0 interrupt */
 | 
			
		||||
  ARM_VSI1_IRQn                 = 225,      /*    VSI 1 interrupt */
 | 
			
		||||
  ARM_VSI2_IRQn                 = 226,      /*    VSI 2 interrupt */
 | 
			
		||||
  ARM_VSI3_IRQn                 = 227,      /*    VSI 3 interrupt */
 | 
			
		||||
  ARM_VSI4_IRQn                 = 228,      /*    VSI 4 interrupt */
 | 
			
		||||
  ARM_VSI5_IRQn                 = 229,      /*    VSI 5 interrupt */
 | 
			
		||||
  ARM_VSI6_IRQn                 = 230,      /*    VSI 6 interrupt */
 | 
			
		||||
  ARM_VSI7_IRQn                 = 231,      /*    VSI 7 interrupt */
 | 
			
		||||
#endif
 | 
			
		||||
} IRQn_Type;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* ================================================================================ */
 | 
			
		||||
/* ================      Processor and Core Peripheral Section     ================ */
 | 
			
		||||
/* ================================================================================ */
 | 
			
		||||
 | 
			
		||||
/* -------  Start of section using anonymous unions and disabling warnings  ------- */
 | 
			
		||||
#if   defined (__CC_ARM)
 | 
			
		||||
  #pragma push
 | 
			
		||||
  #pragma anon_unions
 | 
			
		||||
#elif defined (__ICCARM__)
 | 
			
		||||
  #pragma language=extended
 | 
			
		||||
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
 | 
			
		||||
  #pragma clang diagnostic push
 | 
			
		||||
  #pragma clang diagnostic ignored "-Wc11-extensions"
 | 
			
		||||
  #pragma clang diagnostic ignored "-Wreserved-id-macro"
 | 
			
		||||
#elif defined (__GNUC__)
 | 
			
		||||
  /* anonymous unions are enabled by default */
 | 
			
		||||
#elif defined (__TMS470__)
 | 
			
		||||
  /* anonymous unions are enabled by default */
 | 
			
		||||
#elif defined (__TASKING__)
 | 
			
		||||
  #pragma warning 586
 | 
			
		||||
#elif defined (__CSMC__)
 | 
			
		||||
  /* anonymous unions are enabled by default */
 | 
			
		||||
#else
 | 
			
		||||
  #warning Not supported compiler type
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* --------  Configuration of Core Peripherals  ----------------------------------- */
 | 
			
		||||
#define __CM4_REV                 0x0000U   /* Core revision r0p0 */
 | 
			
		||||
#define __MPU_PRESENT             1U        /* MPU present */
 | 
			
		||||
#define __VTOR_PRESENT            1U        /* VTOR present */
 | 
			
		||||
#define __NVIC_PRIO_BITS          3U        /* Number of Bits used for Priority Levels */
 | 
			
		||||
#define __Vendor_SysTickConfig    0U        /* Set to 1 if different SysTick Config is used */
 | 
			
		||||
#define __FPU_PRESENT             1U        /* FPU present */
 | 
			
		||||
#define __FPU_DP                  0U        /* unused */
 | 
			
		||||
#define __ICACHE_PRESENT          1U
 | 
			
		||||
#define __DCACHE_PRESENT          1U
 | 
			
		||||
 | 
			
		||||
#include "core_cm7.h"                       /* Processor and core peripherals */
 | 
			
		||||
#if defined CMSDK_CM7_SP_VHT
 | 
			
		||||
#include "arm_vio.h"
 | 
			
		||||
#include "arm_vsi.h"
 | 
			
		||||
#include "arm_vsocket.h"
 | 
			
		||||
#endif
 | 
			
		||||
// #include "system_CMSDK_CM7.h"               /* System Header */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* ================================================================================ */
 | 
			
		||||
/* ================       Device Specific Peripheral Section       ================ */
 | 
			
		||||
/* ================================================================================ */
 | 
			
		||||
 | 
			
		||||
/*------------- Universal Asynchronous Receiver Transmitter (UART) -----------*/
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  __IOM  uint32_t  DATA;                     /* Offset: 0x000 (R/W) Data Register    */
 | 
			
		||||
  __IOM  uint32_t  STATE;                    /* Offset: 0x004 (R/W) Status Register  */
 | 
			
		||||
  __IOM  uint32_t  CTRL;                     /* Offset: 0x008 (R/W) Control Register */
 | 
			
		||||
  union {
 | 
			
		||||
    __IM   uint32_t  INTSTATUS;              /* Offset: 0x00C (R/ ) Interrupt Status Register */
 | 
			
		||||
    __OM   uint32_t  INTCLEAR;               /* Offset: 0x00C ( /W) Interrupt Clear Register  */
 | 
			
		||||
    };
 | 
			
		||||
  __IOM  uint32_t  BAUDDIV;                  /* Offset: 0x010 (R/W) Baudrate Divider Register */
 | 
			
		||||
 | 
			
		||||
} CMSDK_UART_TypeDef;
 | 
			
		||||
 | 
			
		||||
/* CMSDK_UART DATA Register Definitions */
 | 
			
		||||
#define CMSDK_UART_DATA_Pos               0                                                  /* CMSDK_UART_DATA_Pos: DATA Position */
 | 
			
		||||
#define CMSDK_UART_DATA_Msk              (0xFFUL /*<< CMSDK_UART_DATA_Pos*/)                 /* CMSDK_UART DATA: DATA Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_UART STATE Register Definitions */
 | 
			
		||||
#define CMSDK_UART_STATE_RXOR_Pos         3                                                  /* CMSDK_UART STATE: RXOR Position */
 | 
			
		||||
#define CMSDK_UART_STATE_RXOR_Msk        (0x1UL << CMSDK_UART_STATE_RXOR_Pos)                /* CMSDK_UART STATE: RXOR Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_STATE_TXOR_Pos         2                                                  /* CMSDK_UART STATE: TXOR Position */
 | 
			
		||||
#define CMSDK_UART_STATE_TXOR_Msk        (0x1UL << CMSDK_UART_STATE_TXOR_Pos)                /* CMSDK_UART STATE: TXOR Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_STATE_RXBF_Pos         1                                                  /* CMSDK_UART STATE: RXBF Position */
 | 
			
		||||
#define CMSDK_UART_STATE_RXBF_Msk        (0x1UL << CMSDK_UART_STATE_RXBF_Pos)                /* CMSDK_UART STATE: RXBF Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_STATE_TXBF_Pos         0                                                  /* CMSDK_UART STATE: TXBF Position */
 | 
			
		||||
#define CMSDK_UART_STATE_TXBF_Msk        (0x1UL /*<< CMSDK_UART_STATE_TXBF_Pos*/)            /* CMSDK_UART STATE: TXBF Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_UART CTRL Register Definitions */
 | 
			
		||||
#define CMSDK_UART_CTRL_HSTM_Pos          6                                                  /* CMSDK_UART CTRL: HSTM Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_HSTM_Msk         (0x01UL << CMSDK_UART_CTRL_HSTM_Pos)                /* CMSDK_UART CTRL: HSTM Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_CTRL_RXORIRQEN_Pos     5                                                  /* CMSDK_UART CTRL: RXORIRQEN Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_RXORIRQEN_Msk    (0x01UL << CMSDK_UART_CTRL_RXORIRQEN_Pos)           /* CMSDK_UART CTRL: RXORIRQEN Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_CTRL_TXORIRQEN_Pos     4                                                  /* CMSDK_UART CTRL: TXORIRQEN Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_TXORIRQEN_Msk    (0x01UL << CMSDK_UART_CTRL_TXORIRQEN_Pos)           /* CMSDK_UART CTRL: TXORIRQEN Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_CTRL_RXIRQEN_Pos       3                                                  /* CMSDK_UART CTRL: RXIRQEN Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_RXIRQEN_Msk      (0x01UL << CMSDK_UART_CTRL_RXIRQEN_Pos)             /* CMSDK_UART CTRL: RXIRQEN Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_CTRL_TXIRQEN_Pos       2                                                  /* CMSDK_UART CTRL: TXIRQEN Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_TXIRQEN_Msk      (0x01UL << CMSDK_UART_CTRL_TXIRQEN_Pos)             /* CMSDK_UART CTRL: TXIRQEN Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_CTRL_RXEN_Pos          1                                                  /* CMSDK_UART CTRL: RXEN Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_RXEN_Msk         (0x01UL << CMSDK_UART_CTRL_RXEN_Pos)                /* CMSDK_UART CTRL: RXEN Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_CTRL_TXEN_Pos          0                                                  /* CMSDK_UART CTRL: TXEN Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_TXEN_Msk         (0x01UL /*<< CMSDK_UART_CTRL_TXEN_Pos*/)            /* CMSDK_UART CTRL: TXEN Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_INTSTATUS_RXORIRQ_Pos  3                                                  /* CMSDK_UART CTRL: RXORIRQ Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_RXORIRQ_Msk      (0x01UL << CMSDK_UART_INTSTATUS_RXORIRQ_Pos)        /* CMSDK_UART CTRL: RXORIRQ Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_CTRL_TXORIRQ_Pos       2                                                  /* CMSDK_UART CTRL: TXORIRQ Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_TXORIRQ_Msk      (0x01UL << CMSDK_UART_CTRL_TXORIRQ_Pos)             /* CMSDK_UART CTRL: TXORIRQ Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_CTRL_RXIRQ_Pos         1                                                  /* CMSDK_UART CTRL: RXIRQ Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_RXIRQ_Msk        (0x01UL << CMSDK_UART_CTRL_RXIRQ_Pos)               /* CMSDK_UART CTRL: RXIRQ Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART_CTRL_TXIRQ_Pos         0                                                  /* CMSDK_UART CTRL: TXIRQ Position */
 | 
			
		||||
#define CMSDK_UART_CTRL_TXIRQ_Msk        (0x01UL /*<< CMSDK_UART_CTRL_TXIRQ_Pos*/)           /* CMSDK_UART CTRL: TXIRQ Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_UART BAUDDIV Register Definitions */
 | 
			
		||||
#define CMSDK_UART_BAUDDIV_Pos            0                                                  /* CMSDK_UART BAUDDIV: BAUDDIV Position */
 | 
			
		||||
#define CMSDK_UART_BAUDDIV_Msk           (0xFFFFFUL /*<< CMSDK_UART_BAUDDIV_Pos*/)           /* CMSDK_UART BAUDDIV: BAUDDIV Mask */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*----------------------------- Timer (TIMER) -------------------------------*/
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  __IOM  uint32_t  CTRL;                     /* Offset: 0x000 (R/W) Control Register */
 | 
			
		||||
  __IOM  uint32_t  VALUE;                    /* Offset: 0x004 (R/W) Current Value Register */
 | 
			
		||||
  __IOM  uint32_t  RELOAD;                   /* Offset: 0x008 (R/W) Reload Value Register */
 | 
			
		||||
  union {
 | 
			
		||||
    __IM   uint32_t  INTSTATUS;              /* Offset: 0x00C (R/ ) Interrupt Status Register */
 | 
			
		||||
    __OM   uint32_t  INTCLEAR;               /* Offset: 0x00C ( /W) Interrupt Clear Register */
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
} CMSDK_TIMER_TypeDef;
 | 
			
		||||
 | 
			
		||||
/* CMSDK_TIMER CTRL Register Definitions */
 | 
			
		||||
#define CMSDK_TIMER_CTRL_IRQEN_Pos          3                                                /* CMSDK_TIMER CTRL: IRQEN Position */
 | 
			
		||||
#define CMSDK_TIMER_CTRL_IRQEN_Msk         (0x01UL << CMSDK_TIMER_CTRL_IRQEN_Pos)            /* CMSDK_TIMER CTRL: IRQEN Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_TIMER_CTRL_SELEXTCLK_Pos      2                                                /* CMSDK_TIMER CTRL: SELEXTCLK Position */
 | 
			
		||||
#define CMSDK_TIMER_CTRL_SELEXTCLK_Msk     (0x01UL << CMSDK_TIMER_CTRL_SELEXTCLK_Pos)        /* CMSDK_TIMER CTRL: SELEXTCLK Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_TIMER_CTRL_SELEXTEN_Pos       1                                                /* CMSDK_TIMER CTRL: SELEXTEN Position */
 | 
			
		||||
#define CMSDK_TIMER_CTRL_SELEXTEN_Msk      (0x01UL << CMSDK_TIMER_CTRL_SELEXTEN_Pos)         /* CMSDK_TIMER CTRL: SELEXTEN Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_TIMER_CTRL_EN_Pos             0                                                /* CMSDK_TIMER CTRL: EN Position */
 | 
			
		||||
#define CMSDK_TIMER_CTRL_EN_Msk            (0x01UL /*<< CMSDK_TIMER_CTRL_EN_Pos*/)           /* CMSDK_TIMER CTRL: EN Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_TIMER VAL Register Definitions */
 | 
			
		||||
#define CMSDK_TIMER_VAL_CURRENT_Pos         0                                                /* CMSDK_TIMER VALUE: CURRENT Position */
 | 
			
		||||
#define CMSDK_TIMER_VAL_CURRENT_Msk        (0xFFFFFFFFUL /*<< CMSDK_TIMER_VAL_CURRENT_Pos*/) /* CMSDK_TIMER VALUE: CURRENT Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_TIMER RELOAD Register Definitions */
 | 
			
		||||
#define CMSDK_TIMER_RELOAD_VAL_Pos          0                                                /* CMSDK_TIMER RELOAD: RELOAD Position */
 | 
			
		||||
#define CMSDK_TIMER_RELOAD_VAL_Msk         (0xFFFFFFFFUL /*<< CMSDK_TIMER_RELOAD_VAL_Pos*/)  /* CMSDK_TIMER RELOAD: RELOAD Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_TIMER INTSTATUS Register Definitions */
 | 
			
		||||
#define CMSDK_TIMER_INTSTATUS_Pos           0                                                /* CMSDK_TIMER INTSTATUS: INTSTATUSPosition */
 | 
			
		||||
#define CMSDK_TIMER_INTSTATUS_Msk          (0x01UL /*<< CMSDK_TIMER_INTSTATUS_Pos*/)         /* CMSDK_TIMER INTSTATUS: INTSTATUSMask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_TIMER INTCLEAR Register Definitions */
 | 
			
		||||
#define CMSDK_TIMER_INTCLEAR_Pos            0                                                /* CMSDK_TIMER INTCLEAR: INTCLEAR Position */
 | 
			
		||||
#define CMSDK_TIMER_INTCLEAR_Msk           (0x01UL /*<< CMSDK_TIMER_INTCLEAR_Pos*/)          /* CMSDK_TIMER INTCLEAR: INTCLEAR Mask */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*------------- Timer (TIM) --------------------------------------------------*/
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  __IOM uint32_t T1LOAD;                     /* Offset: 0x000 (R/W) Timer 1 Load */
 | 
			
		||||
  __IM  uint32_t T1VALUE;                    /* Offset: 0x004 (R/ ) Timer 1 Counter Current Value */
 | 
			
		||||
  __IOM uint32_t T1CTRL;                     /* Offset: 0x008 (R/W) Timer 1 Control */
 | 
			
		||||
  __OM  uint32_t T1INTCLR;                   /* Offset: 0x00C ( /W) Timer 1 Interrupt Clear */
 | 
			
		||||
  __IM  uint32_t T1RIS;                      /* Offset: 0x010 (R/ ) Timer 1 Raw Interrupt Status */
 | 
			
		||||
  __IM  uint32_t T1MIS;                      /* Offset: 0x014 (R/ ) Timer 1 Masked Interrupt Status */
 | 
			
		||||
  __IOM uint32_t T1BGLOAD;                   /* Offset: 0x018 (R/W) Background Load Register */
 | 
			
		||||
        uint32_t RESERVED0;
 | 
			
		||||
  __IOM uint32_t T2LOAD;                     /* Offset: 0x020 (R/W) Timer 2 Load */
 | 
			
		||||
  __IM  uint32_t T2VALUE;                    /* Offset: 0x024 (R/ ) Timer 2 Counter Current Value */
 | 
			
		||||
  __IOM uint32_t T2CTRL;                     /* Offset: 0x028 (R/W) Timer 2 Control */
 | 
			
		||||
  __OM  uint32_t T2INTCLR;                   /* Offset: 0x02C ( /W) Timer 2 Interrupt Clear */
 | 
			
		||||
  __IM  uint32_t T2RIS;                      /* Offset: 0x030 (R/ ) Timer 2 Raw Interrupt Status */
 | 
			
		||||
  __IM  uint32_t T2MIS;                      /* Offset: 0x034 (R/ ) Timer 2 Masked Interrupt Status */
 | 
			
		||||
  __IOM uint32_t T2BGLOAD;                   /* Offset: 0x038 (R/W) Background Load Register */
 | 
			
		||||
        uint32_t RESERVED1[945];
 | 
			
		||||
  __IOM uint32_t ITCR;                       /* Offset: 0xF00 (R/W) Integration Test Control Register */
 | 
			
		||||
  __OM  uint32_t ITOP;                       /* Offset: 0xF04 ( /W) Integration Test Output Set Register */
 | 
			
		||||
} CMSDK_DUALTIMER_BOTH_TypeDef;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  __IOM uint32_t LOAD;                       /* Offset: 0x000 (R/W) Timer Load */
 | 
			
		||||
  __IM  uint32_t VALUE;                      /* Offset: 0x000 (R/W) Timer Counter Current Value */
 | 
			
		||||
  __IOM uint32_t CTRL;                       /* Offset: 0x000 (R/W) Timer Control */
 | 
			
		||||
  __OM  uint32_t INTCLR;                     /* Offset: 0x000 (R/W) Timer Interrupt Clear */
 | 
			
		||||
  __IM  uint32_t RIS;                        /* Offset: 0x000 (R/W) Timer Raw Interrupt Status */
 | 
			
		||||
  __IM  uint32_t MIS;                        /* Offset: 0x000 (R/W) Timer Masked Interrupt Status */
 | 
			
		||||
  __IOM uint32_t BGLOAD;                     /* Offset: 0x000 (R/W) Background Load Register */
 | 
			
		||||
} CMSDK_DUALTIMER_SINGLE_TypeDef;
 | 
			
		||||
 | 
			
		||||
/* CMSDK_DUALTIMER_SINGLE LOAD Register Definitions */
 | 
			
		||||
#define CMSDK_DUALTIMER_LOAD_Pos             0                                               /* CMSDK_DUALTIMER LOAD: LOAD Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_LOAD_Msk            (0xFFFFFFFFUL /*<< CMSDK_DUALTIMER_LOAD_Pos*/)   /* CMSDK_DUALTIMER LOAD: LOAD Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_DUALTIMER_SINGLE VALUE Register Definitions */
 | 
			
		||||
#define CMSDK_DUALTIMER_VALUE_Pos            0                                               /* CMSDK_DUALTIMER VALUE: VALUE Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_VALUE_Msk           (0xFFFFFFFFUL /*<< CMSDK_DUALTIMER_VALUE_Pos*/)  /* CMSDK_DUALTIMER VALUE: VALUE Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_DUALTIMER_SINGLE CTRL Register Definitions */
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_EN_Pos          7                                               /* CMSDK_DUALTIMER CTRL_EN: CTRL Enable Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_EN_Msk         (0x1UL << CMSDK_DUALTIMER_CTRL_EN_Pos)           /* CMSDK_DUALTIMER CTRL_EN: CTRL Enable Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_MODE_Pos        6                                               /* CMSDK_DUALTIMER CTRL_MODE: CTRL MODE Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_MODE_Msk       (0x1UL << CMSDK_DUALTIMER_CTRL_MODE_Pos)         /* CMSDK_DUALTIMER CTRL_MODE: CTRL MODE Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_INTEN_Pos       5                                               /* CMSDK_DUALTIMER CTRL_INTEN: CTRL Int Enable Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_INTEN_Msk      (0x1UL << CMSDK_DUALTIMER_CTRL_INTEN_Pos)        /* CMSDK_DUALTIMER CTRL_INTEN: CTRL Int Enable Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_PRESCALE_Pos    2                                               /* CMSDK_DUALTIMER CTRL_PRESCALE: CTRL PRESCALE Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_PRESCALE_Msk   (0x3UL << CMSDK_DUALTIMER_CTRL_PRESCALE_Pos)     /* CMSDK_DUALTIMER CTRL_PRESCALE: CTRL PRESCALE Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_SIZE_Pos        1                                               /* CMSDK_DUALTIMER CTRL_SIZE: CTRL SIZE Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_SIZE_Msk       (0x1UL << CMSDK_DUALTIMER_CTRL_SIZE_Pos)         /* CMSDK_DUALTIMER CTRL_SIZE: CTRL SIZE Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_ONESHOOT_Pos    0                                               /* CMSDK_DUALTIMER CTRL_ONESHOOT: CTRL ONESHOOT Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_CTRL_ONESHOOT_Msk   (0x1UL /*<< CMSDK_DUALTIMER_CTRL_ONESHOOT_Pos*/) /* CMSDK_DUALTIMER CTRL_ONESHOOT: CTRL ONESHOOT Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_DUALTIMER_SINGLE INTCLR Register Definitions */
 | 
			
		||||
#define CMSDK_DUALTIMER_INTCLR_Pos           0                                               /* CMSDK_DUALTIMER INTCLR: INT Clear Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_INTCLR_Msk          (0x1UL /*<< CMSDK_DUALTIMER_INTCLR_Pos*/)        /* CMSDK_DUALTIMER INTCLR: INT Clear  Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_DUALTIMER_SINGLE RIS Register Definitions */
 | 
			
		||||
#define CMSDK_DUALTIMER_RIS_Pos              0                                               /* CMSDK_DUALTIMER RAWINTSTAT: Raw Int Status Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_RIS_Msk             (0x1UL /*<< CMSDK_DUALTIMER_RAWINTSTAT_Pos*/)    /* CMSDK_DUALTIMER RAWINTSTAT: Raw Int Status Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_DUALTIMER_SINGLE MIS Register Definitions */
 | 
			
		||||
#define CMSDK_DUALTIMER_MIS_Pos              0                                               /* CMSDK_DUALTIMER MASKINTSTAT: Mask Int Status Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_MIS_Msk             (0x1UL /*<< CMSDK_DUALTIMER_MASKINTSTAT_Pos*/)   /* CMSDK_DUALTIMER MASKINTSTAT: Mask Int Status Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_DUALTIMER_SINGLE BGLOAD Register Definitions */
 | 
			
		||||
#define CMSDK_DUALTIMER_BGLOAD_Pos           0                                               /* CMSDK_DUALTIMER BGLOAD: Background Load Position */
 | 
			
		||||
#define CMSDK_DUALTIMER_BGLOAD_Msk          (0xFFFFFFFFUL /*<< CMSDK_DUALTIMER_BGLOAD_Pos*/) /* CMSDK_DUALTIMER BGLOAD: Background Load Mask */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*-------------------- General Purpose Input Output (GPIO) -------------------*/
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  __IOM  uint32_t  DATA;                     /* Offset: 0x000 (R/W) DATA Register */
 | 
			
		||||
  __IOM  uint32_t  DATAOUT;                  /* Offset: 0x004 (R/W) Data Output Latch Register */
 | 
			
		||||
         uint32_t  RESERVED0[2];
 | 
			
		||||
  __IOM  uint32_t  OUTENSET;                 /* Offset: 0x010 (R/W) Output Enable Set Register */
 | 
			
		||||
  __IOM  uint32_t  OUTENCLR;                 /* Offset: 0x014 (R/W) Output Enable Clear Register */
 | 
			
		||||
  __IOM  uint32_t  ALTFUNCSET;               /* Offset: 0x018 (R/W) Alternate Function Set Register */
 | 
			
		||||
  __IOM  uint32_t  ALTFUNCCLR;               /* Offset: 0x01C (R/W) Alternate Function Clear Register */
 | 
			
		||||
  __IOM  uint32_t  INTENSET;                 /* Offset: 0x020 (R/W) Interrupt Enable Set Register */
 | 
			
		||||
  __IOM  uint32_t  INTENCLR;                 /* Offset: 0x024 (R/W) Interrupt Enable Clear Register */
 | 
			
		||||
  __IOM  uint32_t  INTTYPESET;               /* Offset: 0x028 (R/W) Interrupt Type Set Register */
 | 
			
		||||
  __IOM  uint32_t  INTTYPECLR;               /* Offset: 0x02C (R/W) Interrupt Type Clear Register */
 | 
			
		||||
  __IOM  uint32_t  INTPOLSET;                /* Offset: 0x030 (R/W) Interrupt Polarity Set Register */
 | 
			
		||||
  __IOM  uint32_t  INTPOLCLR;                /* Offset: 0x034 (R/W) Interrupt Polarity Clear Register */
 | 
			
		||||
  union {
 | 
			
		||||
    __IM   uint32_t  INTSTATUS;              /* Offset: 0x038 (R/ ) Interrupt Status Register */
 | 
			
		||||
    __OM   uint32_t  INTCLEAR;               /* Offset: 0x038 ( /W) Interrupt Clear Register */
 | 
			
		||||
    };
 | 
			
		||||
         uint32_t RESERVED1[241];
 | 
			
		||||
  __IOM  uint32_t LB_MASKED[256];            /* Offset: 0x400 - 0x7FC Lower byte Masked Access Register (R/W) */
 | 
			
		||||
  __IOM  uint32_t UB_MASKED[256];            /* Offset: 0x800 - 0xBFC Upper byte Masked Access Register (R/W) */
 | 
			
		||||
} CMSDK_GPIO_TypeDef;
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO DATA Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_DATA_Pos            0                                                     /* CMSDK_GPIO DATA: DATA Position */
 | 
			
		||||
#define CMSDK_GPIO_DATA_Msk           (0xFFFFUL /*<< CMSDK_GPIO_DATA_Pos*/)                  /* CMSDK_GPIO DATA: DATA Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO DATAOUT Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_DATAOUT_Pos         0                                                     /* CMSDK_GPIO DATAOUT: DATAOUT Position */
 | 
			
		||||
#define CMSDK_GPIO_DATAOUT_Msk        (0xFFFFUL /*<< CMSDK_GPIO_DATAOUT_Pos*/)               /* CMSDK_GPIO DATAOUT: DATAOUT Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO OUTENSET Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_OUTENSET_Pos        0                                                     /* CMSDK_GPIO OUTEN: OUTEN Position */
 | 
			
		||||
#define CMSDK_GPIO_OUTENSET_Msk       (0xFFFFUL /*<< CMSDK_GPIO_OUTEN_Pos*/)                 /* CMSDK_GPIO OUTEN: OUTEN Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO OUTENCLR Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_OUTENCLR_Pos        0                                                     /* CMSDK_GPIO OUTEN: OUTEN Position */
 | 
			
		||||
#define CMSDK_GPIO_OUTENCLR_Msk       (0xFFFFUL /*<< CMSDK_GPIO_OUTEN_Pos*/)                 /* CMSDK_GPIO OUTEN: OUTEN Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO ALTFUNCSET Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_ALTFUNCSET_Pos      0                                                     /* CMSDK_GPIO ALTFUNC: ALTFUNC Position */
 | 
			
		||||
#define CMSDK_GPIO_ALTFUNCSET_Msk     (0xFFFFUL /*<< CMSDK_GPIO_ALTFUNC_Pos*/)               /* CMSDK_GPIO ALTFUNC: ALTFUNC Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO ALTFUNCCLR Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_ALTFUNCCLR_Pos      0                                                     /* CMSDK_GPIO ALTFUNC: ALTFUNC Position */
 | 
			
		||||
#define CMSDK_GPIO_ALTFUNCCLR_Msk     (0xFFFFUL /*<< CMSDK_GPIO_ALTFUNC_Pos*/)               /* CMSDK_GPIO ALTFUNC: ALTFUNC Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO INTENSET Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_INTENSET_Pos        0                                                     /* CMSDK_GPIO INTEN: INTEN Position */
 | 
			
		||||
#define CMSDK_GPIO_INTENSET_Msk       (0xFFFFUL /*<< CMSDK_GPIO_INTEN_Pos*/)                 /* CMSDK_GPIO INTEN: INTEN Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO INTENCLR Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_INTENCLR_Pos        0                                                     /* CMSDK_GPIO INTEN: INTEN Position */
 | 
			
		||||
#define CMSDK_GPIO_INTENCLR_Msk       (0xFFFFUL /*<< CMSDK_GPIO_INTEN_Pos*/)                 /* CMSDK_GPIO INTEN: INTEN Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO INTTYPESET Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_INTTYPESET_Pos      0                                                     /* CMSDK_GPIO INTTYPE: INTTYPE Position */
 | 
			
		||||
#define CMSDK_GPIO_INTTYPESET_Msk     (0xFFFFUL /*<< CMSDK_GPIO_INTTYPE_Pos*/)               /* CMSDK_GPIO INTTYPE: INTTYPE Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO INTTYPECLR Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_INTTYPECLR_Pos      0                                                     /* CMSDK_GPIO INTTYPE: INTTYPE Position */
 | 
			
		||||
#define CMSDK_GPIO_INTTYPECLR_Msk     (0xFFFFUL /*<< CMSDK_GPIO_INTTYPE_Pos*/)               /* CMSDK_GPIO INTTYPE: INTTYPE Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO INTPOLSET Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_INTPOLSET_Pos       0                                                     /* CMSDK_GPIO INTPOL: INTPOL Position */
 | 
			
		||||
#define CMSDK_GPIO_INTPOLSET_Msk      (0xFFFFUL /*<< CMSDK_GPIO_INTPOL_Pos*/)                /* CMSDK_GPIO INTPOL: INTPOL Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO INTPOLCLR Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_INTPOLCLR_Pos       0                                                     /* CMSDK_GPIO INTPOL: INTPOL Position */
 | 
			
		||||
#define CMSDK_GPIO_INTPOLCLR_Msk      (0xFFFFUL /*<< CMSDK_GPIO_INTPOL_Pos*/)                /* CMSDK_GPIO INTPOL: INTPOL Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO INTCLEAR Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_INTSTATUS_Pos       0                                                     /* CMSDK_GPIO INTSTATUS: INTSTATUS Position */
 | 
			
		||||
#define CMSDK_GPIO_INTCLEAR_Msk       (0xFFUL /*<< CMSDK_GPIO_INTSTATUS_Pos*/)               /* CMSDK_GPIO INTSTATUS: INTSTATUS Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO INTCLEAR Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_INTCLEAR_Pos        0                                                     /* CMSDK_GPIO INTCLEAR: INTCLEAR Position */
 | 
			
		||||
#define CMSDK_GPIO_INTCLEAR_Msk       (0xFFUL /*<< CMSDK_GPIO_INTCLEAR_Pos*/)                /* CMSDK_GPIO INTCLEAR: INTCLEAR Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO MASKLOWBYTE Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_MASKLOWBYTE_Pos     0                                                     /* CMSDK_GPIO MASKLOWBYTE: MASKLOWBYTE Position */
 | 
			
		||||
#define CMSDK_GPIO_MASKLOWBYTE_Msk    (0x00FFUL /*<< CMSDK_GPIO_MASKLOWBYTE_Pos*/)           /* CMSDK_GPIO MASKLOWBYTE: MASKLOWBYTE Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_GPIO MASKHIGHBYTE Register Definitions */
 | 
			
		||||
#define CMSDK_GPIO_MASKHIGHBYTE_Pos    0                                                     /* CMSDK_GPIO MASKHIGHBYTE: MASKHIGHBYTE Position */
 | 
			
		||||
#define CMSDK_GPIO_MASKHIGHBYTE_Msk   (0xFF00UL /*<< CMSDK_GPIO_MASKHIGHBYTE_Pos*/)          /* CMSDK_GPIO MASKHIGHBYTE: MASKHIGHBYTE Mask */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*------------- System Control (SYSCON) --------------------------------------*/
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
  __IOM  uint32_t  REMAP;                    /* Offset: 0x000 (R/W) Remap Control Register */
 | 
			
		||||
  __IOM  uint32_t  PMUCTRL;                  /* Offset: 0x004 (R/W) PMU Control Register */
 | 
			
		||||
  __IOM  uint32_t  RESETOP;                  /* Offset: 0x008 (R/W) Reset Option Register */
 | 
			
		||||
  __IOM  uint32_t  EMICTRL;                  /* Offset: 0x00C (R/W) EMI Control Register */
 | 
			
		||||
  __IOM  uint32_t  RSTINFO;                  /* Offset: 0x010 (R/W) Reset Information Register */
 | 
			
		||||
} CMSDK_SYSCON_TypeDef;
 | 
			
		||||
 | 
			
		||||
/* CMSDK_SYSCON REMAP Register Definitions */
 | 
			
		||||
#define CMSDK_SYSCON_REMAP_Pos                 0
 | 
			
		||||
#define CMSDK_SYSCON_REMAP_Msk                (0x1UL /*<< CMSDK_SYSCON_REMAP_Pos*/)          /* CMSDK_SYSCON MEME_CTRL: REMAP Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_SYSCON PMUCTRL Register Definitions */
 | 
			
		||||
#define CMSDK_SYSCON_PMUCTRL_EN_Pos            0
 | 
			
		||||
#define CMSDK_SYSCON_PMUCTRL_EN_Msk           (0x1UL /*<< CMSDK_SYSCON_PMUCTRL_EN_Pos*/)     /* CMSDK_SYSCON PMUCTRL: PMUCTRL ENABLE Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_SYSCON LOCKUPRST Register Definitions */
 | 
			
		||||
#define CMSDK_SYSCON_LOCKUPRST_RESETOP_Pos     0
 | 
			
		||||
#define CMSDK_SYSCON_LOCKUPRST_RESETOP_Msk    (0x1UL /*<< CMSDK_SYSCON_LOCKUPRST_RESETOP_Pos*/)   /* CMSDK_SYSCON SYS_CTRL: LOCKUP RESET ENABLE Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_SYSCON EMICTRL Register Definitions */
 | 
			
		||||
#define CMSDK_SYSCON_EMICTRL_SIZE_Pos         24
 | 
			
		||||
#define CMSDK_SYSCON_EMICTRL_SIZE_Msk         (0x1UL << CMSDK_SYSCON_EMICTRL_SIZE_Pos)       /* CMSDK_SYSCON EMICTRL: SIZE Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_SYSCON_EMICTRL_TACYC_Pos        16
 | 
			
		||||
#define CMSDK_SYSCON_EMICTRL_TACYC_Msk        (0x7UL << CMSDK_SYSCON_EMICTRL_TACYC_Pos)      /* CMSDK_SYSCON EMICTRL: TURNAROUNDCYCLE Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_SYSCON_EMICTRL_WCYC_Pos          8
 | 
			
		||||
#define CMSDK_SYSCON_EMICTRL_WCYC_Msk         (0x3UL << CMSDK_SYSCON_EMICTRL_WCYC_Pos)       /* CMSDK_SYSCON EMICTRL: WRITECYCLE Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_SYSCON_EMICTRL_RCYC_Pos          0
 | 
			
		||||
#define CMSDK_SYSCON_EMICTRL_RCYC_Msk         (0x7UL /*<< CMSDK_SYSCON_EMICTRL_RCYC_Pos*/)   /* CMSDK_SYSCON EMICTRL: READCYCLE Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_SYSCON RSTINFO Register Definitions */
 | 
			
		||||
#define CMSDK_SYSCON_RSTINFO_LOCKUPRESET_Pos   2
 | 
			
		||||
#define CMSDK_SYSCON_RSTINFO_LOCKUPRESET_Msk  (0x1UL << CMSDK_SYSCON_RSTINFO_LOCKUPRESET_Pos)     /* CMSDK_SYSCON RSTINFO: LOCKUPRESET Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_SYSCON_RSTINFO_WDOGRESETREQ_Pos  1
 | 
			
		||||
#define CMSDK_SYSCON_RSTINFO_WDOGRESETREQ_Msk (0x1UL << CMSDK_SYSCON_RSTINFO_WDOGRESETREQ_Pos)    /* CMSDK_SYSCON RSTINFO: WDOGRESETREQ Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_SYSCON_RSTINFO_SYSRESETREQ_Pos   0
 | 
			
		||||
#define CMSDK_SYSCON_RSTINFO_SYSRESETREQ_Msk  (0x1UL /*<< CMSDK_SYSCON_RSTINFO_SYSRESETREQ_Pos*/) /* CMSDK_SYSCON RSTINFO: SYSRESETREQ Mask */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*------------------- Watchdog ----------------------------------------------*/
 | 
			
		||||
typedef struct
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  __IOM  uint32_t  LOAD;                    /* Offset: 0x000 (R/W) Watchdog Load Register */
 | 
			
		||||
  __IM   uint32_t  VALUE;                   /* Offset: 0x004 (R/ ) Watchdog Value Register */
 | 
			
		||||
  __IOM  uint32_t  CTRL;                    /* Offset: 0x008 (R/W) Watchdog Control Register */
 | 
			
		||||
  __OM   uint32_t  INTCLR;                  /* Offset: 0x00C ( /W) Watchdog Clear Interrupt Register */
 | 
			
		||||
  __IM   uint32_t  RAWINTSTAT;              /* Offset: 0x010 (R/ ) Watchdog Raw Interrupt Status Register */
 | 
			
		||||
  __IM   uint32_t  MASKINTSTAT;             /* Offset: 0x014 (R/ ) Watchdog Interrupt Status Register */
 | 
			
		||||
         uint32_t  RESERVED0[762];
 | 
			
		||||
  __IOM  uint32_t  LOCK;                    /* Offset: 0xC00 (R/W) Watchdog Lock Register */
 | 
			
		||||
         uint32_t  RESERVED1[191];
 | 
			
		||||
  __IOM  uint32_t  ITCR;                    /* Offset: 0xF00 (R/W) Watchdog Integration Test Control Register */
 | 
			
		||||
  __OM   uint32_t  ITOP;                    /* Offset: 0xF04 ( /W) Watchdog Integration Test Output Set Register */
 | 
			
		||||
}CMSDK_WATCHDOG_TypeDef;
 | 
			
		||||
 | 
			
		||||
/* CMSDK_WATCHDOG LOAD Register Definitions */
 | 
			
		||||
#define CMSDK_Watchdog_LOAD_Pos               0                                              /* CMSDK_Watchdog LOAD: LOAD Position */
 | 
			
		||||
#define CMSDK_Watchdog_LOAD_Msk              (0xFFFFFFFFUL /*<< CMSDK_Watchdog_LOAD_Pos*/)   /* CMSDK_Watchdog LOAD: LOAD Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_WATCHDOG VALUE Register Definitions */
 | 
			
		||||
#define CMSDK_Watchdog_VALUE_Pos              0                                              /* CMSDK_Watchdog VALUE: VALUE Position */
 | 
			
		||||
#define CMSDK_Watchdog_VALUE_Msk             (0xFFFFFFFFUL /*<< CMSDK_Watchdog_VALUE_Pos*/)  /* CMSDK_Watchdog VALUE: VALUE Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_WATCHDOG CTRL Register Definitions */
 | 
			
		||||
#define CMSDK_Watchdog_CTRL_RESEN_Pos         1                                              /* CMSDK_Watchdog CTRL_RESEN: Enable Reset Output Position */
 | 
			
		||||
#define CMSDK_Watchdog_CTRL_RESEN_Msk        (0x1UL << CMSDK_Watchdog_CTRL_RESEN_Pos)        /* CMSDK_Watchdog CTRL_RESEN: Enable Reset Output Mask */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_Watchdog_CTRL_INTEN_Pos         0                                              /* CMSDK_Watchdog CTRL_INTEN: Int Enable Position */
 | 
			
		||||
#define CMSDK_Watchdog_CTRL_INTEN_Msk        (0x1UL /*<< CMSDK_Watchdog_CTRL_INTEN_Pos*/)    /* CMSDK_Watchdog CTRL_INTEN: Int Enable Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_WATCHDOG INTCLR Register Definitions */
 | 
			
		||||
#define CMSDK_Watchdog_INTCLR_Pos             0                                              /* CMSDK_Watchdog INTCLR: Int Clear Position */
 | 
			
		||||
#define CMSDK_Watchdog_INTCLR_Msk            (0x1UL /*<< CMSDK_Watchdog_INTCLR_Pos*/)        /* CMSDK_Watchdog INTCLR: Int Clear Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_WATCHDOG RAWINTSTAT Register Definitions */
 | 
			
		||||
#define CMSDK_Watchdog_RAWINTSTAT_Pos         0                                              /* CMSDK_Watchdog RAWINTSTAT: Raw Int Status Position */
 | 
			
		||||
#define CMSDK_Watchdog_RAWINTSTAT_Msk        (0x1UL /*<< CMSDK_Watchdog_RAWINTSTAT_Pos*/)    /* CMSDK_Watchdog RAWINTSTAT: Raw Int Status Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_WATCHDOG MASKINTSTAT Register Definitions */
 | 
			
		||||
#define CMSDK_Watchdog_MASKINTSTAT_Pos        0                                              /* CMSDK_Watchdog MASKINTSTAT: Mask Int Status Position */
 | 
			
		||||
#define CMSDK_Watchdog_MASKINTSTAT_Msk       (0x1UL /*<< CMSDK_Watchdog_MASKINTSTAT_Pos*/)   /* CMSDK_Watchdog MASKINTSTAT: Mask Int Status Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_WATCHDOG LOCK Register Definitions */
 | 
			
		||||
#define CMSDK_Watchdog_LOCK_Pos               0                                              /* CMSDK_Watchdog LOCK: LOCK Position */
 | 
			
		||||
#define CMSDK_Watchdog_LOCK_Msk              (0x1UL /*<< CMSDK_Watchdog_LOCK_Pos*/)          /* CMSDK_Watchdog LOCK: LOCK Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_WATCHDOG INTEGTESTEN Register Definitions */
 | 
			
		||||
#define CMSDK_Watchdog_INTEGTESTEN_Pos        0                                              /* CMSDK_Watchdog INTEGTESTEN: Integration Test Enable Position */
 | 
			
		||||
#define CMSDK_Watchdog_INTEGTESTEN_Msk       (0x1UL /*<< CMSDK_Watchdog_INTEGTESTEN_Pos*/)   /* CMSDK_Watchdog INTEGTESTEN: Integration Test Enable Mask */
 | 
			
		||||
 | 
			
		||||
/* CMSDK_WATCHDOG INTEGTESTOUTSET Register Definitions */
 | 
			
		||||
#define CMSDK_Watchdog_INTEGTESTOUTSET_Pos    1                                                /* CMSDK_Watchdog INTEGTESTOUTSET: Integration Test Output Set Position */
 | 
			
		||||
#define CMSDK_Watchdog_INTEGTESTOUTSET_Msk   (0x1UL /*<< CMSDK_Watchdog_INTEGTESTOUTSET_Pos*/) /* CMSDK_Watchdog INTEGTESTOUTSET: Integration Test Output Set Mask */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* --------------------  End of section using anonymous unions  ------------------- */
 | 
			
		||||
#if   defined (__CC_ARM)
 | 
			
		||||
  #pragma pop
 | 
			
		||||
#elif defined (__ICCARM__)
 | 
			
		||||
  /* leave anonymous unions enabled */
 | 
			
		||||
#elif (__ARMCC_VERSION >= 6010050)
 | 
			
		||||
  #pragma clang diagnostic pop
 | 
			
		||||
#elif defined (__GNUC__)
 | 
			
		||||
  /* anonymous unions are enabled by default */
 | 
			
		||||
#elif defined (__TMS470__)
 | 
			
		||||
  /* anonymous unions are enabled by default */
 | 
			
		||||
#elif defined (__TASKING__)
 | 
			
		||||
  #pragma warning restore
 | 
			
		||||
#elif defined (__CSMC__)
 | 
			
		||||
  /* anonymous unions are enabled by default */
 | 
			
		||||
#else
 | 
			
		||||
  #warning Not supported compiler type
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* ================================================================================ */
 | 
			
		||||
/* ================              Peripheral memory map             ================ */
 | 
			
		||||
/* ================================================================================ */
 | 
			
		||||
 | 
			
		||||
/* Peripheral and SRAM base address */
 | 
			
		||||
#define CMSDK_FLASH_BASE        (0x00000000UL)
 | 
			
		||||
#define CMSDK_SRAM_BASE         (0x20000000UL)
 | 
			
		||||
#define CMSDK_PERIPH_BASE       (0x40000000UL)
 | 
			
		||||
 | 
			
		||||
#define CMSDK_RAM_BASE          (0x20000000UL)
 | 
			
		||||
#define CMSDK_APB_BASE          (0x40000000UL)
 | 
			
		||||
#define CMSDK_AHB_BASE          (0x40010000UL)
 | 
			
		||||
 | 
			
		||||
/* APB peripherals */
 | 
			
		||||
#define CMSDK_TIMER0_BASE       (CMSDK_APB_BASE + 0x0000UL)
 | 
			
		||||
#define CMSDK_TIMER1_BASE       (CMSDK_APB_BASE + 0x1000UL)
 | 
			
		||||
#define CMSDK_DUALTIMER_BASE    (CMSDK_APB_BASE + 0x2000UL)
 | 
			
		||||
#define CMSDK_DUALTIMER_1_BASE  (CMSDK_DUALTIMER_BASE)
 | 
			
		||||
#define CMSDK_DUALTIMER_2_BASE  (CMSDK_DUALTIMER_BASE + 0x20UL)
 | 
			
		||||
#define CMSDK_UART0_BASE        (CMSDK_APB_BASE + 0x4000UL)
 | 
			
		||||
#define CMSDK_UART1_BASE        (CMSDK_APB_BASE + 0x5000UL)
 | 
			
		||||
#define CMSDK_UART2_BASE        (CMSDK_APB_BASE + 0x6000UL)
 | 
			
		||||
#define CMSDK_WATCHDOG_BASE     (CMSDK_APB_BASE + 0x8000UL)
 | 
			
		||||
 | 
			
		||||
/* AHB peripherals */
 | 
			
		||||
#define CMSDK_GPIO0_BASE        (CMSDK_AHB_BASE + 0x0000UL)
 | 
			
		||||
#define CMSDK_GPIO1_BASE        (CMSDK_AHB_BASE + 0x1000UL)
 | 
			
		||||
#define CMSDK_SYSCTRL_BASE      (CMSDK_AHB_BASE + 0xF000UL)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* ================================================================================ */
 | 
			
		||||
/* ================             Peripheral declaration             ================ */
 | 
			
		||||
/* ================================================================================ */
 | 
			
		||||
 | 
			
		||||
#define CMSDK_UART0             ((CMSDK_UART_TypeDef              *) CMSDK_UART0_BASE       )
 | 
			
		||||
#define CMSDK_UART1             ((CMSDK_UART_TypeDef              *) CMSDK_UART1_BASE       )
 | 
			
		||||
#define CMSDK_UART2             ((CMSDK_UART_TypeDef              *) CMSDK_UART2_BASE       )
 | 
			
		||||
#define CMSDK_TIMER0            ((CMSDK_TIMER_TypeDef             *) CMSDK_TIMER0_BASE      )
 | 
			
		||||
#define CMSDK_TIMER1            ((CMSDK_TIMER_TypeDef             *) CMSDK_TIMER1_BASE      )
 | 
			
		||||
#define CMSDK_DUALTIMER         ((CMSDK_DUALTIMER_BOTH_TypeDef    *) CMSDK_DUALTIMER_BASE   )
 | 
			
		||||
#define CMSDK_DUALTIMER1        ((CMSDK_DUALTIMER_SINGLE_TypeDef  *) CMSDK_DUALTIMER_1_BASE )
 | 
			
		||||
#define CMSDK_DUALTIMER2        ((CMSDK_DUALTIMER_SINGLE_TypeDef  *) CMSDK_DUALTIMER_2_BASE )
 | 
			
		||||
#define CMSDK_WATCHDOG          ((CMSDK_WATCHDOG_TypeDef          *) CMSDK_WATCHDOG_BASE    )
 | 
			
		||||
#define CMSDK_GPIO0             ((CMSDK_GPIO_TypeDef              *) CMSDK_GPIO0_BASE       )
 | 
			
		||||
#define CMSDK_GPIO1             ((CMSDK_GPIO_TypeDef              *) CMSDK_GPIO1_BASE       )
 | 
			
		||||
#define CMSDK_SYSCON            ((CMSDK_SYSCON_TypeDef            *) CMSDK_SYSCTRL_BASE     )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif  /* CMSDK_CM7_SP_H */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
/*-----------------------------------------------------------------------------
 | 
			
		||||
 * Name:    Device.h
 | 
			
		||||
 * Purpose: Include the correct device header file
 | 
			
		||||
 *----------------------------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
/* Copyright (c) 2011 - 2021 ARM LIMITED
 | 
			
		||||
 | 
			
		||||
   All rights reserved.
 | 
			
		||||
   Redistribution and use in source and binary forms, with or without
 | 
			
		||||
   modification, are permitted provided that the following conditions are met:
 | 
			
		||||
   - Redistributions of source code must retain the above copyright
 | 
			
		||||
     notice, this list of conditions and the following disclaimer.
 | 
			
		||||
   - Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
     notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
     documentation and/or other materials provided with the distribution.
 | 
			
		||||
   - Neither the name of ARM nor the names of its contributors may be used
 | 
			
		||||
     to endorse or promote products derived from this software without
 | 
			
		||||
     specific prior written permission.
 | 
			
		||||
   *
 | 
			
		||||
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 | 
			
		||||
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 | 
			
		||||
   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 | 
			
		||||
   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 | 
			
		||||
   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 | 
			
		||||
   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 | 
			
		||||
   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 | 
			
		||||
   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
			
		||||
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 | 
			
		||||
   POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
   ---------------------------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
#ifndef __DEVICE_H
 | 
			
		||||
#define __DEVICE_H
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include "CMSDK_CM7_SP.h"                      /* device specific header file */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif /* __DEVICE_H */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2013-2017 ARM Limited. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the License); you may
 | 
			
		||||
 * not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 * www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * $Date:        2. Feb 2017
 | 
			
		||||
 * $Revision:    V2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Project:      Common Driver definitions
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* History:
 | 
			
		||||
 *  Version 2.0
 | 
			
		||||
 *    Changed prefix ARM_DRV -> ARM_DRIVER
 | 
			
		||||
 *    Added General return codes definitions
 | 
			
		||||
 *  Version 1.10
 | 
			
		||||
 *    Namespace prefix ARM_ added
 | 
			
		||||
 *  Version 1.00
 | 
			
		||||
 *    Initial release
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef DRIVER_COMMON_H_
 | 
			
		||||
#define DRIVER_COMMON_H_
 | 
			
		||||
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
 | 
			
		||||
#define ARM_DRIVER_VERSION_MAJOR_MINOR(major,minor) (((major) << 8) | (minor))
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
\brief Driver Version
 | 
			
		||||
*/
 | 
			
		||||
typedef struct _ARM_DRIVER_VERSION {
 | 
			
		||||
  uint16_t api;                         ///< API version
 | 
			
		||||
  uint16_t drv;                         ///< Driver version
 | 
			
		||||
} ARM_DRIVER_VERSION;
 | 
			
		||||
 | 
			
		||||
/* General return codes */
 | 
			
		||||
#define ARM_DRIVER_OK                 0 ///< Operation succeeded 
 | 
			
		||||
#define ARM_DRIVER_ERROR             -1 ///< Unspecified error
 | 
			
		||||
#define ARM_DRIVER_ERROR_BUSY        -2 ///< Driver is busy
 | 
			
		||||
#define ARM_DRIVER_ERROR_TIMEOUT     -3 ///< Timeout occurred
 | 
			
		||||
#define ARM_DRIVER_ERROR_UNSUPPORTED -4 ///< Operation not supported
 | 
			
		||||
#define ARM_DRIVER_ERROR_PARAMETER   -5 ///< Parameter error
 | 
			
		||||
#define ARM_DRIVER_ERROR_SPECIFIC    -6 ///< Start of driver specific errors 
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
\brief General power states
 | 
			
		||||
*/ 
 | 
			
		||||
typedef enum _ARM_POWER_STATE {
 | 
			
		||||
  ARM_POWER_OFF,                        ///< Power off: no operation possible
 | 
			
		||||
  ARM_POWER_LOW,                        ///< Low Power mode: retain state, detect and signal wake-up events
 | 
			
		||||
  ARM_POWER_FULL                        ///< Power on: full operation at maximum performance
 | 
			
		||||
} ARM_POWER_STATE;
 | 
			
		||||
 | 
			
		||||
#endif /* DRIVER_COMMON_H_ */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,341 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2013-2017 ARM Limited. All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: Apache-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the License); you may
 | 
			
		||||
 * not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 * www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * Unless required by applicable law or agreed to in writing, software
 | 
			
		||||
 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
 | 
			
		||||
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
			
		||||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 *
 | 
			
		||||
 * $Date:        2. Feb 2017
 | 
			
		||||
 * $Revision:    V2.3
 | 
			
		||||
 *
 | 
			
		||||
 * Project:      USART (Universal Synchronous Asynchronous Receiver Transmitter)
 | 
			
		||||
 *               Driver definitions
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* History:
 | 
			
		||||
 *  Version 2.3
 | 
			
		||||
 *    ARM_USART_STATUS and ARM_USART_MODEM_STATUS made volatile
 | 
			
		||||
 *  Version 2.2
 | 
			
		||||
 *    Corrected ARM_USART_CPOL_Pos and ARM_USART_CPHA_Pos definitions 
 | 
			
		||||
 *  Version 2.1
 | 
			
		||||
 *    Removed optional argument parameter from Signal Event
 | 
			
		||||
 *  Version 2.0
 | 
			
		||||
 *    New simplified driver:
 | 
			
		||||
 *      complexity moved to upper layer (especially data handling)
 | 
			
		||||
 *      more unified API for different communication interfaces
 | 
			
		||||
 *      renamed driver UART -> USART (Asynchronous & Synchronous)
 | 
			
		||||
 *    Added modes:
 | 
			
		||||
 *      Synchronous
 | 
			
		||||
 *      Single-wire
 | 
			
		||||
 *      IrDA
 | 
			
		||||
 *      Smart Card  
 | 
			
		||||
 *    Changed prefix ARM_DRV -> ARM_DRIVER
 | 
			
		||||
 *  Version 1.10
 | 
			
		||||
 *    Namespace prefix ARM_ added
 | 
			
		||||
 *  Version 1.01
 | 
			
		||||
 *    Added events:
 | 
			
		||||
 *      ARM_UART_EVENT_TX_EMPTY,     ARM_UART_EVENT_RX_TIMEOUT
 | 
			
		||||
 *      ARM_UART_EVENT_TX_THRESHOLD, ARM_UART_EVENT_RX_THRESHOLD
 | 
			
		||||
 *    Added functions: SetTxThreshold, SetRxThreshold
 | 
			
		||||
 *    Added "rx_timeout_event" to capabilities
 | 
			
		||||
 *  Version 1.00
 | 
			
		||||
 *    Initial release
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef DRIVER_USART_H_
 | 
			
		||||
#define DRIVER_USART_H_
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
extern "C"
 | 
			
		||||
{
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "Driver_Common.h"
 | 
			
		||||
 | 
			
		||||
#define ARM_USART_API_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(2,3)  /* API version */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/****** USART Control Codes *****/
 | 
			
		||||
 | 
			
		||||
#define ARM_USART_CONTROL_Pos                0
 | 
			
		||||
#define ARM_USART_CONTROL_Msk               (0xFFUL << ARM_USART_CONTROL_Pos)
 | 
			
		||||
 | 
			
		||||
/*----- USART Control Codes: Mode -----*/
 | 
			
		||||
#define ARM_USART_MODE_ASYNCHRONOUS         (0x01UL << ARM_USART_CONTROL_Pos)   ///< UART (Asynchronous); arg = Baudrate
 | 
			
		||||
#define ARM_USART_MODE_SYNCHRONOUS_MASTER   (0x02UL << ARM_USART_CONTROL_Pos)   ///< Synchronous Master (generates clock signal); arg = Baudrate
 | 
			
		||||
#define ARM_USART_MODE_SYNCHRONOUS_SLAVE    (0x03UL << ARM_USART_CONTROL_Pos)   ///< Synchronous Slave (external clock signal)
 | 
			
		||||
#define ARM_USART_MODE_SINGLE_WIRE          (0x04UL << ARM_USART_CONTROL_Pos)   ///< UART Single-wire (half-duplex); arg = Baudrate
 | 
			
		||||
#define ARM_USART_MODE_IRDA                 (0x05UL << ARM_USART_CONTROL_Pos)   ///< UART IrDA; arg = Baudrate
 | 
			
		||||
#define ARM_USART_MODE_SMART_CARD           (0x06UL << ARM_USART_CONTROL_Pos)   ///< UART Smart Card; arg = Baudrate
 | 
			
		||||
 | 
			
		||||
/*----- USART Control Codes: Mode Parameters: Data Bits -----*/
 | 
			
		||||
#define ARM_USART_DATA_BITS_Pos              8
 | 
			
		||||
#define ARM_USART_DATA_BITS_Msk             (7UL << ARM_USART_DATA_BITS_Pos)
 | 
			
		||||
#define ARM_USART_DATA_BITS_5               (5UL << ARM_USART_DATA_BITS_Pos)    ///< 5 Data bits
 | 
			
		||||
#define ARM_USART_DATA_BITS_6               (6UL << ARM_USART_DATA_BITS_Pos)    ///< 6 Data bit
 | 
			
		||||
#define ARM_USART_DATA_BITS_7               (7UL << ARM_USART_DATA_BITS_Pos)    ///< 7 Data bits
 | 
			
		||||
#define ARM_USART_DATA_BITS_8               (0UL << ARM_USART_DATA_BITS_Pos)    ///< 8 Data bits (default)
 | 
			
		||||
#define ARM_USART_DATA_BITS_9               (1UL << ARM_USART_DATA_BITS_Pos)    ///< 9 Data bits
 | 
			
		||||
 | 
			
		||||
/*----- USART Control Codes: Mode Parameters: Parity -----*/
 | 
			
		||||
#define ARM_USART_PARITY_Pos                 12
 | 
			
		||||
#define ARM_USART_PARITY_Msk                (3UL << ARM_USART_PARITY_Pos)
 | 
			
		||||
#define ARM_USART_PARITY_NONE               (0UL << ARM_USART_PARITY_Pos)       ///< No Parity (default)
 | 
			
		||||
#define ARM_USART_PARITY_EVEN               (1UL << ARM_USART_PARITY_Pos)       ///< Even Parity
 | 
			
		||||
#define ARM_USART_PARITY_ODD                (2UL << ARM_USART_PARITY_Pos)       ///< Odd Parity
 | 
			
		||||
 | 
			
		||||
/*----- USART Control Codes: Mode Parameters: Stop Bits -----*/
 | 
			
		||||
#define ARM_USART_STOP_BITS_Pos              14
 | 
			
		||||
#define ARM_USART_STOP_BITS_Msk             (3UL << ARM_USART_STOP_BITS_Pos)
 | 
			
		||||
#define ARM_USART_STOP_BITS_1               (0UL << ARM_USART_STOP_BITS_Pos)    ///< 1 Stop bit (default)
 | 
			
		||||
#define ARM_USART_STOP_BITS_2               (1UL << ARM_USART_STOP_BITS_Pos)    ///< 2 Stop bits
 | 
			
		||||
#define ARM_USART_STOP_BITS_1_5             (2UL << ARM_USART_STOP_BITS_Pos)    ///< 1.5 Stop bits
 | 
			
		||||
#define ARM_USART_STOP_BITS_0_5             (3UL << ARM_USART_STOP_BITS_Pos)    ///< 0.5 Stop bits
 | 
			
		||||
 | 
			
		||||
/*----- USART Control Codes: Mode Parameters: Flow Control -----*/
 | 
			
		||||
#define ARM_USART_FLOW_CONTROL_Pos           16
 | 
			
		||||
#define ARM_USART_FLOW_CONTROL_Msk          (3UL << ARM_USART_FLOW_CONTROL_Pos)
 | 
			
		||||
#define ARM_USART_FLOW_CONTROL_NONE         (0UL << ARM_USART_FLOW_CONTROL_Pos) ///< No Flow Control (default)
 | 
			
		||||
#define ARM_USART_FLOW_CONTROL_RTS          (1UL << ARM_USART_FLOW_CONTROL_Pos) ///< RTS Flow Control
 | 
			
		||||
#define ARM_USART_FLOW_CONTROL_CTS          (2UL << ARM_USART_FLOW_CONTROL_Pos) ///< CTS Flow Control
 | 
			
		||||
#define ARM_USART_FLOW_CONTROL_RTS_CTS      (3UL << ARM_USART_FLOW_CONTROL_Pos) ///< RTS/CTS Flow Control
 | 
			
		||||
 | 
			
		||||
/*----- USART Control Codes: Mode Parameters: Clock Polarity (Synchronous mode) -----*/
 | 
			
		||||
#define ARM_USART_CPOL_Pos                   18
 | 
			
		||||
#define ARM_USART_CPOL_Msk                  (1UL << ARM_USART_CPOL_Pos)
 | 
			
		||||
#define ARM_USART_CPOL0                     (0UL << ARM_USART_CPOL_Pos)         ///< CPOL = 0 (default)
 | 
			
		||||
#define ARM_USART_CPOL1                     (1UL << ARM_USART_CPOL_Pos)         ///< CPOL = 1
 | 
			
		||||
 | 
			
		||||
/*----- USART Control Codes: Mode Parameters: Clock Phase (Synchronous mode) -----*/
 | 
			
		||||
#define ARM_USART_CPHA_Pos                   19
 | 
			
		||||
#define ARM_USART_CPHA_Msk                  (1UL << ARM_USART_CPHA_Pos)
 | 
			
		||||
#define ARM_USART_CPHA0                     (0UL << ARM_USART_CPHA_Pos)         ///< CPHA = 0 (default)
 | 
			
		||||
#define ARM_USART_CPHA1                     (1UL << ARM_USART_CPHA_Pos)         ///< CPHA = 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*----- USART Control Codes: Miscellaneous Controls  -----*/
 | 
			
		||||
#define ARM_USART_SET_DEFAULT_TX_VALUE      (0x10UL << ARM_USART_CONTROL_Pos)   ///< Set default Transmit value (Synchronous Receive only); arg = value
 | 
			
		||||
#define ARM_USART_SET_IRDA_PULSE            (0x11UL << ARM_USART_CONTROL_Pos)   ///< Set IrDA Pulse in ns; arg: 0=3/16 of bit period  
 | 
			
		||||
#define ARM_USART_SET_SMART_CARD_GUARD_TIME (0x12UL << ARM_USART_CONTROL_Pos)   ///< Set Smart Card Guard Time; arg = number of bit periods
 | 
			
		||||
#define ARM_USART_SET_SMART_CARD_CLOCK      (0x13UL << ARM_USART_CONTROL_Pos)   ///< Set Smart Card Clock in Hz; arg: 0=Clock not generated
 | 
			
		||||
#define ARM_USART_CONTROL_SMART_CARD_NACK   (0x14UL << ARM_USART_CONTROL_Pos)   ///< Smart Card NACK generation; arg: 0=disabled, 1=enabled
 | 
			
		||||
#define ARM_USART_CONTROL_TX                (0x15UL << ARM_USART_CONTROL_Pos)   ///< Transmitter; arg: 0=disabled, 1=enabled
 | 
			
		||||
#define ARM_USART_CONTROL_RX                (0x16UL << ARM_USART_CONTROL_Pos)   ///< Receiver; arg: 0=disabled, 1=enabled
 | 
			
		||||
#define ARM_USART_CONTROL_BREAK             (0x17UL << ARM_USART_CONTROL_Pos)   ///< Continuous Break transmission; arg: 0=disabled, 1=enabled
 | 
			
		||||
#define ARM_USART_ABORT_SEND                (0x18UL << ARM_USART_CONTROL_Pos)   ///< Abort \ref ARM_USART_Send
 | 
			
		||||
#define ARM_USART_ABORT_RECEIVE             (0x19UL << ARM_USART_CONTROL_Pos)   ///< Abort \ref ARM_USART_Receive
 | 
			
		||||
#define ARM_USART_ABORT_TRANSFER            (0x1AUL << ARM_USART_CONTROL_Pos)   ///< Abort \ref ARM_USART_Transfer
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/****** USART specific error codes *****/
 | 
			
		||||
#define ARM_USART_ERROR_MODE                (ARM_DRIVER_ERROR_SPECIFIC - 1)     ///< Specified Mode not supported
 | 
			
		||||
#define ARM_USART_ERROR_BAUDRATE            (ARM_DRIVER_ERROR_SPECIFIC - 2)     ///< Specified baudrate not supported
 | 
			
		||||
#define ARM_USART_ERROR_DATA_BITS           (ARM_DRIVER_ERROR_SPECIFIC - 3)     ///< Specified number of Data bits not supported
 | 
			
		||||
#define ARM_USART_ERROR_PARITY              (ARM_DRIVER_ERROR_SPECIFIC - 4)     ///< Specified Parity not supported
 | 
			
		||||
#define ARM_USART_ERROR_STOP_BITS           (ARM_DRIVER_ERROR_SPECIFIC - 5)     ///< Specified number of Stop bits not supported
 | 
			
		||||
#define ARM_USART_ERROR_FLOW_CONTROL        (ARM_DRIVER_ERROR_SPECIFIC - 6)     ///< Specified Flow Control not supported
 | 
			
		||||
#define ARM_USART_ERROR_CPOL                (ARM_DRIVER_ERROR_SPECIFIC - 7)     ///< Specified Clock Polarity not supported
 | 
			
		||||
#define ARM_USART_ERROR_CPHA                (ARM_DRIVER_ERROR_SPECIFIC - 8)     ///< Specified Clock Phase not supported
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
\brief USART Status
 | 
			
		||||
*/
 | 
			
		||||
typedef volatile struct _ARM_USART_STATUS {
 | 
			
		||||
  uint32_t tx_busy          : 1;        ///< Transmitter busy flag
 | 
			
		||||
  uint32_t rx_busy          : 1;        ///< Receiver busy flag
 | 
			
		||||
  uint32_t tx_underflow     : 1;        ///< Transmit data underflow detected (cleared on start of next send operation)
 | 
			
		||||
  uint32_t rx_overflow      : 1;        ///< Receive data overflow detected (cleared on start of next receive operation)
 | 
			
		||||
  uint32_t rx_break         : 1;        ///< Break detected on receive (cleared on start of next receive operation)
 | 
			
		||||
  uint32_t rx_framing_error : 1;        ///< Framing error detected on receive (cleared on start of next receive operation)
 | 
			
		||||
  uint32_t rx_parity_error  : 1;        ///< Parity error detected on receive (cleared on start of next receive operation)
 | 
			
		||||
  uint32_t reserved         : 25;
 | 
			
		||||
} ARM_USART_STATUS;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
\brief USART Modem Control
 | 
			
		||||
*/
 | 
			
		||||
typedef enum _ARM_USART_MODEM_CONTROL {
 | 
			
		||||
  ARM_USART_RTS_CLEAR,                  ///< Deactivate RTS
 | 
			
		||||
  ARM_USART_RTS_SET,                    ///< Activate RTS
 | 
			
		||||
  ARM_USART_DTR_CLEAR,                  ///< Deactivate DTR
 | 
			
		||||
  ARM_USART_DTR_SET                     ///< Activate DTR
 | 
			
		||||
} ARM_USART_MODEM_CONTROL;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
\brief USART Modem Status
 | 
			
		||||
*/
 | 
			
		||||
typedef volatile struct _ARM_USART_MODEM_STATUS {
 | 
			
		||||
  uint32_t cts      : 1;                ///< CTS state: 1=Active, 0=Inactive
 | 
			
		||||
  uint32_t dsr      : 1;                ///< DSR state: 1=Active, 0=Inactive
 | 
			
		||||
  uint32_t dcd      : 1;                ///< DCD state: 1=Active, 0=Inactive
 | 
			
		||||
  uint32_t ri       : 1;                ///< RI  state: 1=Active, 0=Inactive
 | 
			
		||||
  uint32_t reserved : 28;
 | 
			
		||||
} ARM_USART_MODEM_STATUS;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/****** USART Event *****/
 | 
			
		||||
#define ARM_USART_EVENT_SEND_COMPLETE       (1UL << 0)  ///< Send completed; however USART may still transmit data
 | 
			
		||||
#define ARM_USART_EVENT_RECEIVE_COMPLETE    (1UL << 1)  ///< Receive completed
 | 
			
		||||
#define ARM_USART_EVENT_TRANSFER_COMPLETE   (1UL << 2)  ///< Transfer completed
 | 
			
		||||
#define ARM_USART_EVENT_TX_COMPLETE         (1UL << 3)  ///< Transmit completed (optional)
 | 
			
		||||
#define ARM_USART_EVENT_TX_UNDERFLOW        (1UL << 4)  ///< Transmit data not available (Synchronous Slave)
 | 
			
		||||
#define ARM_USART_EVENT_RX_OVERFLOW         (1UL << 5)  ///< Receive data overflow
 | 
			
		||||
#define ARM_USART_EVENT_RX_TIMEOUT          (1UL << 6)  ///< Receive character timeout (optional)
 | 
			
		||||
#define ARM_USART_EVENT_RX_BREAK            (1UL << 7)  ///< Break detected on receive
 | 
			
		||||
#define ARM_USART_EVENT_RX_FRAMING_ERROR    (1UL << 8)  ///< Framing error detected on receive
 | 
			
		||||
#define ARM_USART_EVENT_RX_PARITY_ERROR     (1UL << 9)  ///< Parity error detected on receive
 | 
			
		||||
#define ARM_USART_EVENT_CTS                 (1UL << 10) ///< CTS state changed (optional)
 | 
			
		||||
#define ARM_USART_EVENT_DSR                 (1UL << 11) ///< DSR state changed (optional)
 | 
			
		||||
#define ARM_USART_EVENT_DCD                 (1UL << 12) ///< DCD state changed (optional)
 | 
			
		||||
#define ARM_USART_EVENT_RI                  (1UL << 13) ///< RI  state changed (optional)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Function documentation
 | 
			
		||||
/**
 | 
			
		||||
  \fn          ARM_DRIVER_VERSION ARM_USART_GetVersion (void)
 | 
			
		||||
  \brief       Get driver version.
 | 
			
		||||
  \return      \ref ARM_DRIVER_VERSION
 | 
			
		||||
 | 
			
		||||
  \fn          ARM_USART_CAPABILITIES ARM_USART_GetCapabilities (void)
 | 
			
		||||
  \brief       Get driver capabilities
 | 
			
		||||
  \return      \ref ARM_USART_CAPABILITIES
 | 
			
		||||
 | 
			
		||||
  \fn          int32_t ARM_USART_Initialize (ARM_USART_SignalEvent_t cb_event)
 | 
			
		||||
  \brief       Initialize USART Interface.
 | 
			
		||||
  \param[in]   cb_event  Pointer to \ref ARM_USART_SignalEvent
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
 | 
			
		||||
  \fn          int32_t ARM_USART_Uninitialize (void)
 | 
			
		||||
  \brief       De-initialize USART Interface.
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
 | 
			
		||||
  \fn          int32_t ARM_USART_PowerControl (ARM_POWER_STATE state)
 | 
			
		||||
  \brief       Control USART Interface Power.
 | 
			
		||||
  \param[in]   state  Power state
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
 | 
			
		||||
  \fn          int32_t ARM_USART_Send (const void *data, uint32_t num)
 | 
			
		||||
  \brief       Start sending data to USART transmitter.
 | 
			
		||||
  \param[in]   data  Pointer to buffer with data to send to USART transmitter
 | 
			
		||||
  \param[in]   num   Number of data items to send
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
 | 
			
		||||
  \fn          int32_t ARM_USART_Receive (void *data, uint32_t num)
 | 
			
		||||
  \brief       Start receiving data from USART receiver.
 | 
			
		||||
  \param[out]  data  Pointer to buffer for data to receive from USART receiver
 | 
			
		||||
  \param[in]   num   Number of data items to receive
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
 | 
			
		||||
  \fn          int32_t ARM_USART_Transfer (const void *data_out,
 | 
			
		||||
                                                 void *data_in,
 | 
			
		||||
                                           uint32_t    num)
 | 
			
		||||
  \brief       Start sending/receiving data to/from USART transmitter/receiver.
 | 
			
		||||
  \param[in]   data_out  Pointer to buffer with data to send to USART transmitter
 | 
			
		||||
  \param[out]  data_in   Pointer to buffer for data to receive from USART receiver
 | 
			
		||||
  \param[in]   num       Number of data items to transfer
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
 | 
			
		||||
  \fn          uint32_t ARM_USART_GetTxCount (void)
 | 
			
		||||
  \brief       Get transmitted data count.
 | 
			
		||||
  \return      number of data items transmitted
 | 
			
		||||
 | 
			
		||||
  \fn          uint32_t ARM_USART_GetRxCount (void)
 | 
			
		||||
  \brief       Get received data count.
 | 
			
		||||
  \return      number of data items received
 | 
			
		||||
 | 
			
		||||
  \fn          int32_t ARM_USART_Control (uint32_t control, uint32_t arg)
 | 
			
		||||
  \brief       Control USART Interface.
 | 
			
		||||
  \param[in]   control  Operation
 | 
			
		||||
  \param[in]   arg      Argument of operation (optional)
 | 
			
		||||
  \return      common \ref execution_status and driver specific \ref usart_execution_status
 | 
			
		||||
 | 
			
		||||
  \fn          ARM_USART_STATUS ARM_USART_GetStatus (void)
 | 
			
		||||
  \brief       Get USART status.
 | 
			
		||||
  \return      USART status \ref ARM_USART_STATUS
 | 
			
		||||
 | 
			
		||||
  \fn          int32_t ARM_USART_SetModemControl (ARM_USART_MODEM_CONTROL control)
 | 
			
		||||
  \brief       Set USART Modem Control line state.
 | 
			
		||||
  \param[in]   control  \ref ARM_USART_MODEM_CONTROL
 | 
			
		||||
  \return      \ref execution_status 
 | 
			
		||||
 | 
			
		||||
  \fn          ARM_USART_MODEM_STATUS ARM_USART_GetModemStatus (void)
 | 
			
		||||
  \brief       Get USART Modem Status lines state.
 | 
			
		||||
  \return      modem status \ref ARM_USART_MODEM_STATUS
 | 
			
		||||
 | 
			
		||||
  \fn          void ARM_USART_SignalEvent (uint32_t event)
 | 
			
		||||
  \brief       Signal USART Events.
 | 
			
		||||
  \param[in]   event  \ref USART_events notification mask
 | 
			
		||||
  \return      none
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
typedef void (*ARM_USART_SignalEvent_t) (uint32_t event);  ///< Pointer to \ref ARM_USART_SignalEvent : Signal USART Event.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
\brief USART Device Driver Capabilities.
 | 
			
		||||
*/
 | 
			
		||||
typedef struct _ARM_USART_CAPABILITIES {
 | 
			
		||||
  uint32_t asynchronous       : 1;      ///< supports UART (Asynchronous) mode 
 | 
			
		||||
  uint32_t synchronous_master : 1;      ///< supports Synchronous Master mode
 | 
			
		||||
  uint32_t synchronous_slave  : 1;      ///< supports Synchronous Slave mode
 | 
			
		||||
  uint32_t single_wire        : 1;      ///< supports UART Single-wire mode
 | 
			
		||||
  uint32_t irda               : 1;      ///< supports UART IrDA mode
 | 
			
		||||
  uint32_t smart_card         : 1;      ///< supports UART Smart Card mode
 | 
			
		||||
  uint32_t smart_card_clock   : 1;      ///< Smart Card Clock generator available
 | 
			
		||||
  uint32_t flow_control_rts   : 1;      ///< RTS Flow Control available
 | 
			
		||||
  uint32_t flow_control_cts   : 1;      ///< CTS Flow Control available
 | 
			
		||||
  uint32_t event_tx_complete  : 1;      ///< Transmit completed event: \ref ARM_USART_EVENT_TX_COMPLETE
 | 
			
		||||
  uint32_t event_rx_timeout   : 1;      ///< Signal receive character timeout event: \ref ARM_USART_EVENT_RX_TIMEOUT
 | 
			
		||||
  uint32_t rts                : 1;      ///< RTS Line: 0=not available, 1=available
 | 
			
		||||
  uint32_t cts                : 1;      ///< CTS Line: 0=not available, 1=available
 | 
			
		||||
  uint32_t dtr                : 1;      ///< DTR Line: 0=not available, 1=available
 | 
			
		||||
  uint32_t dsr                : 1;      ///< DSR Line: 0=not available, 1=available
 | 
			
		||||
  uint32_t dcd                : 1;      ///< DCD Line: 0=not available, 1=available
 | 
			
		||||
  uint32_t ri                 : 1;      ///< RI Line: 0=not available, 1=available
 | 
			
		||||
  uint32_t event_cts          : 1;      ///< Signal CTS change event: \ref ARM_USART_EVENT_CTS
 | 
			
		||||
  uint32_t event_dsr          : 1;      ///< Signal DSR change event: \ref ARM_USART_EVENT_DSR
 | 
			
		||||
  uint32_t event_dcd          : 1;      ///< Signal DCD change event: \ref ARM_USART_EVENT_DCD
 | 
			
		||||
  uint32_t event_ri           : 1;      ///< Signal RI change event: \ref ARM_USART_EVENT_RI
 | 
			
		||||
  uint32_t reserved           : 11;     ///< Reserved (must be zero)
 | 
			
		||||
} ARM_USART_CAPABILITIES;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
\brief Access structure of the USART Driver.
 | 
			
		||||
*/
 | 
			
		||||
typedef struct _ARM_DRIVER_USART {
 | 
			
		||||
  ARM_DRIVER_VERSION     (*GetVersion)      (void);                              ///< Pointer to \ref ARM_USART_GetVersion : Get driver version.
 | 
			
		||||
  ARM_USART_CAPABILITIES (*GetCapabilities) (void);                              ///< Pointer to \ref ARM_USART_GetCapabilities : Get driver capabilities.
 | 
			
		||||
  int32_t                (*Initialize)      (ARM_USART_SignalEvent_t cb_event);  ///< Pointer to \ref ARM_USART_Initialize : Initialize USART Interface.
 | 
			
		||||
  int32_t                (*Uninitialize)    (void);                              ///< Pointer to \ref ARM_USART_Uninitialize : De-initialize USART Interface.
 | 
			
		||||
  int32_t                (*PowerControl)    (ARM_POWER_STATE state);             ///< Pointer to \ref ARM_USART_PowerControl : Control USART Interface Power.
 | 
			
		||||
  int32_t                (*Send)            (const void *data, uint32_t num);    ///< Pointer to \ref ARM_USART_Send : Start sending data to USART transmitter.
 | 
			
		||||
  int32_t                (*Receive)         (      void *data, uint32_t num);    ///< Pointer to \ref ARM_USART_Receive : Start receiving data from USART receiver.
 | 
			
		||||
  int32_t                (*Transfer)        (const void *data_out,
 | 
			
		||||
                                                   void *data_in,
 | 
			
		||||
                                             uint32_t    num);                   ///< Pointer to \ref ARM_USART_Transfer : Start sending/receiving data to/from USART.
 | 
			
		||||
  uint32_t               (*GetTxCount)      (void);                              ///< Pointer to \ref ARM_USART_GetTxCount : Get transmitted data count.
 | 
			
		||||
  uint32_t               (*GetRxCount)      (void);                              ///< Pointer to \ref ARM_USART_GetRxCount : Get received data count.
 | 
			
		||||
  int32_t                (*Control)         (uint32_t control, uint32_t arg);    ///< Pointer to \ref ARM_USART_Control : Control USART Interface.
 | 
			
		||||
  ARM_USART_STATUS       (*GetStatus)       (void);                              ///< Pointer to \ref ARM_USART_GetStatus : Get USART status.
 | 
			
		||||
  int32_t                (*SetModemControl) (ARM_USART_MODEM_CONTROL control);   ///< Pointer to \ref ARM_USART_SetModemControl : Set USART Modem Control line state.
 | 
			
		||||
  ARM_USART_MODEM_STATUS (*GetModemStatus)  (void);                              ///< Pointer to \ref ARM_USART_GetModemStatus : Get USART Modem Status lines state.
 | 
			
		||||
} const ARM_DRIVER_USART;
 | 
			
		||||
 | 
			
		||||
#ifdef  __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* DRIVER_USART_H_ */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,92 @@
 | 
			
		|||
/* -----------------------------------------------------------------------------
 | 
			
		||||
 * Copyright (c) 2016 -2017 ARM Ltd.
 | 
			
		||||
 *
 | 
			
		||||
 * This software is provided 'as-is', without any express or implied warranty.
 | 
			
		||||
 * In no event will the authors be held liable for any damages arising from
 | 
			
		||||
 * the use of this software. Permission is granted to anyone to use this
 | 
			
		||||
 * software for any purpose, including commercial applications, and to alter
 | 
			
		||||
 * it and redistribute it freely, subject to the following restrictions:
 | 
			
		||||
 *
 | 
			
		||||
 * 1. The origin of this software must not be misrepresented; you must not
 | 
			
		||||
 *    claim that you wrote the original software. If you use this software in
 | 
			
		||||
 *    a product, an acknowledgment in the product documentation would be
 | 
			
		||||
 *    appreciated but is not required.
 | 
			
		||||
 *
 | 
			
		||||
 * 2. Altered source versions must be plainly marked as such, and must not be
 | 
			
		||||
 *    misrepresented as being the original software.
 | 
			
		||||
 *
 | 
			
		||||
 * 3. This notice may not be removed or altered from any source distribution.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * $Date:        16. February 2017
 | 
			
		||||
 * $Revision:    V1.0.2
 | 
			
		||||
 *
 | 
			
		||||
 * Project:      UART Driver Definitions for ARM CMSDK_CM device
 | 
			
		||||
 * -------------------------------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
#ifndef USART_V2M_MPS2_H_
 | 
			
		||||
#define USART_V2M_MPS2_H_
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include "Driver_USART.h"
 | 
			
		||||
#include "Device.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// USART Flags
 | 
			
		||||
#define USART_FLAG_INITIALIZED      ((uint8_t)(1U))
 | 
			
		||||
#define USART_FLAG_POWERED          ((uint8_t)(1U << 1))
 | 
			
		||||
#define USART_FLAG_CONFIGURED       ((uint8_t)(1U << 2))
 | 
			
		||||
#define USART_FLAG_TX_ENABLED       ((uint8_t)(1U << 3))
 | 
			
		||||
#define USART_FLAG_RX_ENABLED       ((uint8_t)(1U << 4))
 | 
			
		||||
 | 
			
		||||
typedef struct _PIN
 | 
			
		||||
{
 | 
			
		||||
  CMSDK_GPIO_TypeDef *PinGpio;   // Pin GPIO
 | 
			
		||||
  uint8_t             PinNum;    // Pin Number
 | 
			
		||||
} PIN;
 | 
			
		||||
 | 
			
		||||
// USART Pin Configuration
 | 
			
		||||
typedef const struct _USART_PINS {
 | 
			
		||||
        PIN                       *pin_rx;            // RX  Pin identifier
 | 
			
		||||
        PIN                       *pin_tx;            // TX  Pin identifier
 | 
			
		||||
} USART_PINS;
 | 
			
		||||
 | 
			
		||||
// USART Transfer Information (Run-Time)
 | 
			
		||||
typedef struct _USART_TRANSFER_INFO {
 | 
			
		||||
  uint32_t              rx_num;         // Total number of receive data
 | 
			
		||||
  uint32_t              tx_num;         // Total number of transmit data
 | 
			
		||||
  uint8_t              *rx_buf;         // Pointer to in data buffer
 | 
			
		||||
  const uint8_t        *tx_buf;         // Pointer to out data buffer
 | 
			
		||||
  uint32_t              rx_cnt;         // Number of data received
 | 
			
		||||
  uint32_t              tx_cnt;         // Number of data sent
 | 
			
		||||
} USART_TRANSFER_INFO;
 | 
			
		||||
 | 
			
		||||
typedef struct _USART_STATUS {
 | 
			
		||||
  uint8_t tx_busy;                      // Transmitter busy flag
 | 
			
		||||
  uint8_t rx_busy;                      // Receiver busy flag
 | 
			
		||||
  uint8_t rx_overflow;                  // Receive data overflow detected (cleared on start of next receive operation)
 | 
			
		||||
} USART_STATUS;
 | 
			
		||||
 | 
			
		||||
// USART Information (Run-Time)
 | 
			
		||||
typedef struct _USART_INFO {
 | 
			
		||||
  ARM_USART_SignalEvent_t cb_event;            // Event callback
 | 
			
		||||
  USART_STATUS            status;              // Status flags
 | 
			
		||||
  uint8_t                 flags;               // Current USART flags
 | 
			
		||||
} USART_INFO;
 | 
			
		||||
 | 
			
		||||
// USART Resources Definitions
 | 
			
		||||
typedef const struct {
 | 
			
		||||
  ARM_USART_CAPABILITIES  capabilities;        // Capabilities
 | 
			
		||||
  USART_PINS               pins;               // USART pins configuration
 | 
			
		||||
  CMSDK_UART_TypeDef      *reg;                // USART peripheral pointer
 | 
			
		||||
  IRQn_Type                irq_num_rx;         // USART RX IRQ Number
 | 
			
		||||
  IRQn_Type                irq_num_tx;         // USART TX IRQ Number
 | 
			
		||||
  USART_INFO              *info;               // Run-Time Information
 | 
			
		||||
  USART_TRANSFER_INFO     *xfer;               // USART transfer information
 | 
			
		||||
} USART_RESOURCES;
 | 
			
		||||
 | 
			
		||||
#endif /* USART_V2M_MPS2_H_ */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,68 @@
 | 
			
		|||
/******************************************************************************
 | 
			
		||||
 * @file     system_CMSDK_CM7.h
 | 
			
		||||
 * @brief    CMSIS System Header File for CMSDK_CM7 Device
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
/* Copyright (c) 2011 - 2022 ARM LIMITED
 | 
			
		||||
 | 
			
		||||
   All rights reserved.
 | 
			
		||||
   Redistribution and use in source and binary forms, with or without
 | 
			
		||||
   modification, are permitted provided that the following conditions are met:
 | 
			
		||||
   - Redistributions of source code must retain the above copyright
 | 
			
		||||
     notice, this list of conditions and the following disclaimer.
 | 
			
		||||
   - Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
     notice, this list of conditions and the following disclaimer in the
 | 
			
		||||
     documentation and/or other materials provided with the distribution.
 | 
			
		||||
   - Neither the name of ARM nor the names of its contributors may be used
 | 
			
		||||
     to endorse or promote products derived from this software without
 | 
			
		||||
     specific prior written permission.
 | 
			
		||||
   *
 | 
			
		||||
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 | 
			
		||||
   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 | 
			
		||||
   ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
 | 
			
		||||
   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 | 
			
		||||
   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 | 
			
		||||
   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 | 
			
		||||
   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 | 
			
		||||
   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 | 
			
		||||
   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 | 
			
		||||
   POSSIBILITY OF SUCH DAMAGE.
 | 
			
		||||
   ---------------------------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
#ifndef SYSTEM_CMSDK_CM7_H
 | 
			
		||||
#define SYSTEM_CMSDK_CM7_H
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \brief Exception / Interrupt Handler Function Prototype
 | 
			
		||||
*/
 | 
			
		||||
typedef void(*VECTOR_TABLE_Type)(void);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \brief System Clock Frequency (Core Clock)
 | 
			
		||||
*/
 | 
			
		||||
extern uint32_t SystemCoreClock;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \brief Setup the microcontroller system.
 | 
			
		||||
 | 
			
		||||
   Initialize the System and update the SystemCoreClock variable.
 | 
			
		||||
 */
 | 
			
		||||
extern void SystemInit (void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \brief  Update SystemCoreClock variable.
 | 
			
		||||
 | 
			
		||||
   Updates the SystemCoreClock with current core Clock retrieved from cpu registers.
 | 
			
		||||
 */
 | 
			
		||||
extern void SystemCoreClockUpdate (void);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* SYSTEM_CMSDK_CM7_H */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,76 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2017-2019 NXP
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: BSD-3-Clause
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file clock_config.h
 | 
			
		||||
* @brief define imxrt1052-board clock configure
 | 
			
		||||
* @version 1.0 
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2021-05-29
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#ifndef _CLOCK_CONFIG_H_
 | 
			
		||||
#define _CLOCK_CONFIG_H_
 | 
			
		||||
 | 
			
		||||
#include "fsl_common.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 * Definitions
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
#define BOARD_XTAL0_CLK_HZ                         25000000U  /*!< Board xtal0 frequency in Hz */
 | 
			
		||||
 | 
			
		||||
#define BOARD_XTAL32K_CLK_HZ                          32768U  /*!< Board xtal32k frequency in Hz */
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 ************************ BOARD_InitBootClocks function ************************
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#if defined(__cplusplus)
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif /* __cplusplus*/
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @brief This function executes default configuration of clocks.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void BOARD_InitBootClocks(void);
 | 
			
		||||
 | 
			
		||||
#if defined(__cplusplus)
 | 
			
		||||
}
 | 
			
		||||
#endif /* __cplusplus*/
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 ********************** Configuration BOARD_BootClockRUN ***********************
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 * Definitions for BOARD_BootClockRUN configuration
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
#define BOARD_BOOTCLOCKRUN_CORE_CLOCK            25000000U  /*!< Core clock frequency: 600000000Hz */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 * API for BOARD_BootClockRUN configuration
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
#if defined(__cplusplus)
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif /* __cplusplus*/
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @brief This function executes configuration of clocks.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
void BOARD_BootClockRUN(void);
 | 
			
		||||
 | 
			
		||||
#if defined(__cplusplus)
 | 
			
		||||
}
 | 
			
		||||
#endif /* __cplusplus*/
 | 
			
		||||
 | 
			
		||||
#endif /* _CLOCK_CONFIG_H_ */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,38 @@
 | 
			
		|||
/*
 | 
			
		||||
* Copyright (c) 2022 AIIT XUOS Lab
 | 
			
		||||
* XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
* You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
*        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
* See the Mulan PSL v2 for more details.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file connect_gpio.h
 | 
			
		||||
* @brief define m7 emulator gpio function and struct
 | 
			
		||||
* @version 2.0
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2023-09-27
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#ifndef __CONNECT_GPIO_H_
 | 
			
		||||
#define __CONNECT_GPIO_H_
 | 
			
		||||
 | 
			
		||||
#include <device.h>
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define IMXRT_GET_PIN(PORTx, PIN)  (32 * (PORTx - 1) + (PIN & 31))    /* PORTx:1,2,3,4,5 */
 | 
			
		||||
 | 
			
		||||
int Imxrt1052HwGpioInit(void);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,42 @@
 | 
			
		|||
/*
 | 
			
		||||
* Copyright (c) 2020 AIIT XUOS Lab
 | 
			
		||||
* XiUOS is licensed under Mulan PSL v2.
 | 
			
		||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
 | 
			
		||||
* You may obtain a copy of Mulan PSL v2 at:
 | 
			
		||||
*        http://license.coscl.org.cn/MulanPSL2
 | 
			
		||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 | 
			
		||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 | 
			
		||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 | 
			
		||||
* See the Mulan PSL v2 for more details.
 | 
			
		||||
*/
 | 
			
		||||
 
 | 
			
		||||
/**
 | 
			
		||||
* @file connect_uart.h
 | 
			
		||||
* @brief define m7 emulator usart function and struct
 | 
			
		||||
* @version 2.0
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2023-09-27
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
#ifndef CONNECT_UART_H
 | 
			
		||||
#define CONNECT_UART_H
 | 
			
		||||
 | 
			
		||||
#include <device.h>
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define KERNEL_CONSOLE_BUS_NAME       SERIAL_BUS_NAME_1
 | 
			
		||||
#define KERNEL_CONSOLE_DRV_NAME        SERIAL_DRV_NAME_1
 | 
			
		||||
#define KERNEL_CONSOLE_DEVICE_NAME SERIAL_1_DEVICE_NAME_0
 | 
			
		||||
 | 
			
		||||
int Imxrt1052HwUartInit(void);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,605 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
 | 
			
		||||
 * Copyright 2016-2018 NXP
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: BSD-3-Clause
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file fsl_common.h
 | 
			
		||||
 * @brief common drivers header
 | 
			
		||||
 * @version 2.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022-03-15
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _FSL_COMMON_H_
 | 
			
		||||
#define _FSL_COMMON_H_
 | 
			
		||||
 | 
			
		||||
#include <assert.h>
 | 
			
		||||
#include <stdbool.h>
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
#if defined(__ICCARM__)
 | 
			
		||||
#include <stddef.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "fsl_device_registers.h"
 | 
			
		||||
 | 
			
		||||
/*!
 | 
			
		||||
 * @addtogroup ksdk_common
 | 
			
		||||
 * @{
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 * Definitions
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
 | 
			
		||||
/*! @brief Construct a status code value from a group and code number. */
 | 
			
		||||
#define MAKE_STATUS(group, code) ((((group)*100) + (code)))
 | 
			
		||||
 | 
			
		||||
/*! @brief Construct the version number for drivers. */
 | 
			
		||||
#define MAKE_VERSION(major, minor, bugfix) (((major) << 16) | ((minor) << 8) | (bugfix))
 | 
			
		||||
 | 
			
		||||
/*! @name Driver version */
 | 
			
		||||
/*@{*/
 | 
			
		||||
/*! @brief common driver version 2.0.1. */
 | 
			
		||||
#define FSL_COMMON_DRIVER_VERSION (MAKE_VERSION(2, 1, 0))
 | 
			
		||||
/*@}*/
 | 
			
		||||
 | 
			
		||||
/* Debug console type definition. */
 | 
			
		||||
#define DEBUG_CONSOLE_DEVICE_TYPE_NONE          0U      /*!< No debug console.             */
 | 
			
		||||
#define DEBUG_CONSOLE_DEVICE_TYPE_UART          1U      /*!< Debug console based on UART.   */
 | 
			
		||||
#define DEBUG_CONSOLE_DEVICE_TYPE_LPUART        2U      /*!< Debug console based on LPUART. */
 | 
			
		||||
#define DEBUG_CONSOLE_DEVICE_TYPE_LPSCI         3U      /*!< Debug console based on LPSCI.  */
 | 
			
		||||
#define DEBUG_CONSOLE_DEVICE_TYPE_USBCDC        4U      /*!< Debug console based on USBCDC. */
 | 
			
		||||
#define DEBUG_CONSOLE_DEVICE_TYPE_FLEXCOMM      5U      /*!< Debug console based on FLEXCOMM. */
 | 
			
		||||
#define DEBUG_CONSOLE_DEVICE_TYPE_IUART         6U      /*!< Debug console based on i.MX UART. */
 | 
			
		||||
#define DEBUG_CONSOLE_DEVICE_TYPE_VUSART        7U      /*!< Debug console based on LPC_VUSART. */
 | 
			
		||||
#define DEBUG_CONSOLE_DEVICE_TYPE_MINI_USART    8U      /*!< Debug console based on LPC_USART. */
 | 
			
		||||
#define DEBUG_CONSOLE_DEVICE_TYPE_SWO           9U      /*!< Debug console based on SWO. */
 | 
			
		||||
 | 
			
		||||
/*! @brief Status group numbers. */
 | 
			
		||||
enum _status_groups
 | 
			
		||||
{
 | 
			
		||||
    kStatusGroup_Generic = 0,                 /*!< Group number for generic status codes. */
 | 
			
		||||
    kStatusGroup_FLASH = 1,                   /*!< Group number for FLASH status codes. */
 | 
			
		||||
    kStatusGroup_LPSPI = 4,                   /*!< Group number for LPSPI status codes. */
 | 
			
		||||
    kStatusGroup_FLEXIO_SPI = 5,              /*!< Group number for FLEXIO SPI status codes. */
 | 
			
		||||
    kStatusGroup_DSPI = 6,                    /*!< Group number for DSPI status codes. */
 | 
			
		||||
    kStatusGroup_FLEXIO_UART = 7,             /*!< Group number for FLEXIO UART status codes. */
 | 
			
		||||
    kStatusGroup_FLEXIO_I2C = 8,              /*!< Group number for FLEXIO I2C status codes. */
 | 
			
		||||
    kStatusGroup_LPI2C = 9,                   /*!< Group number for LPI2C status codes. */
 | 
			
		||||
    kStatusGroup_UART = 10,                   /*!< Group number for UART status codes. */
 | 
			
		||||
    kStatusGroup_I2C = 11,                    /*!< Group number for UART status codes. */
 | 
			
		||||
    kStatusGroup_LPSCI = 12,                  /*!< Group number for LPSCI status codes. */
 | 
			
		||||
    kStatusGroup_LPUART = 13,                 /*!< Group number for LPUART status codes. */
 | 
			
		||||
    kStatusGroup_SPI = 14,                    /*!< Group number for SPI status code.*/
 | 
			
		||||
    kStatusGroup_XRDC = 15,                   /*!< Group number for XRDC status code.*/
 | 
			
		||||
    kStatusGroup_SEMA42 = 16,                 /*!< Group number for SEMA42 status code.*/
 | 
			
		||||
    kStatusGroup_SDHC = 17,                   /*!< Group number for SDHC status code */
 | 
			
		||||
    kStatusGroup_SDMMC = 18,                  /*!< Group number for SDMMC status code */
 | 
			
		||||
    kStatusGroup_SAI = 19,                    /*!< Group number for SAI status code */
 | 
			
		||||
    kStatusGroup_MCG = 20,                    /*!< Group number for MCG status codes. */
 | 
			
		||||
    kStatusGroup_SCG = 21,                    /*!< Group number for SCG status codes. */
 | 
			
		||||
    kStatusGroup_SDSPI = 22,                  /*!< Group number for SDSPI status codes. */
 | 
			
		||||
    kStatusGroup_FLEXIO_I2S = 23,             /*!< Group number for FLEXIO I2S status codes */
 | 
			
		||||
    kStatusGroup_FLEXIO_MCULCD = 24,          /*!< Group number for FLEXIO LCD status codes */
 | 
			
		||||
    kStatusGroup_FLASHIAP = 25,               /*!< Group number for FLASHIAP status codes */
 | 
			
		||||
    kStatusGroup_FLEXCOMM_I2C = 26,           /*!< Group number for FLEXCOMM I2C status codes */
 | 
			
		||||
    kStatusGroup_I2S = 27,                    /*!< Group number for I2S status codes */
 | 
			
		||||
    kStatusGroup_IUART = 28,                  /*!< Group number for IUART status codes */
 | 
			
		||||
    kStatusGroup_CSI = 29,                    /*!< Group number for CSI status codes */
 | 
			
		||||
    kStatusGroup_MIPI_DSI = 30,               /*!< Group number for MIPI DSI status codes */
 | 
			
		||||
    kStatusGroup_SDRAMC = 35,                 /*!< Group number for SDRAMC status codes. */
 | 
			
		||||
    kStatusGroup_POWER = 39,                  /*!< Group number for POWER status codes. */
 | 
			
		||||
    kStatusGroup_ENET = 40,                   /*!< Group number for ENET status codes. */
 | 
			
		||||
    kStatusGroup_PHY = 41,                    /*!< Group number for PHY status codes. */
 | 
			
		||||
    kStatusGroup_TRGMUX = 42,                 /*!< Group number for TRGMUX status codes. */
 | 
			
		||||
    kStatusGroup_SMARTCARD = 43,              /*!< Group number for SMARTCARD status codes. */
 | 
			
		||||
    kStatusGroup_LMEM = 44,                   /*!< Group number for LMEM status codes. */
 | 
			
		||||
    kStatusGroup_QSPI = 45,                   /*!< Group number for QSPI status codes. */
 | 
			
		||||
    kStatusGroup_DMA = 50,                    /*!< Group number for DMA status codes. */
 | 
			
		||||
    kStatusGroup_EDMA = 51,                   /*!< Group number for EDMA status codes. */
 | 
			
		||||
    kStatusGroup_DMAMGR = 52,                 /*!< Group number for DMAMGR status codes. */
 | 
			
		||||
    kStatusGroup_FLEXCAN = 53,                /*!< Group number for FlexCAN status codes. */
 | 
			
		||||
    kStatusGroup_LTC = 54,                    /*!< Group number for LTC status codes. */
 | 
			
		||||
    kStatusGroup_FLEXIO_CAMERA = 55,          /*!< Group number for FLEXIO CAMERA status codes. */
 | 
			
		||||
    kStatusGroup_LPC_SPI = 56,                /*!< Group number for LPC_SPI status codes. */
 | 
			
		||||
    kStatusGroup_LPC_USART = 57,              /*!< Group number for LPC_USART status codes. */
 | 
			
		||||
    kStatusGroup_DMIC = 58,                   /*!< Group number for DMIC status codes. */
 | 
			
		||||
    kStatusGroup_SDIF = 59,                   /*!< Group number for SDIF status codes.*/
 | 
			
		||||
    kStatusGroup_SPIFI = 60,                  /*!< Group number for SPIFI status codes. */
 | 
			
		||||
    kStatusGroup_OTP = 61,                    /*!< Group number for OTP status codes. */
 | 
			
		||||
    kStatusGroup_MCAN = 62,                   /*!< Group number for MCAN status codes. */
 | 
			
		||||
    kStatusGroup_CAAM = 63,                   /*!< Group number for CAAM status codes. */
 | 
			
		||||
    kStatusGroup_ECSPI = 64,                  /*!< Group number for ECSPI status codes. */
 | 
			
		||||
    kStatusGroup_USDHC = 65,                  /*!< Group number for USDHC status codes.*/
 | 
			
		||||
    kStatusGroup_LPC_I2C = 66,                /*!< Group number for LPC_I2C status codes.*/
 | 
			
		||||
    kStatusGroup_DCP = 67,                    /*!< Group number for DCP status codes.*/
 | 
			
		||||
    kStatusGroup_MSCAN = 68,                  /*!< Group number for MSCAN status codes.*/
 | 
			
		||||
    kStatusGroup_ESAI = 69,                   /*!< Group number for ESAI status codes. */
 | 
			
		||||
    kStatusGroup_FLEXSPI = 70,                /*!< Group number for FLEXSPI status codes. */
 | 
			
		||||
    kStatusGroup_MMDC = 71,                   /*!< Group number for MMDC status codes. */
 | 
			
		||||
    kStatusGroup_PDM = 72,                    /*!< Group number for MIC status codes. */
 | 
			
		||||
    kStatusGroup_SDMA = 73,                   /*!< Group number for SDMA status codes. */
 | 
			
		||||
    kStatusGroup_ICS = 74,                    /*!< Group number for ICS status codes. */
 | 
			
		||||
    kStatusGroup_SPDIF = 75,                  /*!< Group number for SPDIF status codes. */
 | 
			
		||||
    kStatusGroup_LPC_MINISPI = 76,            /*!< Group number for LPC_MINISPI status codes. */
 | 
			
		||||
    kStatusGroup_HASHCRYPT = 77,              /*!< Group number for Hashcrypt status codes */
 | 
			
		||||
    kStatusGroup_LPC_SPI_SSP = 78,            /*!< Group number for LPC_SPI_SSP status codes. */
 | 
			
		||||
    kStatusGroup_I3C = 79,                    /*!< Group number for I3C status codes */
 | 
			
		||||
    kStatusGroup_LPC_I2C_1 = 97,              /*!< Group number for LPC_I2C_1 status codes. */
 | 
			
		||||
    kStatusGroup_NOTIFIER = 98,               /*!< Group number for NOTIFIER status codes. */
 | 
			
		||||
    kStatusGroup_DebugConsole = 99,           /*!< Group number for debug console status codes. */
 | 
			
		||||
    kStatusGroup_SEMC = 100,                  /*!< Group number for SEMC status codes. */
 | 
			
		||||
    kStatusGroup_ApplicationRangeStart = 101, /*!< Starting number for application groups. */
 | 
			
		||||
    kStatusGroup_IAP = 102,                   /*!< Group number for IAP status codes */
 | 
			
		||||
 | 
			
		||||
    kStatusGroup_HAL_GPIO = 121,              /*!< Group number for HAL GPIO status codes. */
 | 
			
		||||
    kStatusGroup_HAL_UART = 122,              /*!< Group number for HAL UART status codes. */
 | 
			
		||||
    kStatusGroup_HAL_TIMER = 123,             /*!< Group number for HAL TIMER status codes. */
 | 
			
		||||
    kStatusGroup_HAL_SPI = 124,               /*!< Group number for HAL SPI status codes. */
 | 
			
		||||
    kStatusGroup_HAL_I2C = 125,               /*!< Group number for HAL I2C status codes. */
 | 
			
		||||
    kStatusGroup_HAL_FLASH = 126,             /*!< Group number for HAL FLASH status codes. */
 | 
			
		||||
    kStatusGroup_HAL_PWM = 127,               /*!< Group number for HAL PWM status codes. */
 | 
			
		||||
    kStatusGroup_HAL_RNG = 128,               /*!< Group number for HAL RNG status codes. */
 | 
			
		||||
    kStatusGroup_TIMERMANAGER = 135,          /*!< Group number for TiMER MANAGER status codes. */
 | 
			
		||||
    kStatusGroup_SERIALMANAGER = 136,         /*!< Group number for SERIAL MANAGER status codes. */
 | 
			
		||||
    kStatusGroup_LED = 137,                   /*!< Group number for LED status codes. */
 | 
			
		||||
    kStatusGroup_BUTTON = 138,                /*!< Group number for BUTTON status codes. */
 | 
			
		||||
    kStatusGroup_EXTERN_EEPROM = 139,         /*!< Group number for EXTERN EEPROM status codes. */
 | 
			
		||||
    kStatusGroup_SHELL = 140,                 /*!< Group number for SHELL status codes. */
 | 
			
		||||
    kStatusGroup_MEM_MANAGER = 141,           /*!< Group number for MEM MANAGER status codes. */
 | 
			
		||||
    kStatusGroup_LIST = 142,                  /*!< Group number for List status codes. */
 | 
			
		||||
    kStatusGroup_OSA = 143,                   /*!< Group number for OSA status codes. */
 | 
			
		||||
    kStatusGroup_COMMON_TASK = 144,           /*!< Group number for Common task status codes. */
 | 
			
		||||
    kStatusGroup_MSG = 145,                   /*!< Group number for messaging status codes. */
 | 
			
		||||
    kStatusGroup_SDK_OCOTP = 146,             /*!< Group number for OCOTP status codes. */
 | 
			
		||||
    kStatusGroup_SDK_FLEXSPINOR = 147,        /*!< Group number for FLEXSPINOR status codes.*/
 | 
			
		||||
    kStatusGroup_CODEC = 148,                 /*!< Group number for codec status codes. */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*! @brief Generic status return codes. */
 | 
			
		||||
enum _generic_status
 | 
			
		||||
{
 | 
			
		||||
    kStatus_Success = MAKE_STATUS(kStatusGroup_Generic, 0),
 | 
			
		||||
    kStatus_Fail = MAKE_STATUS(kStatusGroup_Generic, 1),
 | 
			
		||||
    kStatus_ReadOnly = MAKE_STATUS(kStatusGroup_Generic, 2),
 | 
			
		||||
    kStatus_OutOfRange = MAKE_STATUS(kStatusGroup_Generic, 3),
 | 
			
		||||
    kStatus_InvalidArgument = MAKE_STATUS(kStatusGroup_Generic, 4),
 | 
			
		||||
    kStatus_Timeout = MAKE_STATUS(kStatusGroup_Generic, 5),
 | 
			
		||||
    kStatus_NoTransferInProgress = MAKE_STATUS(kStatusGroup_Generic, 6),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*! @brief Type used for all status and error return values. */
 | 
			
		||||
typedef int32_t status_t;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Macro guard for whether to use default weak IRQ implementation in drivers
 | 
			
		||||
 */
 | 
			
		||||
#ifndef FSL_DRIVER_TRANSFER_DOUBLE_WEAK_IRQ
 | 
			
		||||
#define FSL_DRIVER_TRANSFER_DOUBLE_WEAK_IRQ 1
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*! @name Min/max macros */
 | 
			
		||||
/* @{ */
 | 
			
		||||
#if !defined(MIN)
 | 
			
		||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(MAX)
 | 
			
		||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
 | 
			
		||||
#endif
 | 
			
		||||
/* @} */
 | 
			
		||||
 | 
			
		||||
/*! @brief Computes the number of elements in an array. */
 | 
			
		||||
#if !defined(ARRAY_SIZE)
 | 
			
		||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*! @name UINT16_MAX/UINT32_MAX value */
 | 
			
		||||
/* @{ */
 | 
			
		||||
#if !defined(UINT16_MAX)
 | 
			
		||||
#define UINT16_MAX ((uint16_t)-1)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(UINT32_MAX)
 | 
			
		||||
#define UINT32_MAX ((uint32_t)-1)
 | 
			
		||||
#endif
 | 
			
		||||
/* @} */
 | 
			
		||||
 | 
			
		||||
/*! @name Timer utilities */
 | 
			
		||||
/* @{ */
 | 
			
		||||
/*! Macro to convert a microsecond period to raw count value */
 | 
			
		||||
#define USEC_TO_COUNT(us, clockFreqInHz) (uint64_t)((uint64_t)us * clockFreqInHz / 1000000U)
 | 
			
		||||
/*! Macro to convert a raw count value to microsecond */
 | 
			
		||||
#define COUNT_TO_USEC(count, clockFreqInHz) (uint64_t)((uint64_t)count * 1000000U / clockFreqInHz)
 | 
			
		||||
 | 
			
		||||
/*! Macro to convert a millisecond period to raw count value */
 | 
			
		||||
#define MSEC_TO_COUNT(ms, clockFreqInHz) (uint64_t)((uint64_t)ms * clockFreqInHz / 1000U)
 | 
			
		||||
/*! Macro to convert a raw count value to millisecond */
 | 
			
		||||
#define COUNT_TO_MSEC(count, clockFreqInHz) (uint64_t)((uint64_t)count * 1000U / clockFreqInHz)
 | 
			
		||||
/* @} */
 | 
			
		||||
 | 
			
		||||
/*! @name Alignment variable definition macros */
 | 
			
		||||
/* @{ */
 | 
			
		||||
#if (defined(__ICCARM__))
 | 
			
		||||
/**
 | 
			
		||||
 * Workaround to disable MISRA C message suppress warnings for IAR compiler.
 | 
			
		||||
 * http://supp.iar.com/Support/?note=24725
 | 
			
		||||
 */
 | 
			
		||||
_Pragma("diag_suppress=Pm120")
 | 
			
		||||
#define SDK_PRAGMA(x) _Pragma(#x)
 | 
			
		||||
    _Pragma("diag_error=Pm120")
 | 
			
		||||
/*! Macro to define a variable with alignbytes alignment */
 | 
			
		||||
#define SDK_ALIGN(var, alignbytes) SDK_PRAGMA(data_alignment = alignbytes) var
 | 
			
		||||
/*! Macro to define a variable with L1 d-cache line size alignment */
 | 
			
		||||
#if defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)
 | 
			
		||||
#define SDK_L1DCACHE_ALIGN(var) SDK_PRAGMA(data_alignment = FSL_FEATURE_L1DCACHE_LINESIZE_BYTE) var
 | 
			
		||||
#endif
 | 
			
		||||
/*! Macro to define a variable with L2 cache line size alignment */
 | 
			
		||||
#if defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)
 | 
			
		||||
#define SDK_L2CACHE_ALIGN(var) SDK_PRAGMA(data_alignment = FSL_FEATURE_L2CACHE_LINESIZE_BYTE) var
 | 
			
		||||
#endif
 | 
			
		||||
#elif defined(__CC_ARM) || defined(__ARMCC_VERSION)
 | 
			
		||||
/*! Macro to define a variable with alignbytes alignment */
 | 
			
		||||
#define SDK_ALIGN(var, alignbytes) __attribute__((aligned(alignbytes))) var
 | 
			
		||||
/*! Macro to define a variable with L1 d-cache line size alignment */
 | 
			
		||||
#if defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)
 | 
			
		||||
#define SDK_L1DCACHE_ALIGN(var) __attribute__((aligned(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE))) var
 | 
			
		||||
#endif
 | 
			
		||||
/*! Macro to define a variable with L2 cache line size alignment */
 | 
			
		||||
#if defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)
 | 
			
		||||
#define SDK_L2CACHE_ALIGN(var) __attribute__((aligned(FSL_FEATURE_L2CACHE_LINESIZE_BYTE))) var
 | 
			
		||||
#endif
 | 
			
		||||
#elif defined(__GNUC__)
 | 
			
		||||
/*! Macro to define a variable with alignbytes alignment */
 | 
			
		||||
#define SDK_ALIGN(var, alignbytes) var __attribute__((aligned(alignbytes)))
 | 
			
		||||
/*! Macro to define a variable with L1 d-cache line size alignment */
 | 
			
		||||
#if defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)
 | 
			
		||||
#define SDK_L1DCACHE_ALIGN(var) var __attribute__((aligned(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)))
 | 
			
		||||
#endif
 | 
			
		||||
/*! Macro to define a variable with L2 cache line size alignment */
 | 
			
		||||
#if defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)
 | 
			
		||||
#define SDK_L2CACHE_ALIGN(var) var __attribute__((aligned(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)))
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
#error Toolchain not supported
 | 
			
		||||
#define SDK_ALIGN(var, alignbytes) var
 | 
			
		||||
#if defined(FSL_FEATURE_L1DCACHE_LINESIZE_BYTE)
 | 
			
		||||
#define SDK_L1DCACHE_ALIGN(var) var
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(FSL_FEATURE_L2CACHE_LINESIZE_BYTE)
 | 
			
		||||
#define SDK_L2CACHE_ALIGN(var) var
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*! Macro to change a value to a given size aligned value */
 | 
			
		||||
#define SDK_SIZEALIGN(var, alignbytes) \
 | 
			
		||||
    ((unsigned int)((var) + ((alignbytes)-1)) & (unsigned int)(~(unsigned int)((alignbytes)-1)))
 | 
			
		||||
/* @} */
 | 
			
		||||
 | 
			
		||||
/*! @name Non-cacheable region definition macros */
 | 
			
		||||
/* For initialized non-zero non-cacheable variables, please using "AT_NONCACHEABLE_SECTION_INIT(var) ={xx};" or
 | 
			
		||||
 * "AT_NONCACHEABLE_SECTION_ALIGN_INIT(var) ={xx};" in your projects to define them, for zero-inited non-cacheable variables,
 | 
			
		||||
 * please using "AT_NONCACHEABLE_SECTION(var);" or "AT_NONCACHEABLE_SECTION_ALIGN(var);" to define them, these zero-inited variables
 | 
			
		||||
 * will be initialized to zero in system startup.
 | 
			
		||||
 */
 | 
			
		||||
/* @{ */
 | 
			
		||||
#if (defined(__ICCARM__))
 | 
			
		||||
#if ((!(defined(FSL_FEATURE_HAS_NO_NONCACHEABLE_SECTION) && FSL_FEATURE_HAS_NO_NONCACHEABLE_SECTION)) && defined(FSL_FEATURE_L1ICACHE_LINESIZE_BYTE))
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION(var) var @"NonCacheable"
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) SDK_PRAGMA(data_alignment = alignbytes) var @"NonCacheable"
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_INIT(var) var @"NonCacheable.init"
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN_INIT(var, alignbytes) SDK_PRAGMA(data_alignment = alignbytes) var @"NonCacheable.init"
 | 
			
		||||
#else
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION(var) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) SDK_PRAGMA(data_alignment = alignbytes) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_INIT(var) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN_INIT(var, alignbytes) SDK_PRAGMA(data_alignment = alignbytes) var
 | 
			
		||||
#endif
 | 
			
		||||
#elif(defined(__CC_ARM) || defined(__ARMCC_VERSION))
 | 
			
		||||
#if ((!(defined(FSL_FEATURE_HAS_NO_NONCACHEABLE_SECTION) && FSL_FEATURE_HAS_NO_NONCACHEABLE_SECTION)) && defined(FSL_FEATURE_L1ICACHE_LINESIZE_BYTE))
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION(var) __attribute__((section("NonCacheable"), zero_init)) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) \
 | 
			
		||||
    __attribute__((section("NonCacheable"), zero_init)) __attribute__((aligned(alignbytes))) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_INIT(var) __attribute__((section("NonCacheable.init"))) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN_INIT(var, alignbytes) \
 | 
			
		||||
    __attribute__((section("NonCacheable.init"))) __attribute__((aligned(alignbytes))) var
 | 
			
		||||
#else
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION(var) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) __attribute__((aligned(alignbytes))) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_INIT(var) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN_INIT(var, alignbytes) __attribute__((aligned(alignbytes))) var
 | 
			
		||||
#endif
 | 
			
		||||
#elif(defined(__GNUC__))
 | 
			
		||||
/* For GCC, when the non-cacheable section is required, please define "__STARTUP_INITIALIZE_NONCACHEDATA"
 | 
			
		||||
 * in your projects to make sure the non-cacheable section variables will be initialized in system startup.
 | 
			
		||||
 */
 | 
			
		||||
#if ((!(defined(FSL_FEATURE_HAS_NO_NONCACHEABLE_SECTION) && FSL_FEATURE_HAS_NO_NONCACHEABLE_SECTION)) && defined(FSL_FEATURE_L1ICACHE_LINESIZE_BYTE))
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_INIT(var) __attribute__((section("NonCacheable.init"))) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN_INIT(var, alignbytes) \
 | 
			
		||||
    __attribute__((section("NonCacheable.init"))) var __attribute__((aligned(alignbytes)))
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION(var) __attribute__((section("NonCacheable,\"aw\",%nobits @"))) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) \
 | 
			
		||||
    __attribute__((section("NonCacheable,\"aw\",%nobits @"))) var __attribute__((aligned(alignbytes)))
 | 
			
		||||
#else
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION(var) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) var __attribute__((aligned(alignbytes)))
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_INIT(var) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN_INIT(var, alignbytes) var __attribute__((aligned(alignbytes)))
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
#error Toolchain not supported.
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION(var) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_INIT(var) var
 | 
			
		||||
#define AT_NONCACHEABLE_SECTION_ALIGN_INIT(var, alignbytes) var
 | 
			
		||||
#endif
 | 
			
		||||
/* @} */
 | 
			
		||||
 | 
			
		||||
/*! @name Time sensitive region */
 | 
			
		||||
/* @{ */
 | 
			
		||||
#if defined(FSL_SDK_DRIVER_QUICK_ACCESS_ENABLE) && FSL_SDK_DRIVER_QUICK_ACCESS_ENABLE
 | 
			
		||||
#if (defined(__ICCARM__))
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_CODE(func) func @"CodeQuickAccess"
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_DATA(func) func @"DataQuickAccess"
 | 
			
		||||
#elif(defined(__CC_ARM) || defined(__ARMCC_VERSION))
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_CODE(func) __attribute__((section("CodeQuickAccess"))) func
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_DATA(func) __attribute__((section("DataQuickAccess"))) func
 | 
			
		||||
#elif(defined(__GNUC__))
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_CODE(func) __attribute__((section("CodeQuickAccess"))) func
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_DATA(func) __attribute__((section("DataQuickAccess"))) func
 | 
			
		||||
#else
 | 
			
		||||
#error Toolchain not supported.
 | 
			
		||||
#endif /* defined(__ICCARM__) */
 | 
			
		||||
#else
 | 
			
		||||
#if (defined(__ICCARM__))
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_CODE(func) func
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_DATA(func) func
 | 
			
		||||
#elif(defined(__CC_ARM) || defined(__ARMCC_VERSION))
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_CODE(func) func
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_DATA(func) func
 | 
			
		||||
#elif(defined(__GNUC__))
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_CODE(func) func
 | 
			
		||||
#define AT_QUICKACCESS_SECTION_DATA(func) func
 | 
			
		||||
#else
 | 
			
		||||
#error Toolchain not supported.
 | 
			
		||||
#endif
 | 
			
		||||
#endif /* __FSL_SDK_DRIVER_QUICK_ACCESS_ENABLE */
 | 
			
		||||
/* @} */
 | 
			
		||||
 | 
			
		||||
/*! @name Ram Function */
 | 
			
		||||
#if (defined(__ICCARM__))
 | 
			
		||||
#define RAMFUNCTION_SECTION_CODE(func) func @"RamFunction"
 | 
			
		||||
#elif(defined(__CC_ARM) || defined(__ARMCC_VERSION))
 | 
			
		||||
#define RAMFUNCTION_SECTION_CODE(func) __attribute__((section("RamFunction"))) func
 | 
			
		||||
#elif(defined(__GNUC__))
 | 
			
		||||
#define RAMFUNCTION_SECTION_CODE(func) __attribute__((section("RamFunction"))) func
 | 
			
		||||
#else
 | 
			
		||||
#error Toolchain not supported.
 | 
			
		||||
#endif /* defined(__ICCARM__) */
 | 
			
		||||
/* @} */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * The fsl_clock.h is included here because it needs MAKE_VERSION/MAKE_STATUS/status_t
 | 
			
		||||
 * defined in previous of this file.
 | 
			
		||||
 */
 | 
			
		||||
// #include "fsl_clock.h"
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Chip level peripheral reset API, for MCUs that implement peripheral reset control external to a peripheral
 | 
			
		||||
 */
 | 
			
		||||
#if ((defined(FSL_FEATURE_SOC_SYSCON_COUNT) && (FSL_FEATURE_SOC_SYSCON_COUNT > 0)) || \
 | 
			
		||||
     (defined(FSL_FEATURE_SOC_ASYNC_SYSCON_COUNT) && (FSL_FEATURE_SOC_ASYNC_SYSCON_COUNT > 0)))
 | 
			
		||||
#include "fsl_reset.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 * API
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
 | 
			
		||||
#if defined(__cplusplus)
 | 
			
		||||
        extern "C"
 | 
			
		||||
{
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * @brief Enable specific interrupt.
 | 
			
		||||
     *
 | 
			
		||||
     * Enable LEVEL1 interrupt. For some devices, there might be multiple interrupt
 | 
			
		||||
     * levels. For example, there are NVIC and intmux. Here the interrupts connected
 | 
			
		||||
     * to NVIC are the LEVEL1 interrupts, because they are routed to the core directly.
 | 
			
		||||
     * The interrupts connected to intmux are the LEVEL2 interrupts, they are routed
 | 
			
		||||
     * to NVIC first then routed to core.
 | 
			
		||||
     *
 | 
			
		||||
     * This function only enables the LEVEL1 interrupts. The number of LEVEL1 interrupts
 | 
			
		||||
     * is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
 | 
			
		||||
     *
 | 
			
		||||
     * @param interrupt The IRQ number.
 | 
			
		||||
     * @retval kStatus_Success Interrupt enabled successfully
 | 
			
		||||
     * @retval kStatus_Fail Failed to enable the interrupt
 | 
			
		||||
     */
 | 
			
		||||
    static inline status_t EnableIRQ(IRQn_Type interrupt)
 | 
			
		||||
    {
 | 
			
		||||
        // if (NotAvail_IRQn == interrupt)
 | 
			
		||||
        // {
 | 
			
		||||
        //     return kStatus_Fail;
 | 
			
		||||
        // }
 | 
			
		||||
 | 
			
		||||
#if defined(FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS) && (FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS > 0)
 | 
			
		||||
        if (interrupt >= FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS)
 | 
			
		||||
        {
 | 
			
		||||
            return kStatus_Fail;
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(__GIC_PRIO_BITS)
 | 
			
		||||
        GIC_EnableIRQ(interrupt);
 | 
			
		||||
#else
 | 
			
		||||
        NVIC_EnableIRQ(interrupt);
 | 
			
		||||
#endif
 | 
			
		||||
        return kStatus_Success;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * @brief Disable specific interrupt.
 | 
			
		||||
     *
 | 
			
		||||
     * Disable LEVEL1 interrupt. For some devices, there might be multiple interrupt
 | 
			
		||||
     * levels. For example, there are NVIC and intmux. Here the interrupts connected
 | 
			
		||||
     * to NVIC are the LEVEL1 interrupts, because they are routed to the core directly.
 | 
			
		||||
     * The interrupts connected to intmux are the LEVEL2 interrupts, they are routed
 | 
			
		||||
     * to NVIC first then routed to core.
 | 
			
		||||
     *
 | 
			
		||||
     * This function only disables the LEVEL1 interrupts. The number of LEVEL1 interrupts
 | 
			
		||||
     * is indicated by the feature macro FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS.
 | 
			
		||||
     *
 | 
			
		||||
     * @param interrupt The IRQ number.
 | 
			
		||||
     * @retval kStatus_Success Interrupt disabled successfully
 | 
			
		||||
     * @retval kStatus_Fail Failed to disable the interrupt
 | 
			
		||||
     */
 | 
			
		||||
    static inline status_t DisableIRQ(IRQn_Type interrupt)
 | 
			
		||||
    {
 | 
			
		||||
        // if (NotAvail_IRQn == interrupt)
 | 
			
		||||
        // {
 | 
			
		||||
        //     return kStatus_Fail;
 | 
			
		||||
        // }
 | 
			
		||||
 | 
			
		||||
#if defined(FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS) && (FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS > 0)
 | 
			
		||||
        if (interrupt >= FSL_FEATURE_NUMBER_OF_LEVEL1_INT_VECTORS)
 | 
			
		||||
        {
 | 
			
		||||
            return kStatus_Fail;
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(__GIC_PRIO_BITS)
 | 
			
		||||
        GIC_DisableIRQ(interrupt);
 | 
			
		||||
#else
 | 
			
		||||
    NVIC_DisableIRQ(interrupt);
 | 
			
		||||
#endif
 | 
			
		||||
        return kStatus_Success;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * @brief Disable the global IRQ
 | 
			
		||||
     *
 | 
			
		||||
     * Disable the global interrupt and return the current primask register. User is required to provided the primask
 | 
			
		||||
     * register for the EnableGlobalIRQ().
 | 
			
		||||
     *
 | 
			
		||||
     * @return Current primask value.
 | 
			
		||||
     */
 | 
			
		||||
    static inline uint32_t DisableGlobalIRQ(void)
 | 
			
		||||
    {
 | 
			
		||||
#if defined (__XCC__)
 | 
			
		||||
        return 0;
 | 
			
		||||
#else
 | 
			
		||||
#if defined(CPSR_I_Msk)
 | 
			
		||||
        uint32_t cpsr = __get_CPSR() & CPSR_I_Msk;
 | 
			
		||||
 | 
			
		||||
        __disable_irq();
 | 
			
		||||
 | 
			
		||||
        return cpsr;
 | 
			
		||||
#else
 | 
			
		||||
    uint32_t regPrimask = __get_PRIMASK();
 | 
			
		||||
 | 
			
		||||
    __disable_irq();
 | 
			
		||||
 | 
			
		||||
    return regPrimask;
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * @brief Enable the global IRQ
 | 
			
		||||
     *
 | 
			
		||||
     * Set the primask register with the provided primask value but not just enable the primask. The idea is for the
 | 
			
		||||
     * convenience of integration of RTOS. some RTOS get its own management mechanism of primask. User is required to
 | 
			
		||||
     * use the EnableGlobalIRQ() and DisableGlobalIRQ() in pair.
 | 
			
		||||
     *
 | 
			
		||||
     * @param primask value of primask register to be restored. The primask value is supposed to be provided by the
 | 
			
		||||
     * DisableGlobalIRQ().
 | 
			
		||||
     */
 | 
			
		||||
    static inline void EnableGlobalIRQ(uint32_t primask)
 | 
			
		||||
    {
 | 
			
		||||
#if defined (__XCC__)
 | 
			
		||||
#else
 | 
			
		||||
#if defined(CPSR_I_Msk)
 | 
			
		||||
        __set_CPSR((__get_CPSR() & ~CPSR_I_Msk) | primask);
 | 
			
		||||
#else
 | 
			
		||||
    __set_PRIMASK(primask);
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#if defined(ENABLE_RAM_VECTOR_TABLE)
 | 
			
		||||
    /*!
 | 
			
		||||
     * @brief install IRQ handler
 | 
			
		||||
     *
 | 
			
		||||
     * @param irq IRQ number
 | 
			
		||||
     * @param irqHandler IRQ handler address
 | 
			
		||||
     * @return The old IRQ handler address
 | 
			
		||||
     */
 | 
			
		||||
    uint32_t InstallIRQHandler(IRQn_Type irq, uint32_t irqHandler);
 | 
			
		||||
#endif /* ENABLE_RAM_VECTOR_TABLE. */
 | 
			
		||||
 | 
			
		||||
#if (defined(FSL_FEATURE_SOC_SYSCON_COUNT) && (FSL_FEATURE_SOC_SYSCON_COUNT > 0))
 | 
			
		||||
    /*!
 | 
			
		||||
     * @brief Enable specific interrupt for wake-up from deep-sleep mode.
 | 
			
		||||
     *
 | 
			
		||||
     * Enable the interrupt for wake-up from deep sleep mode.
 | 
			
		||||
     * Some interrupts are typically used in sleep mode only and will not occur during
 | 
			
		||||
     * deep-sleep mode because relevant clocks are stopped. However, it is possible to enable
 | 
			
		||||
     * those clocks (significantly increasing power consumption in the reduced power mode),
 | 
			
		||||
     * making these wake-ups possible.
 | 
			
		||||
     *
 | 
			
		||||
     * @note This function also enables the interrupt in the NVIC (EnableIRQ() is called internaly).
 | 
			
		||||
     *
 | 
			
		||||
     * @param interrupt The IRQ number.
 | 
			
		||||
     */
 | 
			
		||||
    void EnableDeepSleepIRQ(IRQn_Type interrupt);
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * @brief Disable specific interrupt for wake-up from deep-sleep mode.
 | 
			
		||||
     *
 | 
			
		||||
     * Disable the interrupt for wake-up from deep sleep mode.
 | 
			
		||||
     * Some interrupts are typically used in sleep mode only and will not occur during
 | 
			
		||||
     * deep-sleep mode because relevant clocks are stopped. However, it is possible to enable
 | 
			
		||||
     * those clocks (significantly increasing power consumption in the reduced power mode),
 | 
			
		||||
     * making these wake-ups possible.
 | 
			
		||||
     *
 | 
			
		||||
     * @note This function also disables the interrupt in the NVIC (DisableIRQ() is called internaly).
 | 
			
		||||
     *
 | 
			
		||||
     * @param interrupt The IRQ number.
 | 
			
		||||
     */
 | 
			
		||||
    void DisableDeepSleepIRQ(IRQn_Type interrupt);
 | 
			
		||||
#endif /* FSL_FEATURE_SOC_SYSCON_COUNT */
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * @brief Allocate memory with given alignment and aligned size.
 | 
			
		||||
     *
 | 
			
		||||
     * This is provided to support the dynamically allocated memory
 | 
			
		||||
     * used in cache-able region.
 | 
			
		||||
     * @param size The length required to malloc.
 | 
			
		||||
     * @param alignbytes The alignment size.
 | 
			
		||||
     * @retval The allocated memory.
 | 
			
		||||
     */
 | 
			
		||||
    void *SDK_Malloc(size_t size, size_t alignbytes);
 | 
			
		||||
 | 
			
		||||
    /*!
 | 
			
		||||
     * @brief Free memory.
 | 
			
		||||
     *
 | 
			
		||||
     * @param ptr The memory to be release.
 | 
			
		||||
     */
 | 
			
		||||
    void SDK_Free(void *ptr);
 | 
			
		||||
 | 
			
		||||
#if defined(__cplusplus)
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*! @} */
 | 
			
		||||
 | 
			
		||||
#endif /* _FSL_COMMON_H_ */
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,46 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2014-2016 Freescale Semiconductor, Inc.
 | 
			
		||||
 * Copyright 2016-2018 NXP
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * SPDX-License-Identifier: BSD-3-Clause
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @file fsl_device_registers.h
 | 
			
		||||
 * @brief device register function
 | 
			
		||||
 * @version 2.0
 | 
			
		||||
 * @author AIIT XUOS Lab
 | 
			
		||||
 * @date 2022-03-15
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef __FSL_DEVICE_REGISTERS_H__
 | 
			
		||||
#define __FSL_DEVICE_REGISTERS_H__
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Include the cpu specific register header files.
 | 
			
		||||
 *
 | 
			
		||||
 * The CPU macro should be declared in the project or makefile.
 | 
			
		||||
 */
 | 
			
		||||
#if (defined(CPU_MIMXRT1052CVJ5B) || defined(CPU_MIMXRT1052CVL5B) || defined(CPU_MIMXRT1052DVJ6B) || \
 | 
			
		||||
    defined(CPU_MIMXRT1052DVL6B))
 | 
			
		||||
 | 
			
		||||
#define MIMXRT1052_SERIES
 | 
			
		||||
 | 
			
		||||
// /* CMSIS-style register definitions */
 | 
			
		||||
// #include "MIMXRT1052.h"
 | 
			
		||||
// /* CPU specific feature definitions */
 | 
			
		||||
// #include "MIMXRT1052_features.h"
 | 
			
		||||
 | 
			
		||||
#include "CMSDK_CM7_SP.h"
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
    #error "No valid CPU defined!"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif /* __FSL_DEVICE_REGISTERS_H__ */
 | 
			
		||||
 | 
			
		||||
/*******************************************************************************
 | 
			
		||||
 * EOF
 | 
			
		||||
 ******************************************************************************/
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,74 @@
 | 
			
		|||
config BSP_USING_LPUART1
 | 
			
		||||
    bool "Enable LPUART1"
 | 
			
		||||
    default y
 | 
			
		||||
    if BSP_USING_LPUART1
 | 
			
		||||
        config SERIAL_BUS_NAME_1
 | 
			
		||||
            string "serial bus 1 name"
 | 
			
		||||
            default "uart1"
 | 
			
		||||
        config SERIAL_DRV_NAME_1
 | 
			
		||||
            string "serial bus 1 driver name"
 | 
			
		||||
            default "uart1_drv"
 | 
			
		||||
        config SERIAL_1_DEVICE_NAME_0
 | 
			
		||||
                string "serial bus 1 device name"
 | 
			
		||||
                default "uart1_dev1"   
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
config BSP_USING_LPUART2
 | 
			
		||||
    bool "Enable LPUART2"
 | 
			
		||||
    default y
 | 
			
		||||
    if BSP_USING_LPUART2
 | 
			
		||||
        config SERIAL_BUS_NAME_2
 | 
			
		||||
            string "serial bus 2 name"
 | 
			
		||||
            default "uart2"
 | 
			
		||||
        config SERIAL_DRV_NAME_2
 | 
			
		||||
            string "serial bus 2 driver name"
 | 
			
		||||
            default "uart2_drv"
 | 
			
		||||
        config SERIAL_2_DEVICE_NAME_0
 | 
			
		||||
                string "serial bus 2 device name"
 | 
			
		||||
                default "uart2_dev2"   
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
config BSP_USING_LPUART3
 | 
			
		||||
    bool "Enable LPUART3"
 | 
			
		||||
    default y
 | 
			
		||||
    if BSP_USING_LPUART3
 | 
			
		||||
        config SERIAL_BUS_NAME_3
 | 
			
		||||
            string "serial bus 3 name"
 | 
			
		||||
            default "uart3"
 | 
			
		||||
        config SERIAL_DRV_NAME_3
 | 
			
		||||
            string "serial bus 3 driver name"
 | 
			
		||||
            default "uart3_drv"
 | 
			
		||||
        config SERIAL_3_DEVICE_NAME_0
 | 
			
		||||
                string "serial bus 3 device name"
 | 
			
		||||
                default "uart3_dev3"   
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
config BSP_USING_LPUART4
 | 
			
		||||
    bool "Enable LPUART4"
 | 
			
		||||
    default n
 | 
			
		||||
    if BSP_USING_LPUART4
 | 
			
		||||
        config SERIAL_BUS_NAME_4
 | 
			
		||||
            string "serial bus 4 name"
 | 
			
		||||
            default "uart4"
 | 
			
		||||
        config SERIAL_DRV_NAME_4
 | 
			
		||||
            string "serial bus 4 driver name"
 | 
			
		||||
            default "uart4_drv"
 | 
			
		||||
        config SERIAL_4_DEVICE_NAME_0
 | 
			
		||||
                string "serial bus 4 device name"
 | 
			
		||||
                default "uart4_dev4"   
 | 
			
		||||
    endif
 | 
			
		||||
 | 
			
		||||
config BSP_USING_LPUART8
 | 
			
		||||
    bool "Enable LPUART8"
 | 
			
		||||
    default n
 | 
			
		||||
    if BSP_USING_LPUART8
 | 
			
		||||
        config SERIAL_BUS_NAME_8
 | 
			
		||||
            string "serial bus 8 name"
 | 
			
		||||
            default "uart8"
 | 
			
		||||
        config SERIAL_DRV_NAME_8
 | 
			
		||||
            string "serial bus 8 driver name"
 | 
			
		||||
            default "uart8_drv"
 | 
			
		||||
        config SERIAL_8_DEVICE_NAME_0
 | 
			
		||||
                string "serial bus 8 device name"
 | 
			
		||||
                default "uart8_dev8"   
 | 
			
		||||
    endif
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
SRC_FILES :=   connect_uart.c
 | 
			
		||||
 | 
			
		||||
include $(KERNEL_ROOT)/compiler.mk
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,957 @@
 | 
			
		|||
/* -----------------------------------------------------------------------------
 | 
			
		||||
 * Copyright (c) 2016 - 2017 ARM Ltd.
 | 
			
		||||
 *
 | 
			
		||||
 * This software is provided 'as-is', without any express or implied warranty.
 | 
			
		||||
 * In no event will the authors be held liable for any damages arising from
 | 
			
		||||
 * the use of this software. Permission is granted to anyone to use this
 | 
			
		||||
 * software for any purpose, including commercial applications, and to alter
 | 
			
		||||
 * it and redistribute it freely, subject to the following restrictions:
 | 
			
		||||
 *
 | 
			
		||||
 * 1. The origin of this software must not be misrepresented; you must not
 | 
			
		||||
 *    claim that you wrote the original software. If you use this software in
 | 
			
		||||
 *    a product, an acknowledgment in the product documentation would be
 | 
			
		||||
 *    appreciated but is not required.
 | 
			
		||||
 *
 | 
			
		||||
 * 2. Altered source versions must be plainly marked as such, and must not be
 | 
			
		||||
 *    misrepresented as being the original software.
 | 
			
		||||
 *
 | 
			
		||||
 * 3. This notice may not be removed or altered from any source distribution.
 | 
			
		||||
 *
 | 
			
		||||
 *
 | 
			
		||||
 * $Date:        26. October 2017
 | 
			
		||||
 * $Revision:    V1.0.3
 | 
			
		||||
 *
 | 
			
		||||
 * -------------------------------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
* @file connect_uart.c
 | 
			
		||||
* @brief support cortex-m7-emulator uart function and register to bus framework
 | 
			
		||||
* @version 1.0
 | 
			
		||||
* @author AIIT XUOS Lab
 | 
			
		||||
* @date 2023-09-27
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*************************************************
 | 
			
		||||
File name: connect_uart.c
 | 
			
		||||
Description: support cortex-m7-emulator uart function and register to bus framework
 | 
			
		||||
Others: take Arm\Packs\Keil\V2M-MPS2_CMx_BSP\1.8.0\CMSIS\Driver\USART_V2M-MPS2.c for references
 | 
			
		||||
History:
 | 
			
		||||
1. Date: 2023-09-27
 | 
			
		||||
Author: AIIT XUOS Lab
 | 
			
		||||
Modification:
 | 
			
		||||
1. support cortex-m7-emulator uart configure, write and read
 | 
			
		||||
2. support  cortex-m7-emulator uart bus device and driver register
 | 
			
		||||
*************************************************/
 | 
			
		||||
 | 
			
		||||
#include <board.h>
 | 
			
		||||
#include <connect_uart.h>
 | 
			
		||||
#include <CMSDK_CM7_SP.h>
 | 
			
		||||
 | 
			
		||||
#include "USART_V2M-MPS2.h"
 | 
			
		||||
// #include "board.h"
 | 
			
		||||
 | 
			
		||||
extern uint32_t SystemCoreClock;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define UNUSED(x) (void)(x)           /* macro to get rid of 'unused parameter' warning */
 | 
			
		||||
 | 
			
		||||
#define ARM_USART_DRV_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1,0)
 | 
			
		||||
 | 
			
		||||
// Driver Version
 | 
			
		||||
static const ARM_DRIVER_VERSION usart_driver_version = { ARM_USART_API_VERSION, ARM_USART_DRV_VERSION };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// USART0
 | 
			
		||||
#ifdef BSP_USING_LPUART1
 | 
			
		||||
 | 
			
		||||
// USART0 Run-Time Information
 | 
			
		||||
static USART_INFO          USART0_Info         = { 0U, { 0U, 0U, 0U }, 0U };
 | 
			
		||||
static USART_TRANSFER_INFO USART0_TransferInfo = { 0U, 0U, 0U, 0U, 0U, 0U };
 | 
			
		||||
static PIN                 USART0_pin_rx       = { CMSDK_GPIO1, 0U };
 | 
			
		||||
static PIN                 USART0_pin_tx       = { CMSDK_GPIO1, 1U };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// USART0 Resources
 | 
			
		||||
static const USART_RESOURCES USART0_Resources = {
 | 
			
		||||
  {     // Capabilities
 | 
			
		||||
    1,  // supports UART (Asynchronous) mode
 | 
			
		||||
    0,  // supports Synchronous Master mode
 | 
			
		||||
    0,  // supports Synchronous Slave mode
 | 
			
		||||
    0,  // supports UART Single-wire mode
 | 
			
		||||
    0,  // supports UART IrDA mode
 | 
			
		||||
    0,  // supports UART Smart Card mode
 | 
			
		||||
    0,  // Smart Card Clock generator
 | 
			
		||||
    0,  // RTS Flow Control available
 | 
			
		||||
    0,  // CTS Flow Control available
 | 
			
		||||
    1,  // Transmit completed event: \ref ARM_USART_EVENT_TX_COMPLETE
 | 
			
		||||
    1,  // Signal receive character timeout event: \ref ARM_USART_EVENT_RX_TIMEOUT
 | 
			
		||||
    0,  // RTS Line: 0=not available, 1=available
 | 
			
		||||
    0,  // CTS Line: 0=not available, 1=available
 | 
			
		||||
    0,  // DTR Line: 0=not available, 1=available
 | 
			
		||||
    0,  // DSR Line: 0=not available, 1=available
 | 
			
		||||
    0,  // DCD Line: 0=not available, 1=available
 | 
			
		||||
    0,  // RI Line: 0=not available, 1=available
 | 
			
		||||
    0,  // Signal CTS change event: \ref ARM_USART_EVENT_CTS
 | 
			
		||||
    0,  // Signal DSR change event: \ref ARM_USART_EVENT_DSR
 | 
			
		||||
    0,  // Signal DCD change event: \ref ARM_USART_EVENT_DCD
 | 
			
		||||
    0,  // Signal RI change event: \ref ARM_USART_EVENT_RI
 | 
			
		||||
    0   // Reserved (must be zero)
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    &USART0_pin_rx,
 | 
			
		||||
    &USART0_pin_tx
 | 
			
		||||
  },
 | 
			
		||||
  CMSDK_UART0,
 | 
			
		||||
  UART0RX_IRQn,
 | 
			
		||||
  UART0TX_IRQn,
 | 
			
		||||
  &USART0_Info,
 | 
			
		||||
  &USART0_TransferInfo
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// USART Driver functions
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          ARM_DRIVER_VERSION USARTx_GetVersion (void)
 | 
			
		||||
  \brief       Get driver version.
 | 
			
		||||
  \return      \ref ARM_DRIVER_VERSION
 | 
			
		||||
*/
 | 
			
		||||
static ARM_DRIVER_VERSION USARTx_GetVersion (void) {
 | 
			
		||||
  return usart_driver_version;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          ARM_USART_CAPABILITIES USART_GetCapabilities (const USART_RESOURCES *usart)
 | 
			
		||||
  \brief       Get driver capabilities
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
  \return      \ref ARM_USART_CAPABILITIES
 | 
			
		||||
*/
 | 
			
		||||
static ARM_USART_CAPABILITIES USART_GetCapabilities (const USART_RESOURCES *usart) {
 | 
			
		||||
  return usart->capabilities;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          int32_t USART_Initialize (      ARM_USART_SignalEvent_t  cb_event
 | 
			
		||||
                                         const USART_RESOURCES         *usart)
 | 
			
		||||
  \brief       Initialize USART Interface.
 | 
			
		||||
  \param[in]   cb_event  Pointer to \ref ARM_USART_SignalEvent
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
*/
 | 
			
		||||
static int32_t USART_Initialize (      ARM_USART_SignalEvent_t  cb_event,
 | 
			
		||||
                                 const USART_RESOURCES         *usart) {
 | 
			
		||||
 | 
			
		||||
  if (usart->info->flags & USART_FLAG_INITIALIZED) {
 | 
			
		||||
    // Driver is already initialized
 | 
			
		||||
    return ARM_DRIVER_OK;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Initialize callback
 | 
			
		||||
  usart->info->cb_event = cb_event;
 | 
			
		||||
 | 
			
		||||
  // Clear transfer information
 | 
			
		||||
  memset(usart->xfer, 0U, sizeof(USART_TRANSFER_INFO));
 | 
			
		||||
 | 
			
		||||
  // configure USART pins
 | 
			
		||||
  usart->pins.pin_rx->PinGpio->ALTFUNCSET |= (1u << usart->pins.pin_rx->PinNum);
 | 
			
		||||
  usart->pins.pin_tx->PinGpio->ALTFUNCSET |= (1u << usart->pins.pin_tx->PinNum);
 | 
			
		||||
 | 
			
		||||
  usart->info->flags = USART_FLAG_INITIALIZED;                  // Set status flags
 | 
			
		||||
 | 
			
		||||
  return ARM_DRIVER_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          int32_t USART_Uninitialize (const USART_RESOURCES *usart)
 | 
			
		||||
  \brief       De-initialize USART Interface.
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
*/
 | 
			
		||||
static int32_t USART_Uninitialize (const USART_RESOURCES *usart) {
 | 
			
		||||
 | 
			
		||||
  // unconfigure USART pins
 | 
			
		||||
  usart->pins.pin_rx->PinGpio->ALTFUNCSET &= ~(1u << usart->pins.pin_rx->PinNum);
 | 
			
		||||
  usart->pins.pin_tx->PinGpio->ALTFUNCSET &= ~(1u << usart->pins.pin_tx->PinNum);
 | 
			
		||||
 | 
			
		||||
  usart->info->flags = 0U;                                      // Reset status flags
 | 
			
		||||
 | 
			
		||||
  return ARM_DRIVER_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          int32_t USART_PowerControl (ARM_POWER_STATE state)
 | 
			
		||||
  \brief       Control USART Interface Power.
 | 
			
		||||
  \param[in]   state  Power state
 | 
			
		||||
  \param[in]   usart  Pointer to USART resources
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
*/
 | 
			
		||||
static int32_t USART_PowerControl (      ARM_POWER_STATE  state,
 | 
			
		||||
                                   const USART_RESOURCES *usart) {
 | 
			
		||||
 | 
			
		||||
  switch (state) {
 | 
			
		||||
    case ARM_POWER_OFF:
 | 
			
		||||
      // Clear powered flag
 | 
			
		||||
      usart->info->flags &= ~USART_FLAG_POWERED;
 | 
			
		||||
 | 
			
		||||
      // Clear and disable USART IRQ
 | 
			
		||||
      NVIC_DisableIRQ(usart->irq_num_rx);
 | 
			
		||||
      NVIC_ClearPendingIRQ(usart->irq_num_rx);
 | 
			
		||||
      NVIC_DisableIRQ(usart->irq_num_tx);
 | 
			
		||||
      NVIC_ClearPendingIRQ(usart->irq_num_tx);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
    case ARM_POWER_LOW:
 | 
			
		||||
      return ARM_DRIVER_ERROR_UNSUPPORTED;
 | 
			
		||||
 | 
			
		||||
    case ARM_POWER_FULL:
 | 
			
		||||
      if ((usart->info->flags & USART_FLAG_INITIALIZED) == 0U) {
 | 
			
		||||
        return ARM_DRIVER_ERROR;
 | 
			
		||||
      }
 | 
			
		||||
      if ((usart->info->flags & USART_FLAG_POWERED)     != 0U) {
 | 
			
		||||
        return ARM_DRIVER_OK;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      // Initialize status flags
 | 
			
		||||
      usart->info->status.tx_busy       = 0U;
 | 
			
		||||
      usart->info->status.rx_busy       = 0U;
 | 
			
		||||
      usart->info->status.rx_overflow   = 0U;
 | 
			
		||||
 | 
			
		||||
      // Set flag initialized
 | 
			
		||||
      usart->info->flags = USART_FLAG_POWERED | USART_FLAG_INITIALIZED;
 | 
			
		||||
 | 
			
		||||
      // Clear and enable USART IRQ
 | 
			
		||||
      NVIC_ClearPendingIRQ(usart->irq_num_rx);
 | 
			
		||||
      NVIC_EnableIRQ(usart->irq_num_rx);
 | 
			
		||||
      NVIC_ClearPendingIRQ(usart->irq_num_tx);
 | 
			
		||||
      NVIC_EnableIRQ(usart->irq_num_tx);
 | 
			
		||||
      break;
 | 
			
		||||
 | 
			
		||||
//    default: return ARM_DRIVER_ERROR_UNSUPPORTED;
 | 
			
		||||
  }
 | 
			
		||||
  return ARM_DRIVER_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          int32_t USART_Send (const void            *data,
 | 
			
		||||
                                         uint32_t         num,
 | 
			
		||||
                                   const USART_RESOURCES *usart)
 | 
			
		||||
  \brief       Start sending data to USART transmitter.
 | 
			
		||||
  \param[in]   data  Pointer to buffer with data to send to USART transmitter
 | 
			
		||||
  \param[in]   num   Number of data items to send
 | 
			
		||||
  \param[in]   usart Pointer to USART resources
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
*/
 | 
			
		||||
static int32_t USART_Send (const void            *data,
 | 
			
		||||
                                 uint32_t         num,
 | 
			
		||||
                           const USART_RESOURCES *usart) {
 | 
			
		||||
 | 
			
		||||
  if ((data == NULL) || (num == 0U)) {
 | 
			
		||||
    // Invalid parameters
 | 
			
		||||
    return ARM_DRIVER_ERROR_PARAMETER;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if ((usart->info->flags & USART_FLAG_CONFIGURED) == 0U) {
 | 
			
		||||
    // USART is not configured (mode not selected)
 | 
			
		||||
    return ARM_DRIVER_ERROR;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if ((usart->info->status.tx_busy != 0U) ||
 | 
			
		||||
     ((usart->reg->STATE & CMSDK_UART_STATE_TXBF_Msk) != 0U)) {
 | 
			
		||||
    // Send is not completed yet
 | 
			
		||||
    return ARM_DRIVER_ERROR_BUSY;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Set tx_busy flag
 | 
			
		||||
  usart->info->status.tx_busy = 0U;
 | 
			
		||||
 | 
			
		||||
  // Save transmit buffer info
 | 
			
		||||
  usart->xfer->tx_buf = (const uint8_t *)data;
 | 
			
		||||
  usart->xfer->tx_num = num;
 | 
			
		||||
  usart->xfer->tx_cnt = 0U;
 | 
			
		||||
 | 
			
		||||
  // TX interrupt enable
 | 
			
		||||
  usart->reg->CTRL |= CMSDK_UART_CTRL_TXIRQEN_Msk;
 | 
			
		||||
 | 
			
		||||
  // Start sending
 | 
			
		||||
  usart->reg->DATA = usart->xfer->tx_buf[usart->xfer->tx_cnt];
 | 
			
		||||
 | 
			
		||||
  return ARM_DRIVER_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          int32_t USART_Receive (      void            *data,
 | 
			
		||||
                                            uint32_t         num,
 | 
			
		||||
                                      const USART_RESOURCES *usart)
 | 
			
		||||
  \brief       Start receiving data from USART receiver.
 | 
			
		||||
  \param[out]  data  Pointer to buffer for data to receive from USART receiver
 | 
			
		||||
  \param[in]   num   Number of data items to receive
 | 
			
		||||
  \param[in]   usart Pointer to USART resources
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
*/
 | 
			
		||||
static int32_t USART_Receive (      void            *data,
 | 
			
		||||
                                    uint32_t         num,
 | 
			
		||||
                              const USART_RESOURCES *usart) {
 | 
			
		||||
 | 
			
		||||
  if ((data == NULL) || (num == 0U)) {
 | 
			
		||||
    // Invalid parameters
 | 
			
		||||
    return ARM_DRIVER_ERROR_PARAMETER;
 | 
			
		||||
  }
 | 
			
		||||
  uint32_t state = 0;
 | 
			
		||||
    state = usart->reg->STATE;
 | 
			
		||||
    int ch=-1;
 | 
			
		||||
    if (state){
 | 
			
		||||
       ch=usart->reg->DATA& 0xff;
 | 
			
		||||
        usart->reg->STATE=0;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
  return ch;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          int32_t USART_Transfer (const void             *data_out,
 | 
			
		||||
                                             void             *data_in,
 | 
			
		||||
                                             uint32_t          num,
 | 
			
		||||
                                       const USART_RESOURCES  *usart)
 | 
			
		||||
  \brief       Start sending/receiving data to/from USART transmitter/receiver.
 | 
			
		||||
  \param[in]   data_out  Pointer to buffer with data to send to USART transmitter
 | 
			
		||||
  \param[out]  data_in   Pointer to buffer for data to receive from USART receiver
 | 
			
		||||
  \param[in]   num       Number of data items to transfer
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
*/
 | 
			
		||||
static int32_t USART_Transfer (const void             *data_out,
 | 
			
		||||
                                     void             *data_in,
 | 
			
		||||
                                     uint32_t          num,
 | 
			
		||||
                               const USART_RESOURCES  *usart) {
 | 
			
		||||
  UNUSED(data_out);
 | 
			
		||||
  UNUSED(data_in);
 | 
			
		||||
  UNUSED(num);
 | 
			
		||||
  UNUSED(usart);
 | 
			
		||||
 | 
			
		||||
  // Synchronous mode not supported
 | 
			
		||||
  return ARM_DRIVER_ERROR_UNSUPPORTED;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          uint32_t USART_GetTxCount (const USART_RESOURCES *usart)
 | 
			
		||||
  \brief       Get transmitted data count.
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
  \return      number of data items transmitted
 | 
			
		||||
*/
 | 
			
		||||
static uint32_t USART_GetTxCount (const USART_RESOURCES *usart) {
 | 
			
		||||
 | 
			
		||||
  return usart->xfer->tx_cnt;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          uint32_t USART_GetRxCount (const USART_RESOURCES *usart)
 | 
			
		||||
  \brief       Get received data count.
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
  \return      number of data items received
 | 
			
		||||
*/
 | 
			
		||||
static uint32_t USART_GetRxCount (const USART_RESOURCES *usart) {
 | 
			
		||||
 | 
			
		||||
  return usart->xfer->rx_cnt;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          int32_t USART_Control (      uint32_t          control,
 | 
			
		||||
                                            uint32_t          arg,
 | 
			
		||||
                                      const USART_RESOURCES  *usart)
 | 
			
		||||
  \brief       Control USART Interface.
 | 
			
		||||
  \param[in]   control  Operation
 | 
			
		||||
  \param[in]   arg      Argument of operation (optional)
 | 
			
		||||
  \param[in]   usart    Pointer to USART resources
 | 
			
		||||
  \return      common \ref execution_status and driver specific \ref usart_execution_status
 | 
			
		||||
*/
 | 
			
		||||
static int32_t USART_Control (      uint32_t          control,
 | 
			
		||||
                                    uint32_t          arg,
 | 
			
		||||
                              const USART_RESOURCES  *usart) {
 | 
			
		||||
 | 
			
		||||
  if ((usart->info->flags & USART_FLAG_POWERED) == 0U) {
 | 
			
		||||
    // USART not powered
 | 
			
		||||
    return ARM_DRIVER_ERROR;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  switch (control & ARM_USART_CONTROL_Msk) {
 | 
			
		||||
    // Control break
 | 
			
		||||
    case ARM_USART_CONTROL_BREAK:
 | 
			
		||||
      return ARM_DRIVER_ERROR_UNSUPPORTED;
 | 
			
		||||
 | 
			
		||||
    // Abort Send
 | 
			
		||||
    case ARM_USART_ABORT_SEND:
 | 
			
		||||
      // TX interrupt disable
 | 
			
		||||
      usart->reg->CTRL &= ~CMSDK_UART_CTRL_TXIRQEN_Msk;
 | 
			
		||||
      // Clear tx_busy status
 | 
			
		||||
      usart->info->status.tx_busy = 0U;
 | 
			
		||||
      return ARM_DRIVER_OK;
 | 
			
		||||
 | 
			
		||||
    // Abort receive
 | 
			
		||||
    case ARM_USART_ABORT_RECEIVE:
 | 
			
		||||
      // RX interrupt disable
 | 
			
		||||
      usart->reg->CTRL &= ~CMSDK_UART_CTRL_RXIRQEN_Msk;
 | 
			
		||||
      // Clear rx_busy status
 | 
			
		||||
      usart->info->status.rx_busy = 0U;
 | 
			
		||||
      return ARM_DRIVER_OK;
 | 
			
		||||
 | 
			
		||||
    // Abort transfer
 | 
			
		||||
    case ARM_USART_ABORT_TRANSFER:
 | 
			
		||||
      // Synchronous mode not supported
 | 
			
		||||
      return ARM_DRIVER_ERROR_UNSUPPORTED;
 | 
			
		||||
 | 
			
		||||
    // Control TX
 | 
			
		||||
    case ARM_USART_CONTROL_TX:
 | 
			
		||||
      usart->info->flags |= USART_FLAG_TX_ENABLED;
 | 
			
		||||
      // Transmitter enable
 | 
			
		||||
      usart->reg->CTRL |= ((arg & 1U) << CMSDK_UART_CTRL_TXEN_Pos);
 | 
			
		||||
      return ARM_DRIVER_OK;
 | 
			
		||||
 | 
			
		||||
    // Control RX
 | 
			
		||||
    case ARM_USART_CONTROL_RX:
 | 
			
		||||
      usart->info->flags |= USART_FLAG_RX_ENABLED;
 | 
			
		||||
      // Receiver enable
 | 
			
		||||
      usart->reg->CTRL |= ((arg & 1U) << CMSDK_UART_CTRL_RXEN_Pos);
 | 
			
		||||
      return ARM_DRIVER_OK;
 | 
			
		||||
    default: break;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Check if busy
 | 
			
		||||
  if ((usart->info->status.tx_busy != 0U) ||
 | 
			
		||||
      (usart->info->status.rx_busy != 0U) ||
 | 
			
		||||
     ((usart->reg->STATE & (CMSDK_UART_STATE_TXBF_Msk | CMSDK_UART_STATE_RXBF_Msk)) != 0U)) {
 | 
			
		||||
    return ARM_DRIVER_ERROR_BUSY;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  switch (control & ARM_USART_CONTROL_Msk) {
 | 
			
		||||
    case ARM_USART_MODE_ASYNCHRONOUS: break;
 | 
			
		||||
    // Unsupported command
 | 
			
		||||
    default: return ARM_DRIVER_ERROR_UNSUPPORTED;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // USART Data bits
 | 
			
		||||
  switch (control & ARM_USART_DATA_BITS_Msk) {
 | 
			
		||||
    case ARM_USART_DATA_BITS_8: break;
 | 
			
		||||
    default: return ARM_USART_ERROR_DATA_BITS;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // USART Parity
 | 
			
		||||
  switch (control & ARM_USART_PARITY_Msk) {
 | 
			
		||||
    case ARM_USART_PARITY_NONE: break;
 | 
			
		||||
    default: return ARM_USART_ERROR_PARITY;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // USART Stop bits
 | 
			
		||||
  switch (control & ARM_USART_STOP_BITS_Msk) {
 | 
			
		||||
    case ARM_USART_STOP_BITS_1: break;
 | 
			
		||||
    default: return ARM_USART_ERROR_STOP_BITS;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // USART Flow control
 | 
			
		||||
  switch (control & ARM_USART_FLOW_CONTROL_Msk) {
 | 
			
		||||
    case ARM_USART_FLOW_CONTROL_NONE: break;
 | 
			
		||||
    default: return ARM_USART_ERROR_FLOW_CONTROL;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // USART Baudrate
 | 
			
		||||
  if ((SystemCoreClock/arg) < 16U)
 | 
			
		||||
    return ARM_USART_ERROR_BAUDRATE;
 | 
			
		||||
  else
 | 
			
		||||
    usart->reg->BAUDDIV = SystemCoreClock/arg;
 | 
			
		||||
 | 
			
		||||
  // Set configured flag
 | 
			
		||||
  usart->info->flags |= USART_FLAG_CONFIGURED;
 | 
			
		||||
 | 
			
		||||
  return ARM_DRIVER_OK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          ARM_USART_STATUS USART_GetStatus (const USART_RESOURCES *usart)
 | 
			
		||||
  \brief       Get USART status.
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
  \return      USART status \ref ARM_USART_STATUS
 | 
			
		||||
*/
 | 
			
		||||
static ARM_USART_STATUS USART_GetStatus (const USART_RESOURCES *usart) {
 | 
			
		||||
  ARM_USART_STATUS status;
 | 
			
		||||
 | 
			
		||||
  status.tx_busy          = usart->info->status.tx_busy;
 | 
			
		||||
  status.rx_busy          = usart->info->status.rx_busy;
 | 
			
		||||
  status.rx_overflow      = usart->info->status.rx_overflow;
 | 
			
		||||
 | 
			
		||||
  return status;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          int32_t USART_SetModemControl (      ARM_USART_MODEM_CONTROL  control,
 | 
			
		||||
                                              const USART_RESOURCES         *usart)
 | 
			
		||||
  \brief       Set USART Modem Control line state.
 | 
			
		||||
  \param[in]   control   \ref ARM_USART_MODEM_CONTROL
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
  \return      \ref execution_status
 | 
			
		||||
*/
 | 
			
		||||
static int32_t USART_SetModemControl (      ARM_USART_MODEM_CONTROL  control,
 | 
			
		||||
                                      const USART_RESOURCES         *usart) {
 | 
			
		||||
  UNUSED(control);
 | 
			
		||||
  UNUSED(usart);
 | 
			
		||||
 | 
			
		||||
  return ARM_DRIVER_ERROR_UNSUPPORTED;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          ARM_USART_MODEM_STATUS USART_GetModemStatus (const USART_RESOURCES *usart)
 | 
			
		||||
  \brief       Get USART Modem Status lines state.
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
  \return      modem status \ref ARM_USART_MODEM_STATUS
 | 
			
		||||
*/
 | 
			
		||||
static ARM_USART_MODEM_STATUS USART_GetModemStatus (const USART_RESOURCES *usart) {
 | 
			
		||||
  ARM_USART_MODEM_STATUS modem_status = { 0U, 0U, 0U, 0U };
 | 
			
		||||
 | 
			
		||||
  UNUSED(usart);
 | 
			
		||||
 | 
			
		||||
  return modem_status;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void UartIsr(struct SerialBus *serial, struct SerialDriver *serial_drv, struct SerialHardwareDevice *serial_dev);
 | 
			
		||||
 | 
			
		||||
#ifdef BSP_USING_LPUART1
 | 
			
		||||
struct SerialBus serial_bus_1;
 | 
			
		||||
struct SerialDriver serial_driver_1;
 | 
			
		||||
struct SerialHardwareDevice serial_device_1;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          void USARTRX_IRQHandler (UART_RESOURCES *usart)
 | 
			
		||||
  \brief       USART RX Interrupt handler.
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
*/
 | 
			
		||||
static void USARTRX_IRQHandler (USART_RESOURCES *usart) {
 | 
			
		||||
  uint32_t status;
 | 
			
		||||
 | 
			
		||||
  status = usart->reg->INTSTATUS;
 | 
			
		||||
 | 
			
		||||
 usart->xfer->rx_num = 0U;
 | 
			
		||||
  usart->info->status.rx_busy = 0U;
 | 
			
		||||
  usart->reg->CTRL &= ~CMSDK_UART_CTRL_RXIRQEN_Msk;
 | 
			
		||||
  usart->reg->INTCLEAR = status;
 | 
			
		||||
 | 
			
		||||
#ifdef BSP_USING_LPUART1
 | 
			
		||||
    DisableIRQ(UART0RX_IRQn);
 | 
			
		||||
    UartIsr(&serial_bus_1, &serial_driver_1, &serial_device_1);
 | 
			
		||||
    EnableIRQ(UART0RX_IRQn);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    usart->reg->BAUDDIV = 16;
 | 
			
		||||
    usart->reg->CTRL = CMSDK_UART_CTRL_RXIRQEN_Msk | CMSDK_UART_CTRL_RXEN_Msk | CMSDK_UART_CTRL_TXEN_Msk;
 | 
			
		||||
    usart->reg->STATE = 0U;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
  \fn          void USARTTX_IRQHandler (UART_RESOURCES *usart)
 | 
			
		||||
  \brief       USART TX Interrupt handler.
 | 
			
		||||
  \param[in]   usart     Pointer to USART resources
 | 
			
		||||
*/
 | 
			
		||||
static void USARTTX_IRQHandler (USART_RESOURCES *usart) {
 | 
			
		||||
  uint32_t status;
 | 
			
		||||
    
 | 
			
		||||
  // read interrupt status
 | 
			
		||||
  status = usart->reg->INTSTATUS;
 | 
			
		||||
 | 
			
		||||
  // clear interrupt
 | 
			
		||||
  usart->reg->INTCLEAR = status;
 | 
			
		||||
 | 
			
		||||
  if (usart->xfer->tx_num > 0) {
 | 
			
		||||
 | 
			
		||||
    usart->xfer->tx_cnt++;
 | 
			
		||||
 | 
			
		||||
    if (usart->xfer->tx_cnt < usart->xfer->tx_num) {
 | 
			
		||||
      // Send next byte
 | 
			
		||||
      usart->reg->DATA = usart->xfer->tx_buf[usart->xfer->tx_cnt];
 | 
			
		||||
    } else {
 | 
			
		||||
      // TX is completed
 | 
			
		||||
      usart->xfer->tx_num = 0U;
 | 
			
		||||
      usart->info->status.tx_busy = 0U;
 | 
			
		||||
 | 
			
		||||
      // TX interrupt disable
 | 
			
		||||
      usart->reg->CTRL &= ~CMSDK_UART_CTRL_TXIRQEN_Msk;
 | 
			
		||||
 | 
			
		||||
      // Send event
 | 
			
		||||
      if (usart->info->cb_event!=NULL)
 | 
			
		||||
        usart->info->cb_event(ARM_USART_EVENT_SEND_COMPLETE);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef BSP_USING_LPUART1
 | 
			
		||||
// USART0 Driver Wrapper functions
 | 
			
		||||
       void                    UART0RX_Handler        (void);
 | 
			
		||||
       void                    UART0TX_Handler        (void);
 | 
			
		||||
static ARM_USART_CAPABILITIES  USART0_GetCapabilities (void)                                                { return USART_GetCapabilities (&USART0_Resources); }
 | 
			
		||||
static int32_t                 USART0_Initialize      (ARM_USART_SignalEvent_t cb_event)                    { return USART_Initialize (cb_event, &USART0_Resources); }
 | 
			
		||||
static int32_t                 USART0_Uninitialize    (void)                                                { return USART_Uninitialize (&USART0_Resources); }
 | 
			
		||||
static int32_t                 USART0_PowerControl    (ARM_POWER_STATE state)                               { return USART_PowerControl (state, &USART0_Resources); }
 | 
			
		||||
static int32_t                 USART0_Send            (const void *data, uint32_t num)                      { return USART_Send (data, num, &USART0_Resources); }
 | 
			
		||||
static int32_t                 USART0_Receive         (void *data, uint32_t num)                            { return USART_Receive (data, num, &USART0_Resources); }
 | 
			
		||||
static int32_t                 USART0_Transfer        (const void *data_out, void *data_in, uint32_t num)   { return USART_Transfer (data_out, data_in, num, &USART0_Resources); }
 | 
			
		||||
static uint32_t                USART0_GetTxCount      (void)                                                { return USART_GetTxCount (&USART0_Resources); }
 | 
			
		||||
static uint32_t                USART0_GetRxCount      (void)                                                { return USART_GetRxCount (&USART0_Resources); }
 | 
			
		||||
static int32_t                 USART0_Control         (uint32_t control, uint32_t arg)                      { return USART_Control (control, arg, &USART0_Resources); }
 | 
			
		||||
static ARM_USART_STATUS        USART0_GetStatus       (void)                                                { return USART_GetStatus (&USART0_Resources); }
 | 
			
		||||
static int32_t                 USART0_SetModemControl (ARM_USART_MODEM_CONTROL control)                     { return USART_SetModemControl (control, &USART0_Resources); }
 | 
			
		||||
static ARM_USART_MODEM_STATUS  USART0_GetModemStatus  (void)                                                { return USART_GetModemStatus (&USART0_Resources); }
 | 
			
		||||
       void                    UART0RX_Handler        (void)                                                {        USARTRX_IRQHandler (&USART0_Resources); }
 | 
			
		||||
       void                    UART0TX_Handler        (void)                                                {        USARTTX_IRQHandler (&USART0_Resources); }
 | 
			
		||||
 | 
			
		||||
// USART0 Driver Control Block
 | 
			
		||||
extern ARM_DRIVER_USART Driver_USART0;
 | 
			
		||||
       ARM_DRIVER_USART Driver_USART0 = {
 | 
			
		||||
    USARTx_GetVersion,
 | 
			
		||||
    USART0_GetCapabilities,
 | 
			
		||||
    USART0_Initialize,
 | 
			
		||||
    USART0_Uninitialize,
 | 
			
		||||
    USART0_PowerControl,
 | 
			
		||||
    USART0_Send,
 | 
			
		||||
    USART0_Receive,
 | 
			
		||||
    USART0_Transfer,
 | 
			
		||||
    USART0_GetTxCount,
 | 
			
		||||
    USART0_GetRxCount,
 | 
			
		||||
    USART0_Control,
 | 
			
		||||
    USART0_GetStatus,
 | 
			
		||||
    USART0_SetModemControl,
 | 
			
		||||
    USART0_GetModemStatus
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define _USART_Driver_(n)  Driver_USART##n
 | 
			
		||||
#define  USART_Driver_(n) _USART_Driver_(n)
 | 
			
		||||
 
 | 
			
		||||
extern ARM_DRIVER_USART  USART_Driver_(0);
 | 
			
		||||
#define ptrUSART1       (&USART_Driver_(0))
 | 
			
		||||
 | 
			
		||||
#define USART_BAUDRATE          115200
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static void SerialCfgParamCheck(struct SerialCfgParam *serial_cfg_default, struct SerialCfgParam *serial_cfg_new)
 | 
			
		||||
{
 | 
			
		||||
    struct SerialDataCfg *data_cfg_default = &serial_cfg_default->data_cfg;
 | 
			
		||||
    struct SerialDataCfg *data_cfg_new = &serial_cfg_new->data_cfg;
 | 
			
		||||
 | 
			
		||||
    if ((data_cfg_default->serial_baud_rate != data_cfg_new->serial_baud_rate) && (data_cfg_new->serial_baud_rate)) {
 | 
			
		||||
        data_cfg_default->serial_baud_rate = data_cfg_new->serial_baud_rate;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((data_cfg_default->serial_bit_order != data_cfg_new->serial_bit_order) && (data_cfg_new->serial_bit_order)) {
 | 
			
		||||
        data_cfg_default->serial_bit_order = data_cfg_new->serial_bit_order;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((data_cfg_default->serial_buffer_size != data_cfg_new->serial_buffer_size) && (data_cfg_new->serial_buffer_size)) {
 | 
			
		||||
        data_cfg_default->serial_buffer_size = data_cfg_new->serial_buffer_size;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((data_cfg_default->serial_data_bits != data_cfg_new->serial_data_bits) && (data_cfg_new->serial_data_bits)) {
 | 
			
		||||
        data_cfg_default->serial_data_bits = data_cfg_new->serial_data_bits;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((data_cfg_default->serial_invert_mode != data_cfg_new->serial_invert_mode) && (data_cfg_new->serial_invert_mode)) {
 | 
			
		||||
        data_cfg_default->serial_invert_mode = data_cfg_new->serial_invert_mode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((data_cfg_default->serial_parity_mode != data_cfg_new->serial_parity_mode) && (data_cfg_new->serial_parity_mode)) {
 | 
			
		||||
        data_cfg_default->serial_parity_mode = data_cfg_new->serial_parity_mode;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((data_cfg_default->serial_stop_bits != data_cfg_new->serial_stop_bits) && (data_cfg_new->serial_stop_bits)) {
 | 
			
		||||
        data_cfg_default->serial_stop_bits = data_cfg_new->serial_stop_bits;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((data_cfg_default->serial_timeout != data_cfg_new->serial_timeout) && (data_cfg_new->serial_timeout)) {
 | 
			
		||||
        data_cfg_default->serial_timeout = data_cfg_new->serial_timeout;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void UartIsr(struct SerialBus *serial, struct SerialDriver *serial_drv, struct SerialHardwareDevice *serial_dev)
 | 
			
		||||
{
 | 
			
		||||
    struct SerialCfgParam *serial_cfg = (struct SerialCfgParam *)serial_drv->private_data;
 | 
			
		||||
 | 
			
		||||
    SerialSetIsr(serial_dev, SERIAL_EVENT_RX_IND);
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static uint32 SerialInit(struct SerialDriver *serial_drv, struct BusConfigureInfo *configure_info)
 | 
			
		||||
{
 | 
			
		||||
    NULL_PARAM_CHECK(serial_drv);
 | 
			
		||||
 | 
			
		||||
    struct SerialCfgParam *serial_cfg = (struct SerialCfgParam *)serial_drv->private_data;
 | 
			
		||||
    // LPUART_Type *uart_base = (LPUART_Type *)serial_cfg->hw_cfg.private_data;
 | 
			
		||||
 | 
			
		||||
    if (configure_info->private_data) {
 | 
			
		||||
        struct SerialCfgParam *serial_cfg_new = (struct SerialCfgParam *)configure_info->private_data;
 | 
			
		||||
        SerialCfgParamCheck(serial_cfg, serial_cfg_new);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	struct SerialHardwareDevice *serial_dev = (struct SerialHardwareDevice *)serial_drv->driver.owner_bus->owner_haldev;
 | 
			
		||||
	struct SerialDevParam *dev_param = (struct SerialDevParam *)serial_dev->haldev.private_data;
 | 
			
		||||
 | 
			
		||||
	// config serial receive sem timeout
 | 
			
		||||
	dev_param->serial_timeout = serial_cfg->data_cfg.serial_timeout;
 | 
			
		||||
 | 
			
		||||
    int32_t status;
 | 
			
		||||
 
 | 
			
		||||
    status = ptrUSART1->Initialize(NULL);
 | 
			
		||||
    if (status != ARM_DRIVER_OK) return (-1);
 | 
			
		||||
    
 | 
			
		||||
    status = ptrUSART1->PowerControl(ARM_POWER_FULL);
 | 
			
		||||
    if (status != ARM_DRIVER_OK) return (-1);
 | 
			
		||||
    
 | 
			
		||||
    status = ptrUSART1->Control(ARM_USART_MODE_ASYNCHRONOUS |
 | 
			
		||||
                                ARM_USART_DATA_BITS_8       |
 | 
			
		||||
                                ARM_USART_PARITY_NONE       |
 | 
			
		||||
                                ARM_USART_STOP_BITS_1       |
 | 
			
		||||
                                ARM_USART_FLOW_CONTROL_NONE,
 | 
			
		||||
                                USART_BAUDRATE);
 | 
			
		||||
    if (status != ARM_DRIVER_OK) return (-1);
 | 
			
		||||
 | 
			
		||||
    status = ptrUSART1->Control(ARM_USART_CONTROL_TX, 1);
 | 
			
		||||
    if (status != ARM_DRIVER_OK) return (-1);
 | 
			
		||||
 | 
			
		||||
    status = ptrUSART1->Control(ARM_USART_CONTROL_RX, 1);
 | 
			
		||||
    if (status != ARM_DRIVER_OK) return (-1);
 | 
			
		||||
    // stdout_init();
 | 
			
		||||
    // stdout_putchar(36);
 | 
			
		||||
 | 
			
		||||
    if (configure_info->private_data) {
 | 
			
		||||
        DisableIRQ(serial_cfg->hw_cfg.serial_irq_interrupt);
 | 
			
		||||
        // LPUART_EnableInterrupts(uart_base, kLPUART_RxDataRegFullInterruptEnable);
 | 
			
		||||
        NVIC_SetPriority(serial_cfg->hw_cfg.serial_irq_interrupt, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 4, 0));
 | 
			
		||||
        EnableIRQ(serial_cfg->hw_cfg.serial_irq_interrupt);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    return EOK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static uint32 SerialConfigure(struct SerialDriver *serial_drv, int serial_operation_cmd)
 | 
			
		||||
{
 | 
			
		||||
    NULL_PARAM_CHECK(serial_drv);
 | 
			
		||||
 | 
			
		||||
    struct SerialCfgParam *serial_cfg = (struct SerialCfgParam *)serial_drv->private_data;
 | 
			
		||||
    // LPUART_Type *uart_base = (LPUART_Type *)serial_cfg->hw_cfg.private_data;
 | 
			
		||||
    struct BusConfigureInfo configure_info;
 | 
			
		||||
    configure_info.private_data = NONE;
 | 
			
		||||
 | 
			
		||||
    SerialInit(serial_drv, &configure_info);
 | 
			
		||||
 | 
			
		||||
    switch (serial_operation_cmd)
 | 
			
		||||
    {
 | 
			
		||||
        case OPER_CLR_INT:
 | 
			
		||||
            DisableIRQ(serial_cfg->hw_cfg.serial_irq_interrupt);
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
        case OPER_SET_INT:
 | 
			
		||||
            // LPUART_EnableInterrupts(uart_base, kLPUART_RxDataRegFullInterruptEnable);
 | 
			
		||||
            NVIC_SetPriority(serial_cfg->hw_cfg.serial_irq_interrupt, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 4, 0));
 | 
			
		||||
            EnableIRQ(serial_cfg->hw_cfg.serial_irq_interrupt);
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    return EOK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int SerialPutChar(struct SerialHardwareDevice *serial_dev, char c)
 | 
			
		||||
{
 | 
			
		||||
    struct SerialCfgParam *serial_cfg = (struct SerialCfgParam *)serial_dev->private_data;
 | 
			
		||||
    
 | 
			
		||||
    uint8_t buf[1];
 | 
			
		||||
 
 | 
			
		||||
    buf[0] = c;
 | 
			
		||||
    if (ptrUSART1->Send(buf, 1) != ARM_DRIVER_OK) {
 | 
			
		||||
        return (-1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    UART0TX_Handler();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int SerialGetChar(struct SerialHardwareDevice *serial_dev)
 | 
			
		||||
{
 | 
			
		||||
    struct SerialCfgParam *serial_cfg = (struct SerialCfgParam *)serial_dev->private_data;
 | 
			
		||||
   
 | 
			
		||||
    int c=-1;
 | 
			
		||||
    int buf[1];
 | 
			
		||||
    buf[0]=0;
 | 
			
		||||
    do{
 | 
			
		||||
        buf[0]=ptrUSART1->Receive(buf, 1);
 | 
			
		||||
    }while (buf[0]==0);
 | 
			
		||||
  
 | 
			
		||||
    c=buf[0];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return c;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static uint32 SerialDrvConfigure(void *drv, struct BusConfigureInfo *configure_info)
 | 
			
		||||
{
 | 
			
		||||
    NULL_PARAM_CHECK(drv);
 | 
			
		||||
    NULL_PARAM_CHECK(configure_info);
 | 
			
		||||
 | 
			
		||||
    x_err_t ret = EOK;
 | 
			
		||||
    int serial_operation_cmd;
 | 
			
		||||
    struct SerialDriver *serial_drv = (struct SerialDriver *)drv;
 | 
			
		||||
 | 
			
		||||
    switch (configure_info->configure_cmd)
 | 
			
		||||
    {
 | 
			
		||||
        case OPE_INT:
 | 
			
		||||
            ret = SerialInit(serial_drv, configure_info);
 | 
			
		||||
            break;
 | 
			
		||||
        case OPE_CFG:
 | 
			
		||||
            serial_operation_cmd = *(int *)configure_info->private_data;
 | 
			
		||||
            ret = SerialConfigure(serial_drv, serial_operation_cmd);
 | 
			
		||||
            break;
 | 
			
		||||
        default:
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct SerialDataCfg data_cfg_init = 
 | 
			
		||||
{
 | 
			
		||||
    .serial_baud_rate = BAUD_RATE_115200,
 | 
			
		||||
    .serial_data_bits = DATA_BITS_8,
 | 
			
		||||
    .serial_stop_bits = STOP_BITS_1,
 | 
			
		||||
    .serial_parity_mode = PARITY_NONE,
 | 
			
		||||
    .serial_bit_order = BIT_ORDER_LSB,
 | 
			
		||||
    .serial_invert_mode = NRZ_NORMAL,
 | 
			
		||||
    .serial_buffer_size = SERIAL_RB_BUFSZ,
 | 
			
		||||
    .serial_timeout = WAITING_FOREVER,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*manage the serial device operations*/
 | 
			
		||||
static const struct SerialDrvDone drv_done =
 | 
			
		||||
{
 | 
			
		||||
    .init = SerialInit,
 | 
			
		||||
    .configure = SerialConfigure,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/*manage the serial device hal operations*/
 | 
			
		||||
static struct SerialHwDevDone hwdev_done =
 | 
			
		||||
{
 | 
			
		||||
    .put_char = SerialPutChar,
 | 
			
		||||
    .get_char = SerialGetChar,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int BoardSerialBusInit(struct SerialBus *serial_bus, struct SerialDriver *serial_driver, const char *bus_name, const char *drv_name)
 | 
			
		||||
{
 | 
			
		||||
    x_err_t ret = EOK;
 | 
			
		||||
 | 
			
		||||
    /*Init the serial bus */
 | 
			
		||||
    ret = SerialBusInit(serial_bus, bus_name);
 | 
			
		||||
    if (EOK != ret) {
 | 
			
		||||
        KPrintf("Imxrt1052HwUartInit SerialBusInit error %d\n", ret);
 | 
			
		||||
        return ERROR;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*Init the serial driver*/
 | 
			
		||||
    ret = SerialDriverInit(serial_driver, drv_name);
 | 
			
		||||
    if (EOK != ret) {
 | 
			
		||||
        KPrintf("Imxrt1052HwUartInit SerialDriverInit error %d\n", ret);
 | 
			
		||||
        return ERROR;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /*Attach the serial driver to the serial bus*/
 | 
			
		||||
    ret = SerialDriverAttachToBus(drv_name, bus_name);
 | 
			
		||||
    if (EOK != ret) {
 | 
			
		||||
        KPrintf("Imxrt1052HwUartInit SerialDriverAttachToBus error %d\n", ret);
 | 
			
		||||
        return ERROR;
 | 
			
		||||
    } 
 | 
			
		||||
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*Attach the serial device to the serial bus*/
 | 
			
		||||
static int BoardSerialDevBend(struct SerialHardwareDevice *serial_device, void *serial_param, const char *bus_name, const char *dev_name)
 | 
			
		||||
{
 | 
			
		||||
    x_err_t ret = EOK;
 | 
			
		||||
 | 
			
		||||
    ret = SerialDeviceRegister(serial_device, serial_param, dev_name);
 | 
			
		||||
    if (EOK != ret) {
 | 
			
		||||
        KPrintf("Imxrt1052HwUartInit SerialDeviceInit device %s error %d\n", dev_name, ret);
 | 
			
		||||
        return ERROR;
 | 
			
		||||
    }  
 | 
			
		||||
 | 
			
		||||
    ret = SerialDeviceAttachToBus(dev_name, bus_name);
 | 
			
		||||
    if (EOK != ret) {
 | 
			
		||||
        KPrintf("Imxrt1052HwUartInit SerialDeviceAttachToBus device %s error %d\n", dev_name, ret);
 | 
			
		||||
        return ERROR;
 | 
			
		||||
    }  
 | 
			
		||||
 | 
			
		||||
    return  ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int Imxrt1052HwUartInit(void)
 | 
			
		||||
{
 | 
			
		||||
    x_err_t ret = EOK;
 | 
			
		||||
 | 
			
		||||
#ifdef BSP_USING_LPUART1
 | 
			
		||||
    static struct SerialCfgParam serial_cfg_1;
 | 
			
		||||
    memset(&serial_cfg_1, 0, sizeof(struct SerialCfgParam));
 | 
			
		||||
 | 
			
		||||
    static struct SerialDevParam serial_dev_param_1;
 | 
			
		||||
    memset(&serial_dev_param_1, 0, sizeof(struct SerialDevParam));
 | 
			
		||||
    
 | 
			
		||||
    serial_driver_1.drv_done = &drv_done;
 | 
			
		||||
    serial_driver_1.configure = &SerialDrvConfigure;
 | 
			
		||||
    serial_device_1.hwdev_done = &hwdev_done;
 | 
			
		||||
 | 
			
		||||
    serial_cfg_1.data_cfg = data_cfg_init;
 | 
			
		||||
 | 
			
		||||
    CMSDK_UART0->BAUDDIV = 16;
 | 
			
		||||
    CMSDK_UART0->CTRL = CMSDK_UART_CTRL_RXIRQEN_Msk | CMSDK_UART_CTRL_RXEN_Msk | CMSDK_UART_CTRL_TXEN_Msk;
 | 
			
		||||
    CMSDK_UART0->STATE = 0U;
 | 
			
		||||
 | 
			
		||||
    serial_cfg_1.hw_cfg.private_data   = (void *)CMSDK_UART0;
 | 
			
		||||
    serial_cfg_1.hw_cfg.serial_irq_interrupt = UART0RX_IRQn ;
 | 
			
		||||
    serial_driver_1.private_data = (void *)&serial_cfg_1;
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    serial_dev_param_1.serial_work_mode = SIGN_OPER_INT_RX;
 | 
			
		||||
    serial_device_1.haldev.private_data = (void *)&serial_dev_param_1;
 | 
			
		||||
 | 
			
		||||
    ret = BoardSerialBusInit(&serial_bus_1, &serial_driver_1, SERIAL_BUS_NAME_1, SERIAL_DRV_NAME_1);
 | 
			
		||||
    if (EOK != ret) {
 | 
			
		||||
        KPrintf("Imxrt1052HwUartInit uart error ret %u\n", ret);
 | 
			
		||||
        return ERROR;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ret = BoardSerialDevBend(&serial_device_1, (void *)&serial_cfg_1, SERIAL_BUS_NAME_1, SERIAL_1_DEVICE_NAME_0);
 | 
			
		||||
    if (EOK != ret) {
 | 
			
		||||
        KPrintf("Imxrt1052HwUartInit uart error ret %u\n", ret);
 | 
			
		||||
        return ERROR;
 | 
			
		||||
    }    
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -57,6 +57,20 @@ KERNELPATHS += -I$(KERNEL_ROOT)/resources/include/netdev
 | 
			
		|||
endif 
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
ifeq ($(BSP_ROOT),$(KERNEL_ROOT)/board/cortex-m7-emulator)
 | 
			
		||||
KERNELPATHS += \
 | 
			
		||||
	-I$(KERNEL_ROOT)/arch/arm/cortex-m7 \
 | 
			
		||||
	-I$(BSP_ROOT)/third_party_driver \
 | 
			
		||||
	-I$(BSP_ROOT)/third_party_driver/CMSIS \
 | 
			
		||||
	-I$(BSP_ROOT)/third_party_driver/CMSIS/Include\
 | 
			
		||||
	-I$(BSP_ROOT)/third_party_driver/include \
 | 
			
		||||
	-I$(BSP_ROOT)/third_party_driver/include/V2M \
 | 
			
		||||
	-I$(KERNEL_ROOT)/include \
 | 
			
		||||
	-I$(KERNEL_ROOT)/resources/include 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
endif 
 | 
			
		||||
 | 
			
		||||
ifeq ($(BSP_ROOT),$(KERNEL_ROOT)/board/xiwangtong-arm32)
 | 
			
		||||
KERNELPATHS += \
 | 
			
		||||
	-I$(KERNEL_ROOT)/arch/arm/cortex-m7 \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue