From 7832046168b5c96286928e3f5b7124bff1f6973c Mon Sep 17 00:00:00 2001 From: SEEKFREE_BUDING <2289331269@qq.com> Date: Wed, 22 Mar 2023 11:45:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=9A=E6=A0=B8=E5=BF=83?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=87=BD=E6=95=B0=EF=BC=8C=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E9=87=8F=E6=8E=A7=E5=88=B6=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- .../libraries/zf_common/zf_common_clock.c | 6 +++-- .../libraries/zf_common/zf_common_clock.c | 22 +++++++++++++++---- 16 files changed, 274 insertions(+), 62 deletions(-) diff --git a/Example/E01_gpio_demo/libraries/zf_common/zf_common_clock.c b/Example/E01_gpio_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E01_gpio_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E01_gpio_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E02_uart_demo/libraries/zf_common/zf_common_clock.c b/Example/E02_uart_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E02_uart_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E02_uart_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E03_adc_demo/libraries/zf_common/zf_common_clock.c b/Example/E03_adc_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E03_adc_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E03_adc_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E04_pwm_demo/libraries/zf_common/zf_common_clock.c b/Example/E04_pwm_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E04_pwm_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E04_pwm_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E05_pit_demo/libraries/zf_common/zf_common_clock.c b/Example/E05_pit_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E05_pit_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E05_pit_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E06_exit_demo/libraries/zf_common/zf_common_clock.c b/Example/E06_exit_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E06_exit_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E06_exit_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E07_encoder_demo/libraries/zf_common/zf_common_clock.c b/Example/E07_encoder_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E07_encoder_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E07_encoder_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E08_eeprom_demo/libraries/zf_common/zf_common_clock.c b/Example/E08_eeprom_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E08_eeprom_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E08_eeprom_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E09_timer_demo/libraries/zf_common/zf_common_clock.c b/Example/E09_timer_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E09_timer_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E09_timer_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E10_printf_debug_log_demo/libraries/zf_common/zf_common_clock.c b/Example/E10_printf_debug_log_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E10_printf_debug_log_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E10_printf_debug_log_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E11_interrupt_priority_set_demo/libraries/zf_common/zf_common_clock.c b/Example/E11_interrupt_priority_set_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E11_interrupt_priority_set_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E11_interrupt_priority_set_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_common/zf_common_clock.c b/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E12_cpu1_handles_interrupts_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E13_dual_core_demo/libraries/zf_common/zf_common_clock.c b/Example/E13_dual_core_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E13_dual_core_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E13_dual_core_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_common/zf_common_clock.c b/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E14_specifies_variable_or_code_location_demo/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); } diff --git a/Example/E15_fft_demo/libraries/zf_common/zf_common_clock.c b/Example/E15_fft_demo/libraries/zf_common/zf_common_clock.c index 16b9e1c..f1ad9de 100644 --- a/Example/E15_fft_demo/libraries/zf_common/zf_common_clock.c +++ b/Example/E15_fft_demo/libraries/zf_common/zf_common_clock.c @@ -106,6 +106,8 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - IfxCpu_emitEvent(&g_cpuSyncEvent); - IfxCpu_waitEvent(&g_cpuSyncEvent, 0xFFFF); + while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + { + IfxCpu_emitEvent(&g_cpuSyncEvent); + } } diff --git a/Seekfree_TC264_Opensource_Library/libraries/zf_common/zf_common_clock.c b/Seekfree_TC264_Opensource_Library/libraries/zf_common/zf_common_clock.c index f1ad9de..0078457 100644 --- a/Seekfree_TC264_Opensource_Library/libraries/zf_common/zf_common_clock.c +++ b/Seekfree_TC264_Opensource_Library/libraries/zf_common/zf_common_clock.c @@ -37,12 +37,14 @@ #include "Ifxstm.h" #include "Cpu0_Main.h" #include "Cpu/Std/IfxCpu.h" +#include "zf_driver_delay.h" #include "zf_common_interrupt.h" #include "zf_common_clock.h" + App_Cpu0 g_AppCpu0; // 频率信息变量 -IFX_ALIGN(4) IfxCpu_syncEvent g_cpuSyncEvent = 0; // 事件同步变量 +static uint8 cpu_init_finsh[IfxCpu_Id_none]; // 核心初始化完成标志位 //------------------------------------------------------------------------------------------------------------------- // 函数简介 设置系统频率 @@ -106,8 +108,20 @@ void clock_init (void) //------------------------------------------------------------------------------------------------------------------- void cpu_wait_event_ready (void) { - while(IfxCpu_waitEvent(&g_cpuSyncEvent, 5)) + uint8 i; + uint8 all_cpu_init_finsh; + + // 调用此函数的核心初始化完毕,标志位置一 + cpu_init_finsh[IfxCpu_getCoreId()] = 1; + + // 等待其他核心初始化完毕 + do { - IfxCpu_emitEvent(&g_cpuSyncEvent); - } + all_cpu_init_finsh = 1; + for(i = 0; i < IfxCpu_Id_none; i++) + { + all_cpu_init_finsh *= cpu_init_finsh[i]; + } + system_delay_ms(1); + }while(0 == all_cpu_init_finsh); }