初始版本
This commit is contained in:
+37132
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<flash_device>
|
||||
<exe>$PROJ_DIR$\config\flashloader\FlashHC32L17X.out</exe>
|
||||
<page>1</page>
|
||||
<block>256 0x200</block>
|
||||
<flash_base>0x00000000</flash_base>
|
||||
<macro>$PROJ_DIR$\config\flashloader\FlashHC32L17X.mac</macro>
|
||||
<aggregate>0</aggregate>
|
||||
</flash_device>
|
||||
@@ -0,0 +1,23 @@
|
||||
setup()
|
||||
{
|
||||
__message "----- setup hardware for Flashloader -----\n";
|
||||
/*Wait*/
|
||||
__delay(5);
|
||||
__emulatorSpeed(0);
|
||||
|
||||
/*Vectors at RAM*/
|
||||
__writeMemory32(0x20000000, 0xE000ED08, "Memory");
|
||||
}
|
||||
|
||||
execUserPreload()
|
||||
{
|
||||
__message "----- execUserPreload -----\n";
|
||||
setup();
|
||||
}
|
||||
|
||||
execUserFlashInit() // Called by debugger before loading flash loader in RAM.
|
||||
{
|
||||
__message "----- execUserFlashInit -----\n";
|
||||
setup();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
|
||||
<flash_board>
|
||||
<pass>
|
||||
<loader>$PROJ_DIR$\config\flashloader\FlashHC32L17X.flash</loader>
|
||||
<range>CODE 0x00000000 0x0001FFFF</range>
|
||||
</pass>
|
||||
</flash_board>
|
||||
@@ -0,0 +1,29 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x20000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x20001FFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x20002000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x200;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x200;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
|
||||
|
||||
place in ROM_region { readonly };
|
||||
place in RAM_region { readwrite, block CSTACK, block HEAP };
|
||||
@@ -0,0 +1,8 @@
|
||||
execUserReset()
|
||||
{
|
||||
__message("Executing __hwReset");
|
||||
__hwReset(0);
|
||||
__message("__hwReset done");
|
||||
|
||||
__hwResetWithStrategy(0, 2);
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,147 @@
|
||||
/******************************************************************************
|
||||
* Copyright (C) 2019, Huada Semiconductor Co.,Ltd All rights reserved.
|
||||
*
|
||||
* This software is owned and published by:
|
||||
* Huada Semiconductor Co.,Ltd ("HDSC").
|
||||
*
|
||||
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
|
||||
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
|
||||
*
|
||||
* This software contains source code for use with HDSC
|
||||
* components. This software is licensed by HDSC to be adapted only
|
||||
* for use in systems utilizing HDSC components. HDSC shall not be
|
||||
* responsible for misuse or illegal use of this software for devices not
|
||||
* supported herein. HDSC is providing this software "AS IS" and will
|
||||
* not be responsible for issues arising from incorrect user implementation
|
||||
* of the software.
|
||||
*
|
||||
* Disclaimer:
|
||||
* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
|
||||
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
|
||||
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
|
||||
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
|
||||
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
|
||||
* WARRANTY OF NONINFRINGEMENT.
|
||||
* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
|
||||
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
|
||||
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
|
||||
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
|
||||
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
|
||||
* SAVINGS OR PROFITS,
|
||||
* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
|
||||
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
|
||||
* FROM, THE SOFTWARE.
|
||||
*
|
||||
* This software may be replicated in part or whole for the licensed use,
|
||||
* with the restriction that this Disclaimer and Copyright notice must be
|
||||
* included with each copy of this software, whether used in part or whole,
|
||||
* at all times.
|
||||
*/
|
||||
/******************************************************************************/
|
||||
/** \file base_types.h
|
||||
**
|
||||
** base type common define.
|
||||
** @link SampleGroup Some description @endlink
|
||||
**
|
||||
** - 2019-03-01 1.0 Lux First version.
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __BASE_TYPES_H__
|
||||
#define __BASE_TYPES_H__
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Include files */
|
||||
/*****************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Global pre-processor symbols/macros ('#define') */
|
||||
/*****************************************************************************/
|
||||
#ifndef TRUE
|
||||
/** Value is true (boolean_t type) */
|
||||
#define TRUE ((boolean_t) 1u)
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
/** Value is false (boolean_t type) */
|
||||
#define FALSE ((boolean_t) 0u)
|
||||
#endif
|
||||
|
||||
/** Returns the minimum value out of two values */
|
||||
#define MINIMUM( X, Y ) ((X) < (Y) ? (X) : (Y))
|
||||
|
||||
/** Returns the maximum value out of two values */
|
||||
#define MAXIMUM( X, Y ) ((X) > (Y) ? (X) : (Y))
|
||||
|
||||
/** Returns the dimension of an array */
|
||||
#define ARRAY_SZ( X ) (sizeof(X) / sizeof((X)[0]))
|
||||
|
||||
#ifdef __DEBUG_ASSERT
|
||||
#define ASSERT(x) do{ assert((x)> 0u) ; }while(0);
|
||||
#else
|
||||
#define ASSERT(x) {}
|
||||
#endif
|
||||
/******************************************************************************
|
||||
* Global type definitions
|
||||
******************************************************************************/
|
||||
|
||||
/** logical datatype (only values are TRUE and FALSE) */
|
||||
typedef uint8_t boolean_t;
|
||||
|
||||
/** single precision floating point number (4 byte) */
|
||||
typedef float float32_t;
|
||||
|
||||
/** double precision floating point number (8 byte) */
|
||||
typedef double float64_t;
|
||||
|
||||
/** ASCII character for string generation (8 bit) */
|
||||
typedef char char_t;
|
||||
|
||||
/** function pointer type to void/void function */
|
||||
typedef void (*func_ptr_t)(void);
|
||||
|
||||
/** function pointer type to void/uint8_t function */
|
||||
typedef void (*func_ptr_arg1_t)(uint8_t u8Param);
|
||||
|
||||
/** generic error codes */
|
||||
typedef enum en_result
|
||||
{
|
||||
Ok = 0u, ///< No error
|
||||
Error = 1u, ///< Non-specific error code
|
||||
ErrorAddressAlignment = 2u, ///< Address alignment does not match
|
||||
ErrorAccessRights = 3u, ///< Wrong mode (e.g. user/system) mode is set
|
||||
ErrorInvalidParameter = 4u, ///< Provided parameter is not valid
|
||||
ErrorOperationInProgress = 5u, ///< A conflicting or requested operation is still in progress
|
||||
ErrorInvalidMode = 6u, ///< Operation not allowed in current mode
|
||||
ErrorUninitialized = 7u, ///< Module (or part of it) was not initialized properly
|
||||
ErrorBufferFull = 8u, ///< Circular buffer can not be written because the buffer is full
|
||||
ErrorTimeout = 9u, ///< Time Out error occurred (e.g. I2C arbitration lost, Flash time-out, etc.)
|
||||
ErrorNotReady = 10u, ///< A requested final state is not reached
|
||||
OperationInProgress = 11u ///< Indicator for operation in progress
|
||||
} en_result_t;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Global variable declarations ('extern', definition in C source) */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Global function prototypes ('extern', definition in C source) */
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif /* __BASE_TYPES_H__ */
|
||||
|
||||
/******************************************************************************/
|
||||
/* EOF (not truncated) */
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/******************************************************************************
|
||||
* Copyright (C) 2017, Huada Semiconductor Co.,Ltd All rights reserved.
|
||||
*
|
||||
* This software is owned and published by:
|
||||
* Huada Semiconductor Co.,Ltd ("HDSC").
|
||||
*
|
||||
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
|
||||
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
|
||||
*
|
||||
* This software contains source code for use with HDSC
|
||||
* components. This software is licensed by HDSC to be adapted only
|
||||
* for use in systems utilizing HDSC components. HDSC shall not be
|
||||
* responsible for misuse or illegal use of this software for devices not
|
||||
* supported herein. HDSC is providing this software "AS IS" and will
|
||||
* not be responsible for issues arising from incorrect user implementation
|
||||
* of the software.
|
||||
*
|
||||
* Disclaimer:
|
||||
* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
|
||||
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
|
||||
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
|
||||
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
|
||||
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
|
||||
* WARRANTY OF NONINFRINGEMENT.
|
||||
* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
|
||||
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
|
||||
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
|
||||
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
|
||||
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
|
||||
* SAVINGS OR PROFITS,
|
||||
* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
|
||||
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
|
||||
* FROM, THE SOFTWARE.
|
||||
*
|
||||
* This software may be replicated in part or whole for the licensed use,
|
||||
* with the restriction that this Disclaimer and Copyright notice must be
|
||||
* included with each copy of this software, whether used in part or whole,
|
||||
* at all times.
|
||||
*/
|
||||
/******************************************************************************/
|
||||
/** \file stkhc32l17x.h
|
||||
**
|
||||
** stk board common define.
|
||||
** @link SampleGroup Some description @endlink
|
||||
**
|
||||
** - 2018-03-09 1.0 Lux First version.
|
||||
**
|
||||
******************************************************************************/
|
||||
#ifndef __BOARD_STKHC32L17X_H__
|
||||
#define __BOARD_STKHC32L17X_H__
|
||||
|
||||
///< STK GPIO DEFINE
|
||||
///< USER KEY
|
||||
#define STK_USER_PORT GpioPortA
|
||||
#define STK_USER_PIN GpioPin7
|
||||
|
||||
///< LED
|
||||
#define STK_LED_PORT GpioPortD
|
||||
#define STK_LED_PIN GpioPin14
|
||||
|
||||
///< XTH
|
||||
#define SYSTEM_XTH (8*1000*1000u) ///< 32MHz
|
||||
|
||||
#define STK_XTHI_PORT GpioPortF
|
||||
#define STK_XTHI_PIN GpioPin0
|
||||
#define STK_XTHO_PORT GpioPortF
|
||||
#define STK_XTHO_PIN GpioPin1
|
||||
|
||||
///< XTL
|
||||
#define SYSTEM_XTL (32768u) ///< 32768Hz
|
||||
#define STK_XTLI_PORT GpioPortC
|
||||
#define STK_XTLI_PIN GpioPin14
|
||||
#define STK_XTLO_PORT GpioPortC
|
||||
#define STK_XTLO_PIN GpioPin15
|
||||
|
||||
///< LCD
|
||||
#define STK_LCD_COM0_PORT GpioPortA
|
||||
#define STK_LCD_COM0_PIN GpioPin9
|
||||
#define STK_LCD_COM1_PORT GpioPortA
|
||||
#define STK_LCD_COM1_PIN GpioPin10
|
||||
#define STK_LCD_COM2_PORT GpioPortA
|
||||
#define STK_LCD_COM2_PIN GpioPin11
|
||||
#define STK_LCD_COM3_PORT GpioPortA
|
||||
#define STK_LCD_COM3_PIN GpioPin12
|
||||
#define STK_LCD_SEG0_PORT GpioPortA
|
||||
#define STK_LCD_SEG0_PIN GpioPin8
|
||||
#define STK_LCD_SEG1_PORT GpioPortC
|
||||
#define STK_LCD_SEG1_PIN GpioPin9
|
||||
#define STK_LCD_SEG2_PORT GpioPortC
|
||||
#define STK_LCD_SEG2_PIN GpioPin8
|
||||
#define STK_LCD_SEG3_PORT GpioPortC
|
||||
#define STK_LCD_SEG3_PIN GpioPin7
|
||||
#define STK_LCD_SEG4_PORT GpioPortC
|
||||
#define STK_LCD_SEG4_PIN GpioPin6
|
||||
#define STK_LCD_SEG5_PORT GpioPortB
|
||||
#define STK_LCD_SEG5_PIN GpioPin15
|
||||
#define STK_LCD_SEG6_PORT GpioPortB
|
||||
#define STK_LCD_SEG6_PIN GpioPin14
|
||||
#define STK_LCD_SEG7_PORT GpioPortB
|
||||
#define STK_LCD_SEG7_PIN GpioPin13
|
||||
|
||||
///< I2C EEPROM
|
||||
#define EVB_I2C0_EEPROM_SCL_PORT GpioPortB
|
||||
#define EVB_I2C0_EEPROM_SCL_PIN GpioPin6
|
||||
#define EVB_I2C0_EEPROM_SDA_PORT GpioPortB
|
||||
#define EVB_I2C0_EEPROM_SDA_PIN GpioPin7
|
||||
|
||||
///< SPI0
|
||||
#define STK_SPI0_CS_PORT GpioPortE
|
||||
#define STK_SPI0_CS_PIN GpioPin12
|
||||
#define STK_SPI0_SCK_PORT GpioPortE
|
||||
#define STK_SPI0_SCK_PIN GpioPin13
|
||||
#define STK_SPI0_MISO_PORT GpioPortE
|
||||
#define STK_SPI0_MISO_PIN GpioPin14
|
||||
#define STK_SPI0_MOSI_PORT GpioPortE
|
||||
#define STK_SPI0_MOSI_PIN GpioPin15
|
||||
|
||||
///< SPI1
|
||||
#define STK_SPI1_CS_PORT GpioPortB
|
||||
#define STK_SPI1_CS_PIN GpioPin12
|
||||
#define STK_SPI1_SCK_PORT GpioPortB
|
||||
#define STK_SPI1_SCK_PIN GpioPin13
|
||||
#define STK_SPI1_MISO_PORT GpioPortB
|
||||
#define STK_SPI1_MISO_PIN GpioPin14
|
||||
#define STK_SPI1_MOSI_PORT GpioPortB
|
||||
#define STK_SPI1_MOSI_PIN GpioPin15
|
||||
|
||||
#endif
|
||||
+10833
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,610 @@
|
||||
/******************************************************************************
|
||||
* Copyright (C) 2019, Huada Semiconductor Co.,Ltd All rights reserved.
|
||||
*
|
||||
* This software is owned and published by:
|
||||
* Huada Semiconductor Co.,Ltd ("HDSC").
|
||||
*
|
||||
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
|
||||
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
|
||||
*
|
||||
* This software contains source code for use with HDSC
|
||||
* components. This software is licensed by HDSC to be adapted only
|
||||
* for use in systems utilizing HDSC components. HDSC shall not be
|
||||
* responsible for misuse or illegal use of this software for devices not
|
||||
* supported herein. HDSC is providing this software "AS IS" and will
|
||||
* not be responsible for issues arising from incorrect user implementation
|
||||
* of the software.
|
||||
*
|
||||
* Disclaimer:
|
||||
* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
|
||||
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
|
||||
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
|
||||
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
|
||||
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
|
||||
* WARRANTY OF NONINFRINGEMENT.
|
||||
* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
|
||||
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
|
||||
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
|
||||
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
|
||||
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
|
||||
* SAVINGS OR PROFITS,
|
||||
* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
|
||||
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
|
||||
* FROM, THE SOFTWARE.
|
||||
*
|
||||
* This software may be replicated in part or whole for the licensed use,
|
||||
* with the restriction that this Disclaimer and Copyright notice must be
|
||||
* included with each copy of this software, whether used in part or whole,
|
||||
* at all times.
|
||||
*/
|
||||
/******************************************************************************/
|
||||
/** \file interrupts_hc32l136.c
|
||||
**
|
||||
** Interrupt management
|
||||
** @link Driver Group Some description @endlink
|
||||
**
|
||||
** - 2018-04-15 1.0 Lux First version.
|
||||
**
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* Include files
|
||||
******************************************************************************/
|
||||
#include "ddl.h"
|
||||
#include "interrupts_hc32l17x.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* IRQ WEAK DEFINE
|
||||
******************************************************************************/
|
||||
__WEAK void SysTick_IRQHandler(void);
|
||||
|
||||
|
||||
__WEAK void PortA_IRQHandler(void);
|
||||
__WEAK void PortB_IRQHandler(void);
|
||||
__WEAK void PortC_IRQHandler(void);
|
||||
__WEAK void PortD_IRQHandler(void);
|
||||
__WEAK void PortE_IRQHandler(void);
|
||||
__WEAK void PortF_IRQHandler(void);
|
||||
__WEAK void Dmac_IRQHandler(void);
|
||||
__WEAK void Tim3_IRQHandler(void);
|
||||
__WEAK void Uart0_IRQHandler(void);
|
||||
__WEAK void Uart1_IRQHandler(void);
|
||||
__WEAK void Uart2_IRQHandler(void);
|
||||
__WEAK void Uart3_IRQHandler(void);
|
||||
__WEAK void LpUart0_IRQHandler(void);
|
||||
__WEAK void LpUart1_IRQHandler(void);
|
||||
__WEAK void Spi0_IRQHandler(void);
|
||||
__WEAK void Spi1_IRQHandler(void);
|
||||
__WEAK void I2c0_IRQHandler(void);
|
||||
__WEAK void I2c1_IRQHandler(void);
|
||||
__WEAK void Tim0_IRQHandler(void);
|
||||
__WEAK void Tim1_IRQHandler(void);
|
||||
__WEAK void Tim2_IRQHandler(void);
|
||||
__WEAK void LpTim0_IRQHandler(void);
|
||||
__WEAK void LpTim1_IRQHandler(void);
|
||||
__WEAK void Tim4_IRQHandler(void);
|
||||
__WEAK void Tim5_IRQHandler(void);
|
||||
__WEAK void Tim6_IRQHandler(void);
|
||||
__WEAK void Pca_IRQHandler(void);
|
||||
__WEAK void Wdt_IRQHandler(void);
|
||||
__WEAK void Rtc_IRQHandler(void);
|
||||
__WEAK void Adc_IRQHandler(void);
|
||||
__WEAK void Dac_IRQHandler(void);
|
||||
__WEAK void Pcnt_IRQHandler(void);
|
||||
__WEAK void Vc0_IRQHandler(void);
|
||||
__WEAK void Vc1_IRQHandler(void);
|
||||
__WEAK void Vc2_IRQHandler(void);
|
||||
__WEAK void Lvd_IRQHandler(void);
|
||||
__WEAK void Lcd_IRQHandler(void);
|
||||
__WEAK void Flash_IRQHandler(void);
|
||||
__WEAK void Ram_IRQHandler(void);
|
||||
__WEAK void ClkTrim_IRQHandler(void);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief NVIC 中断使能
|
||||
**
|
||||
** \param [in] enIrq 中断号枚举类型
|
||||
** \param [in] enLevel 中断优先级枚举类型
|
||||
** \param [in] bEn 中断开关
|
||||
** \retval Ok 设置成功
|
||||
** 其他值 设置失败
|
||||
******************************************************************************/
|
||||
void EnableNvic(IRQn_Type enIrq, en_irq_level_t enLevel, boolean_t bEn)
|
||||
{
|
||||
NVIC_ClearPendingIRQ(enIrq);
|
||||
NVIC_SetPriority(enIrq, enLevel);
|
||||
if (TRUE == bEn)
|
||||
{
|
||||
NVIC_EnableIRQ(enIrq);
|
||||
}
|
||||
else
|
||||
{
|
||||
NVIC_DisableIRQ(enIrq);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief NVIC hardware fault 中断实现
|
||||
**
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void HardFault_Handler(void)
|
||||
{
|
||||
volatile int a = 0;
|
||||
|
||||
while( 0 == a)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief NVIC SysTick 中断实现
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
SysTick_IRQHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief GPIO PortA 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void PORTA_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_PORTA)
|
||||
PortA_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief GPIO PortB 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void PORTB_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_PORTB)
|
||||
PortB_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief GPIO PortC/E 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void PORTC_E_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_PORTC)
|
||||
PortC_IRQHandler();
|
||||
#endif
|
||||
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_PORTE)
|
||||
PortE_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief GPIO PortD/F 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void PORTD_F_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_PORTD)
|
||||
PortD_IRQHandler();
|
||||
#endif
|
||||
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_PORTF)
|
||||
PortF_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief DMAC 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void DMAC_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_DMAC)
|
||||
Dmac_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief TIM3 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void TIM3_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_TIM3)
|
||||
Tim3_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief UART0/2 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void UART0_2_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_UART0)
|
||||
Uart0_IRQHandler();
|
||||
#endif
|
||||
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_UART2)
|
||||
Uart2_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief UART1/3 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void UART1_3_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_UART1)
|
||||
Uart1_IRQHandler();
|
||||
#endif
|
||||
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_UART3)
|
||||
Uart3_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief LPUART0 低功耗串口0 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void LPUART0_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_LPUART0)
|
||||
LpUart0_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief LPUART1 低功耗串口1 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void LPUART1_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_LPUART1)
|
||||
LpUart1_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief SPI0 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void SPI0_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_SPI0)
|
||||
Spi0_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief SPI1 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void SPI1_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_SPI1)
|
||||
Spi1_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief I2C0 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void I2C0_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_I2C0)
|
||||
I2c0_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief I2C1 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void I2C1_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_I2C1)
|
||||
I2c1_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief TIM0 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void TIM0_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_TIM0)
|
||||
Tim0_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief TIM1 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void TIM1_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_TIM1)
|
||||
Tim1_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief TIM2 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void TIM2_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_TIM2)
|
||||
Tim2_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief LPTIM0/1 低功耗时钟 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void LPTIM0_1_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_LPTIM0)
|
||||
LpTim0_IRQHandler();
|
||||
#endif
|
||||
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_LPTIM1)
|
||||
LpTim1_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief TIM4 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void TIM4_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_TIM4)
|
||||
Tim4_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief TIM5 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void TIM5_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_TIM5)
|
||||
Tim5_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief TIM6 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void TIM6_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_TIM6)
|
||||
Tim6_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief PCA 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void PCA_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_PCA)
|
||||
Pca_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief WDT 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void WDT_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_WDT)
|
||||
Wdt_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief RTC 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void RTC_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_RTC)
|
||||
Rtc_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief ADC/DAC 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void ADC_DAC_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_ADC)
|
||||
Adc_IRQHandler();
|
||||
#endif
|
||||
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_DAC)
|
||||
Dac_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief PCNT 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void PCNT_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_PCNT)
|
||||
Pcnt_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief VC0 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void VC0_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_VC0)
|
||||
Vc0_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief VC1/2 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void VC1_2_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_VC1)
|
||||
Vc1_IRQHandler();
|
||||
#endif
|
||||
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_VC2)
|
||||
Vc2_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief LVD 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void LVD_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_LVD)
|
||||
Lvd_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief LCD 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void LCD_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_LCD)
|
||||
Lcd_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief FLASH/RAM 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void FLASH_RAM_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_FLASH)
|
||||
Flash_IRQHandler();
|
||||
#endif
|
||||
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_RAM)
|
||||
Ram_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief CLKTRIM 中断处理函数
|
||||
**
|
||||
** \retval
|
||||
******************************************************************************/
|
||||
void CLKTRIM_IRQHandler(void)
|
||||
{
|
||||
#if (INT_CALLBACK_ON == INT_CALLBACK_CLKTRIM)
|
||||
ClkTrim_IRQHandler();
|
||||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/* EOF (not truncated) */
|
||||
/******************************************************************************/
|
||||
@@ -0,0 +1,150 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2018, Huada Semiconductor Co.,Ltd All rights reserved.
|
||||
*
|
||||
* This software is owned and published by:
|
||||
* Huada Semiconductor Co.,Ltd ("HDSC").
|
||||
*
|
||||
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
|
||||
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
|
||||
*
|
||||
* This software contains source code for use with HDSC
|
||||
* components. This software is licensed by HDSC to be adapted only
|
||||
* for use in systems utilizing HDSC components. HDSC shall not be
|
||||
* responsible for misuse or illegal use of this software for devices not
|
||||
* supported herein. HDSC is providing this software "AS IS" and will
|
||||
* not be responsible for issues arising from incorrect user implementation
|
||||
* of the software.
|
||||
*
|
||||
* Disclaimer:
|
||||
* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
|
||||
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
|
||||
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
|
||||
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
|
||||
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
|
||||
* WARRANTY OF NONINFRINGEMENT.
|
||||
* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
|
||||
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
|
||||
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
|
||||
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
|
||||
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
|
||||
* SAVINGS OR PROFITS,
|
||||
* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
|
||||
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
|
||||
* FROM, THE SOFTWARE.
|
||||
*
|
||||
* This software may be replicated in part or whole for the licensed use,
|
||||
* with the restriction that this Disclaimer and Copyright notice must be
|
||||
* included with each copy of this software, whether used in part or whole,
|
||||
* at all times.
|
||||
*/
|
||||
/******************************************************************************/
|
||||
/** \file interrupts_hc32l17x.h
|
||||
**
|
||||
** Interrupt common define.
|
||||
** @link IRQGroup Some description @endlink
|
||||
**
|
||||
** - 2019-03-01 1.0 Lux First version.
|
||||
**
|
||||
******************************************************************************/
|
||||
#ifndef __INTERRUPTS_HC32L17X_H__
|
||||
#define __INTERRUPTS_HC32L17X_H__
|
||||
|
||||
/******************************************************************************/
|
||||
/* Include files */
|
||||
/******************************************************************************/
|
||||
#include "ddl.h"
|
||||
|
||||
/* C binding of definitions if building with C++ compiler */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/* Global pre-processor symbols/macros ('#define') */
|
||||
/******************************************************************************/
|
||||
#define DDL_IRQ_LEVEL_DEFAULT 3u
|
||||
|
||||
//<<此选项会打开interrupt_hc32xxx.c中的中断回调函数,用户如果需要实现中断服务函数,
|
||||
//<<可在源码文件中定义该文件中用"__WEAK"声明的同名中断服务函数即可。
|
||||
#define INT_CALLBACK_ON 1u //<<(默认值)
|
||||
//<<此选项会关闭interrupt_hc32xxx.c中的中断回调函数,此时用户可在该文件中自行定义中断服务函数的实现。
|
||||
#define INT_CALLBACK_OFF 0u
|
||||
/******************************************************************************
|
||||
* Global type definitions
|
||||
******************************************************************************/
|
||||
#define INT_CALLBACK_PORTA INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_PORTB INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_PORTC INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_PORTD INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_PORTE INT_CALLBACK_OFF
|
||||
#define INT_CALLBACK_PORTF INT_CALLBACK_OFF
|
||||
#define INT_CALLBACK_DMAC INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_TIM3 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_UART0 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_UART1 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_UART2 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_UART3 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_LPUART0 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_LPUART1 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_SPI0 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_SPI1 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_I2C0 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_I2C1 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_TIM0 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_TIM1 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_TIM2 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_LPTIM0 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_LPTIM1 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_TIM4 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_TIM5 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_TIM6 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_PCA INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_WDT INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_RTC INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_ADC INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_DAC INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_PCNT INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_VC0 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_VC1 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_VC2 INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_LVD INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_LCD INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_FLASH INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_RAM INT_CALLBACK_ON
|
||||
#define INT_CALLBACK_CLKTRIM INT_CALLBACK_ON
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
** \brief 中断优先级数据类型定义
|
||||
** \note
|
||||
******************************************************************************/
|
||||
typedef enum en_irq_level
|
||||
{
|
||||
IrqLevel0 = 0u, ///< 优先级0
|
||||
IrqLevel1 = 1u, ///< 优先级1
|
||||
IrqLevel2 = 2u, ///< 优先级2
|
||||
IrqLevel3 = 3u, ///< 优先级3
|
||||
} en_irq_level_t;
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Global function prototypes (definition in C source)
|
||||
******************************************************************************/
|
||||
///< 系统中断使能开关
|
||||
extern void EnableNvic(IRQn_Type enIrq, en_irq_level_t enLevel, boolean_t bEn);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __INTERRUPTS_HC32L17X_H__ */
|
||||
|
||||
/******************************************************************************
|
||||
* EOF (not truncated)
|
||||
******************************************************************************/
|
||||
@@ -0,0 +1,212 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2019, Huada Semiconductor Co.,Ltd All rights reserved.
|
||||
*
|
||||
* This software is owned and published by:
|
||||
* Huada Semiconductor Co.,Ltd ("HDSC").
|
||||
*
|
||||
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
|
||||
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
|
||||
*
|
||||
* This software contains source code for use with HDSC
|
||||
* components. This software is licensed by HDSC to be adapted only
|
||||
* for use in systems utilizing HDSC components. HDSC shall not be
|
||||
* responsible for misuse or illegal use of this software for devices not
|
||||
* supported herein. HDSC is providing this software "AS IS" and will
|
||||
* not be responsible for issues arising from incorrect user implementation
|
||||
* of the software.
|
||||
*
|
||||
* Disclaimer:
|
||||
* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
|
||||
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
|
||||
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
|
||||
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
|
||||
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
|
||||
* WARRANTY OF NONINFRINGEMENT.
|
||||
* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
|
||||
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
|
||||
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
|
||||
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
|
||||
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
|
||||
* SAVINGS OR PROFITS,
|
||||
* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
|
||||
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
|
||||
* FROM, THE SOFTWARE.
|
||||
*
|
||||
* This software may be replicated in part or whole for the licensed use,
|
||||
* with the restriction that this Disclaimer and Copyright notice must be
|
||||
* included with each copy of this software, whether used in part or whole,
|
||||
* at all times.
|
||||
*/
|
||||
/******************************************************************************/
|
||||
/** \file system_hc32l136.c
|
||||
**
|
||||
** System clock initialization.
|
||||
** @link SampleGroup Some description @endlink
|
||||
**
|
||||
** - 2019-03-01 1.0 Lux First version.
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/* Include files */
|
||||
/******************************************************************************/
|
||||
#include "base_types.h"
|
||||
#include "hc32l17x.h"
|
||||
#include "system_hc32l17x.h"
|
||||
#include "sysctrl.h"
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
** System Clock Frequency (Core Clock) Variable according CMSIS
|
||||
******************************************************************************/
|
||||
uint32_t SystemCoreClock = 4000000;
|
||||
|
||||
|
||||
//add clock source.
|
||||
void SystemCoreClockUpdate (void) // Update SystemCoreClock variable
|
||||
{
|
||||
SystemCoreClock = Sysctrl_GetHClkFreq();
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
** \brief 对MCU未引出IO端口进行默认配置.
|
||||
**
|
||||
** \param none
|
||||
** \return none
|
||||
******************************************************************************/
|
||||
static void _InitHidePin(void)
|
||||
{
|
||||
uint32_t tmpReg = M0P_SYSCTRL->PERI_CLKEN0;
|
||||
|
||||
M0P_SYSCTRL->PERI_CLKEN0_f.GPIO = 1;
|
||||
|
||||
#if defined(HC32L17xPxxx) //100PIN MCU
|
||||
M0P_GPIO->PFADS &= 0xFF4F; ///< PF04/PF05/PF07配置为数字端口
|
||||
|
||||
M0P_GPIO->PFDIR |= 0x00B0; ///< PF04/PF05/PF07配置为端口输入
|
||||
|
||||
M0P_GPIO->PFPU |= 0x00B0; ///< PF04/PF05/PF07配置为上拉
|
||||
|
||||
#elif defined(HC32L17xMxxx) //80PIN MCU
|
||||
M0P_GPIO->PDADS &= 0x0F1F; ///< PD05~07/PD12~15配置为数字端口
|
||||
M0P_GPIO->PEADS &= 0x783C; ///< PE00/PE01/PE06~10/PE15配置为数字端口
|
||||
M0P_GPIO->PFADS &= 0xF9F3; ///< PF02/PF03/PF09/PF10配置为数字端口
|
||||
|
||||
M0P_GPIO->PDDIR |= 0xF0E0; ///< PD05~07/PD12~15配置为端口输入
|
||||
M0P_GPIO->PEDIR |= 0x87C3; ///< PE00/PE01/PE06~10/PE15配置为端口输入
|
||||
M0P_GPIO->PFDIR |= 0x060C; ///< PF02/PF03/PF09/PF10配置为数字端口
|
||||
|
||||
|
||||
M0P_GPIO->PDPU |= 0xF0E0; ///< PD05~07/PD12~15配置为上拉
|
||||
M0P_GPIO->PEPU |= 0x87C3; ///< PE00/PE01/PE06~10/PE15配置为上拉
|
||||
M0P_GPIO->PFPU |= 0x060C; ///< PF02/PF03/PF09/PF10配置为数字端口
|
||||
|
||||
#elif defined(HC32L17xKxxx) //64PIN MCU
|
||||
M0P_GPIO->PDADS &= 0x0004; ///< PD00/PD01/PD03~15配置为数字端口
|
||||
M0P_GPIO->PEADS &= 0x0000; ///< PE00~15配置为数字端口
|
||||
M0P_GPIO->PFADS &= 0xF9F3; ///< PF02/PF03/PF09/PF10配置为数字端口
|
||||
|
||||
M0P_GPIO->PDDIR |= 0xFFFB; ///< PD00/PD01/PD03~15配置为端口输入
|
||||
M0P_GPIO->PEDIR |= 0xFFFF; ///< PE00~15配置为端口输入
|
||||
M0P_GPIO->PFDIR |= 0x060C; ///< PF02/PF03/PF09/PF10配置为数字端口
|
||||
|
||||
M0P_GPIO->PDPU |= 0xFFFB; ///< PD00/PD01/PD03~15配置为上拉
|
||||
M0P_GPIO->PEPU |= 0xFFFF; ///< PE00~15配置为上拉
|
||||
M0P_GPIO->PFPU |= 0x060C; ///< PF02/PF03/PF09/PF10配置为数字端口
|
||||
|
||||
#elif defined(HC32L17xJxxx) //48PIN MCU
|
||||
M0P_GPIO->PCADS &= 0xE000; ///< PC00~12配置为数字端口
|
||||
M0P_GPIO->PDADS &= 0x0000; ///< PD00~15配置为数字端口
|
||||
M0P_GPIO->PEADS &= 0x0000; ///< PE00~15配置为数字端口
|
||||
M0P_GPIO->PFADS &= 0xF9C3; ///< PF02~05/PF09/PF10配置为数字端口
|
||||
|
||||
M0P_GPIO->PCDIR |= 0x1FFF; ///< PC00~12配置为端口输入
|
||||
M0P_GPIO->PDDIR |= 0xFFFF; ///< PD00~15配置为端口输入
|
||||
M0P_GPIO->PEDIR |= 0xFFFF; ///< PE00~15配置为端口输入
|
||||
M0P_GPIO->PFDIR |= 0x063C; ///< PF02~05/PF09/PF10配置为数字端口
|
||||
|
||||
|
||||
M0P_GPIO->PCPU |= 0x1FFF; ///< PC00~12配置为上拉
|
||||
M0P_GPIO->PDPU |= 0xFFFF; ///< PD00~15配置为上拉
|
||||
M0P_GPIO->PEPU |= 0xFFFF; ///< PE00~15配置为上拉
|
||||
M0P_GPIO->PFPU |= 0x063C; ///< PF02~05/PF09/PF10配置为数字端口
|
||||
|
||||
#elif defined(HC32L17xFxxx) //32PIN MCU
|
||||
M0P_GPIO->PAADS &= 0xFFF4; ///< PA00/PA01/PA03配置为数字端口
|
||||
M0P_GPIO->PBADS &= 0x08FB; ///< PB02/PB08~10/PB12~15配置为数字端口
|
||||
M0P_GPIO->PCADS &= 0xC000; ///< PC00~13配置为数字端口
|
||||
M0P_GPIO->PDADS &= 0x0000; ///< PD00~15配置为数字端口
|
||||
M0P_GPIO->PEADS &= 0x0000; ///< PE00~15配置为数字端口
|
||||
M0P_GPIO->PFADS &= 0xF903; ///< PF02~07/PF09/PF10配置为数字端口
|
||||
|
||||
M0P_GPIO->PADIR |= 0x000B; ///< PA00/PA01/PA03配置为端口输入
|
||||
M0P_GPIO->PBDIR |= 0xF704; ///< PB02/PB08~10/PB12~15配置为端口输入
|
||||
M0P_GPIO->PCDIR |= 0x3FFF; ///< PC00~13配置为端口输入
|
||||
M0P_GPIO->PDDIR |= 0xFFFF; ///< PD00~15配置为端口输入
|
||||
M0P_GPIO->PEDIR |= 0xFFFF; ///< PE00~15配置为端口输入
|
||||
M0P_GPIO->PFDIR |= 0x06FC; ///< PF02~07/PF09/PF10配置为数字端口
|
||||
|
||||
M0P_GPIO->PAPU |= 0x000B; ///< PA00/PA01/PA03配置为上拉
|
||||
M0P_GPIO->PBPU |= 0xF704; ///< PB02/PB08~10/PB12~15配置为上拉
|
||||
M0P_GPIO->PCPU |= 0x3FFF; ///< PC00~13配置为上拉
|
||||
M0P_GPIO->PDPU |= 0xFFFF; ///< PD00~15配置为上拉
|
||||
M0P_GPIO->PEPU |= 0xFFFF; ///< PE00~15配置为上拉
|
||||
M0P_GPIO->PFPU |= 0x06FC; ///< PF02~07/PF09/PF10配置为数字端口
|
||||
|
||||
#endif
|
||||
|
||||
M0P_SYSCTRL->PERI_CLKEN0 = tmpReg;
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
** \brief Setup the microcontroller system. Initialize the System and update
|
||||
** the SystemCoreClock variable.
|
||||
**
|
||||
** \param none
|
||||
** \return none
|
||||
******************************************************************************/
|
||||
void SystemInit(void)
|
||||
{
|
||||
M0P_SYSCTRL->RCL_CR_f.TRIM = (*((volatile uint16_t*) (0x00100C22ul)));
|
||||
M0P_SYSCTRL->RCH_CR_f.TRIM = (*((volatile uint16_t*) (0x00100C08ul)));
|
||||
SystemCoreClockUpdate();
|
||||
_InitHidePin();
|
||||
}
|
||||
|
||||
|
||||
#if defined (__CC_ARM)
|
||||
extern int32_t $Super$$main(void);
|
||||
/* re-define main function */
|
||||
int $Sub$$main(void)
|
||||
{
|
||||
SystemInit();
|
||||
$Super$$main();
|
||||
return 0;
|
||||
}
|
||||
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
||||
extern int32_t $Super$$main(void);
|
||||
/* re-define main function */
|
||||
int $Sub$$main(void)
|
||||
{
|
||||
SystemInit();
|
||||
$Super$$main();
|
||||
return 0;
|
||||
}
|
||||
#elif defined(__ICCARM__)
|
||||
extern int32_t main(void);
|
||||
/* __low_level_init will auto called by IAR cstartup */
|
||||
extern void __iar_data_init3(void);
|
||||
int __low_level_init(void)
|
||||
{
|
||||
// call IAR table copy function.
|
||||
__iar_data_init3();
|
||||
SystemInit();
|
||||
main();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2019, Huada Semiconductor Co.,Ltd All rights reserved.
|
||||
*
|
||||
* This software is owned and published by:
|
||||
* Huada Semiconductor Co.,Ltd ("HDSC").
|
||||
*
|
||||
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
|
||||
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
|
||||
*
|
||||
* This software contains source code for use with HDSC
|
||||
* components. This software is licensed by HDSC to be adapted only
|
||||
* for use in systems utilizing HDSC components. HDSC shall not be
|
||||
* responsible for misuse or illegal use of this software for devices not
|
||||
* supported herein. HDSC is providing this software "AS IS" and will
|
||||
* not be responsible for issues arising from incorrect user implementation
|
||||
* of the software.
|
||||
*
|
||||
* Disclaimer:
|
||||
* HDSC MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
|
||||
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
|
||||
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
|
||||
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
|
||||
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
|
||||
* WARRANTY OF NONINFRINGEMENT.
|
||||
* HDSC SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
|
||||
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
|
||||
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
|
||||
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
|
||||
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
|
||||
* SAVINGS OR PROFITS,
|
||||
* EVEN IF Disclaimer HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
|
||||
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
|
||||
* FROM, THE SOFTWARE.
|
||||
*
|
||||
* This software may be replicated in part or whole for the licensed use,
|
||||
* with the restriction that this Disclaimer and Copyright notice must be
|
||||
* included with each copy of this software, whether used in part or whole,
|
||||
* at all times.
|
||||
*/
|
||||
/******************************************************************************/
|
||||
/** \file system_hc32l17x.h
|
||||
**
|
||||
** A detailed description is available at
|
||||
** @link SampleGroup Some description @endlink
|
||||
**
|
||||
** - 2019-03-01 1.0 Lux First version.
|
||||
**
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __SYSTEM_HC32L17X_H__
|
||||
#define __SYSTEM_HC32L17X_H__
|
||||
|
||||
/******************************************************************************/
|
||||
/* Include files */
|
||||
/******************************************************************************/
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
/* Global pre-processor symbols/macros ('define') */
|
||||
/******************************************************************************/
|
||||
#define HWWD_DISABLE (1)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
** \brief Clock Setup macro definition
|
||||
**
|
||||
** - 0: CLOCK_SETTING_NONE - User provides own clock setting in application
|
||||
** - 1: CLOCK_SETTING_CMSIS -
|
||||
******************************************************************************/
|
||||
#define CLOCK_SETTING_NONE 0u
|
||||
#define CLOCK_SETTING_CMSIS 1u
|
||||
|
||||
//#define HC32L17xPxxx //100PIN
|
||||
//#define HC32L17xMxxx //80PIN
|
||||
//#define HC32L17xKxxx //64PIN
|
||||
//#define HC32L17xJxxx //48PIN
|
||||
#define HC32L17xFxxx //32PIN
|
||||
|
||||
/******************************************************************************/
|
||||
/* */
|
||||
/* START OF USER SETTINGS HERE */
|
||||
/* =========================== */
|
||||
/* */
|
||||
/* All lines with '<<<' can be set by user. */
|
||||
/* */
|
||||
/******************************************************************************/
|
||||
|
||||
/******************************************************************************/
|
||||
/* Global function prototypes ('extern', definition in C source) */
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
extern uint32_t SystemCoreClock; // System Clock Frequency (Core Clock)
|
||||
extern void SystemInit (void); // Initialize the system
|
||||
extern void SystemCoreClockUpdate (void); // Update SystemCoreClock variable
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __SYSTEM_HC32L17X _H__ */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user