/** ########################################################################## ** Filename : ** Project : ** Module : ** Processor : ** Version : ** Compiler : ** Date/Time : ** Abstract : ** Contents : ** Note : ** (c) Copyright dmdz Co.,Ltd ** -------------------------------------------------------------------------- ** R E V I S I O N H I S T O R Y ** -------------------------------------------------------------------------- ** Date Ver Author Description ** -20191106- --V01-- --LYJ--- --初版-- ** -20230602- --V1.0-- --mingyea--- --修改-- ** -20231202- --V1.1-- --linboyi--- --加了计数的方式-- ** #########################################################################*/ /*--------------------------------------------------------------------------- - I N C L U D E F I L E S ----------------------------------------------------------------------------*/ #include "cpu.h" #include "common_types.h" #include "common_cfg.h" /*--------------------------------------------------------------------------- - D E F I N E S / M A C R O S ----------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- - T Y P E D E F I N I T I O N S ----------------------------------------------------------------------------*/ typedef struct { u32 low; u32 high; u8 iwdtslp; u8 iwdtslp_f; }cpu_opt_bytes_t; cpu_opt_bytes_t g_cpu_opt_bytes; /*--------------------------------------------------------------------------- - S T A T I C V A R I A B L E S ----------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- * G L O B A L V A R I A B L E S ----------------------------------------------------------------------------*/ static uint32_t ulInterruptDisableCount = 0; /*--------------------------------------------------------------------------- - C O N S T A N T S ----------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- - F U N C T I O N P R O T O T Y P E ----------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- |Prototype : HardFault_Handler |Called by : None |Preconditions : None |Input parameters : None |Output parameters : None |Return value : None |Description : TBD Cpu configuration will be generated here ----------------------------------------------------------------------------*/ void HardFault_Handler(void) { SystemSoftwareReset(); } /*--------------------------------------------------------------------------- |Prototype : cpu_get_opt_bytes |Called by : None |Preconditions : None |Input parameters : None |Output parameters : None |Return value : None |Description : ----------------------------------------------------------------------------*/ void cpu_get_opt_bytes(void) { g_cpu_opt_bytes.low = *(u32*)0x1ffffc00; g_cpu_opt_bytes.high = *(u32*)0x1ffffc04; g_cpu_opt_bytes.iwdtslp = (uint8_t)((g_cpu_opt_bytes.high >> 4u) & 0x0fu); g_cpu_opt_bytes.iwdtslp_f = (uint8_t)((g_cpu_opt_bytes.high >> 20u) & 0x0fu); } /*--------------------------------------------------------------------------- |Prototype : System_EnableIrqGlobal |Called by : None |Preconditions : None |Input parameters : None |Output parameters : None |Return value : None |Description : ----------------------------------------------------------------------------*/ void System_EnableIrqGlobal(void) { if(ulInterruptDisableCount > 0ul) { ulInterruptDisableCount --; if(ulInterruptDisableCount == 0ul) { __enable_irq(); /* PRQA S 3335*/ } } } /*--------------------------------------------------------------------------- |Prototype : System_DisableIrqGlobal |Called by : None |Preconditions : None |Input parameters : None |Output parameters : None |Return value : None |Description : ----------------------------------------------------------------------------*/ void System_DisableIrqGlobal(void) { if(ulInterruptDisableCount < 0xfffffffful) { __disable_irq(); /* PRQA S 3335*/ ulInterruptDisableCount ++; } else { SystemSoftwareReset(); } } /* END Cpu. */