int aw_pm_begin(suspend_state_t state) { PM_DBG("%d state begin:%d\n", state,debug_mask); //set freq max #ifdef CONFIG_CPU_FREQ_USR_EVNT_NOTIFY //cpufreq_user_event_notify(); #endif /*must init perfcounter, because delay_us and delay_ms is depandant perf counter*/ #ifndef GET_CYCLE_CNT backup_perfcounter(); init_perfcounters (1, 0); #endif if(unlikely(debug_mask&PM_STANDBY_PRINT_REG)){ printk("before dev suspend , line:%d\n", __LINE__); show_reg(SW_VA_CCM_IO_BASE, (CCU_REG_LENGTH)*4, "ccu"); show_reg(SW_VA_PORTC_IO_BASE, GPIO_REG_LENGTH*4, "gpio"); show_reg(SW_VA_TIMERC_IO_BASE, TMR_REG_LENGTH*4, "timer"); show_reg(SW_VA_TWI0_IO_BASE, TWI0_REG_LENGTH*4, "twi0"); show_reg(SW_VA_SRAM_IO_BASE, SRAM_REG_LENGTH*4, "sram"); if (userdef_reg_addr != 0 && userdef_reg_size != 0) { show_reg(userdef_reg_addr, userdef_reg_size*4, "user defined"); } } return 0; }
int aw_pm_begin(suspend_state_t state) { struct cpufreq_policy *policy; PM_DBG("%d state begin:%d\n", state,debug_mask); //set freq max #ifdef CONFIG_CPU_FREQ_USR_EVNT_NOTIFY //cpufreq_user_event_notify(); #endif backup_max_freq = 0; backup_min_freq = 0; policy = cpufreq_cpu_get(0); if (!policy) { PM_DBG("line:%d cpufreq_cpu_get failed!\n", __LINE__); goto out; } backup_max_freq = policy->max; backup_min_freq = policy->min; policy->user_policy.max= suspend_freq; policy->user_policy.min = suspend_freq; cpufreq_cpu_put(policy); cpufreq_update_policy(0); /*must init perfcounter, because delay_us and delay_ms is depandant perf counter*/ #ifndef GET_CYCLE_CNT backup_perfcounter(); init_perfcounters (1, 0); #endif if(unlikely(debug_mask&PM_STANDBY_PRINT_REG)){ printk("before dev suspend , line:%d\n", __LINE__); show_reg(SW_VA_CCM_IO_BASE, (CCU_REG_LENGTH)*4, "ccu"); show_reg(SW_VA_PORTC_IO_BASE, GPIO_REG_LENGTH*4, "gpio"); show_reg(SW_VA_TIMERC_IO_BASE, TMR_REG_LENGTH*4, "timer"); show_reg(SW_VA_TWI0_IO_BASE, TWI0_REG_LENGTH*4, "twi0"); show_reg(SW_VA_SRAM_IO_BASE, SRAM_REG_LENGTH*4, "sram"); if (userdef_reg_addr != 0 && userdef_reg_size != 0) { show_reg(userdef_reg_addr, userdef_reg_size*4, "user defined"); } } return 0; out: return -1; }
static int aw_pm_valid(suspend_state_t state) { #ifdef CHECK_IC_VERSION enum sw_ic_ver version = MAGIC_VER_NULL; #endif PM_DBG("valid\n"); console_suspend_enabled = 0; if(!((state > PM_SUSPEND_ON) && (state < PM_SUSPEND_MAX))){ PM_DBG("state (%d) invalid!\n", state); return 0; } #ifdef CHECK_IC_VERSION if(1 == standby_mode){ version = sw_get_ic_ver(); if(!(MAGIC_VER_A13B == version || MAGIC_VER_A12B == version || MAGIC_VER_A10SB == version)){ pr_info("ic version: %d not support super standby. \n", version); standby_mode = 0; } } #endif //if 1 == standby_mode, actually, mean mem corresponding with super standby if(PM_SUSPEND_STANDBY == state){ if(1 == standby_mode){ standby_type = NORMAL_STANDBY; }else{ standby_type = SUPER_STANDBY; } printk("standby_mode:%d, standby_type:%d, line:%d\n",standby_mode, standby_type, __LINE__); }else if(PM_SUSPEND_MEM == state || PM_SUSPEND_BOOTFAST == state){ if(1 == standby_mode){ standby_type = SUPER_STANDBY; }else{ standby_type = NORMAL_STANDBY; } printk("standby_mode:%d, standby_type:%d, line:%d\n",standby_mode, standby_type, __LINE__); } //allocat space for backup dram data if(SUPER_STANDBY == standby_type){ if((DRAM_BACKUP_SIZE) < ((int)&resume0_bin_end - (int)&resume0_bin_start) ){ //judge the reserved space for resume0 is enough or not. pr_info("Notice: reserved space(%d) for resume is not enough(%d). \n", DRAM_BACKUP_SIZE,((int)&resume0_bin_end - (int)&resume0_bin_start)); return 0; } memcpy((void *)DRAM_BACKUP_BASE_ADDR, (void *)&resume0_bin_start, (int)&resume0_bin_end - (int)&resume0_bin_start); dmac_flush_range((void *)DRAM_BACKUP_BASE_ADDR, (void *)(DRAM_BACKUP_BASE_ADDR + DRAM_BACKUP_SIZE -1) ); } #ifdef GET_CYCLE_CNT // init counters: init_perfcounters (1, 0); #endif return 1; }
void AXI_INTERRUPT_SobelIntr_Handler(void * baseaddr_p) { printf("SobelIntr: %d CPU clk\n\r", get_cyclecount()); init_perfcounters(1, 0); }
/***************************************************************************//** * @brief Main function. * * @return Returns 0. *******************************************************************************/ int main() { MajorRev = 1; MinorRev = 1; RcRev = 1; DriverEnable = TRUE; LastEnable = FALSE; /*Enable cache*/ Xil_ICacheEnable(); Xil_DCacheEnable(); /* Perform any required platform init */ /* including hardware reset to HDMI devices */ HAL_PlatformInit(XPAR_AXI_IIC_0_BASEADDR, XPAR_SCUTIMER_DEVICE_ID, XPAR_SCUGIC_SINGLE_DEVICE_ID, XPAR_SCUTIMER_INTR); /* Initialize ADI repeater software and h/w */ ADIAPI_TransmitterInit(); ADIAPI_TransmitterSetPowerMode(REP_POWER_UP); StartCount = HAL_GetCurrentMsCount(); ADIAPI_TransmitterMain(); /*Initialize the HDMI Core with default display settings*/ SetVideoResolution(RESOLUTION_640x480); /* * Initialize CE engine */ xstatus = CE_init(); if (xstatus != XST_SUCCESS) { xil_printf("Unable to initialize CE HA!\n"); return XST_FAILURE; } /* * Initialize ME engine */ xstatus = ME_init(); if (xstatus != XST_SUCCESS) { xil_printf("Unable to initialize ME HA!\n"); return XST_FAILURE; } /* * Initialize EEE engine */ xstatus = EEE_init(); if (xstatus != XST_SUCCESS) { xil_printf("Unable to initialize EEE HA!\n"); return XST_FAILURE; } /* * Initialize ECE engine */ xstatus = ECE_init(); if (xstatus != XST_SUCCESS) { xil_printf("Unable to initialize ECE HA!\n"); return XST_FAILURE; } /* Initialize the interrupt controller */ xstatus = ScuGicInterrupt_Init(); if (xstatus != XST_SUCCESS) { xil_printf("Unable to initialize Interrupts\n"); return XST_FAILURE; } /* * Initially configure CE */ XCe_SetWidth(&hlsCE, width); XCe_SetHeight(&hlsCE, height); XCe_SetCsd1(&hlsCE, csd1); XCe_SetCsd2(&hlsCE, csd2); XCe_SetEpsilon(&hlsCE, epsilon); /* * Initially configure ME */ XMatchingengine32_SetWidth_v(&hlsME, width); XMatchingengine32_SetHeight_v(&hlsME, height); XMatchingengine32_SetReadaddress1_v(&hlsME, CE_OUTPUT_1_BASEADDR); XMatchingengine32_SetReadaddress2_v(&hlsME, CE_OUTPUT_2_BASEADDR); XMatchingengine32_SetFeatureout_v(&hlsME, FEATURE_X1_BASEADDR); /* * Initially configure EEE */ XEee_SetFaddr_v(&hlsEEE, FEATURE_X1_BASEADDR); XEee_SetVecoutaddr_v(&hlsEEE, PRE_COMP_VECTOR_HW); XEee_SetModelcount_v(&hlsEEE, 300); XEee_SetErrthres_v(&hlsEEE, 2); XEee_SetResultaddr_v(&hlsEEE, RESULT_ADDR); XEee_SetModeladdr_v(&hlsEEE, (u32) model_param_32); /* * No initial configuration for EEE */ XEee_SetFaddr_v(&hlsEEE, FEATURE_X1_BASEADDR); XEee_SetVecoutaddr_v(&hlsEEE, PRE_COMP_VECTOR_HW); XEee_SetModelcount_v(&hlsEEE, 300); XEee_SetErrthres_v(&hlsEEE, 2); XEee_SetResultaddr_v(&hlsEEE, RESULT_ADDR); XEee_SetModeladdr_v(&hlsEEE, (u32) model_param_32); /* * Initial Camera/Still Image mode choose */ printf("-------------------------------------\n"); printf("----------------Menu-----------------\n"); printf("-------------------------------------\n"); printf("-----Camera mode: press 'v' or 'V'---\n"); printf("-Sill images mode: press 'i' or 'I'--\n"); printf("--Quit Processing: press 'q' or 'Q'--\n"); printf("-------------------------------------\n"); printf("-------------------------------------\n"); char ctmp = 0; while (1) { while (!XUartPs_IsReceiveData(UART_BASEADDR)) ; ctmp = inbyte(); if (ctmp == 'v' || ctmp == 'V') { Camflag = 1; printf("-------------------------------------\n"); printf("--------------Camera mode------------\n"); printf("-------------------------------------\n"); printf("-------------------------------------\n"); printf( "You can switch to Still Image mode using 'i' or 'I' later\n"); printf("-------------------------------------\n"); break; } if (ctmp == 'i' || ctmp == 'I') { Camflag = 0; printf("-------------------------------------\n"); printf("------------Still image mode---------\n"); printf("-------------------------------------\n"); printf("-------------------------------------\n"); printf("You can switch to Camera mode using 'v' or 'V' later\n"); printf("-------------------------------------\n"); break; } if (ctmp == 'q' || ctmp == 'Q') { printf("-----------Exiting Application-------\n"); return 0; } printf("No such Option!!\n"); } /* * Instruction book */ printf("-------------------------------------\n"); printf("-------------Instructions------------\n"); printf("-------------------------------------\n"); printf("With/W.o. processing: press 'o' or 'O'\n"); printf("---Pure software: press 's' or 'S'---\n"); printf("---Pure hardware: press 'h' or 'H'---\n"); printf("Toggle SW/HW for CE: press 'c' or 'C'\n"); printf("Toggle SW/HW for ME: press 'm' or 'M'\n"); printf("Toggle SW/HW for EEE: press 'e' or 'E'\n"); printf("Toggle SW/HW for ECE: press 'f' or 'F'\n"); printf("--------Show CE output: press '1'--------\n"); printf("--------Show ME output: press '2'--------\n"); printf("------Show final output: press '3'-------\n"); printf("--Quit Processing: press 'q' or 'Q'--\n"); printf("-------------------------------------\n"); printf("-------------------------------------\n"); printf("-----------------------------------------\n"); printf("Special instructions for Still Image mode\n"); printf("-----------------------------------------\n"); printf("Start from the first frame: press up arrow\n"); printf("---Go to the last frame: press down arrow\n"); printf("Processing the next frame: press right arrow\n"); printf("Processing the previous frame: press left arrow\n"); printf("-----------------------------------------\n"); printf("-----------------------------------------\n"); /* * Main loop */ while (config()) { if (Oflag) { if (Camflag) { while (FRAME_INTR == 0) ; FRAME_INTR = 0; CameraCopy(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], VIDEO_BASEADDR, OUTPUT_BASEADDR); } else { ConvGray8ToGray32(640, 480, GET_INPUT_ADDR(fnum+1), OUTPUT_BASEADDR); } } else { if (!ceflag) { if (!Camflag) { printf("Still image mode, Software CE processing\n"); init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); ImageSmoothGray8(640, 480, GET_INPUT_ADDR(fnum), CE_BYTE_1_BASEADDR); CensusEngine8to32(640, 480, 20, 3, 7, CE_BYTE_1_BASEADDR, CE_OUTPUT_1_BASEADDR); count = get_cyclecount() - count; printf("CE software processing 1 time:%f \n", ((float) count) / CPUFREQ * 1000); ceswcount++; ceswsum += count; init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); ImageSmoothGray8(640, 480, GET_INPUT_ADDR(fnum+1), CE_BYTE_2_BASEADDR); CensusEngine8to32(640, 480, 20, 3, 7, CE_BYTE_2_BASEADDR, CE_OUTPUT_2_BASEADDR); count = get_cyclecount() - count; printf("CE software processing 2 time:%f \n", ((float) count) / CPUFREQ * 1000); ceswcount++; ceswsum += count; Xil_DCacheFlush(); } else { printf("Camera mode, Software CE processing\n"); while (FRAME_INTR == 0) ; FRAME_INTR = 0; Camera24ToGray8(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], VIDEO_BASEADDR, CE_PROC_1_BASEADDR); init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); ImageSmoothGray8(640, 480, CE_PROC_1_BASEADDR, CE_BYTE_1_BASEADDR); CensusEngine8to32(640, 480, 20, 3, 7, CE_BYTE_1_BASEADDR, CE_OUTPUT_1_BASEADDR); count = get_cyclecount() - count; printf("CE software processing 1 time:%f \n", ((float) count) / CPUFREQ * 1000); ceswcount++; ceswsum += count; while (FRAME_INTR == 0) ; FRAME_INTR = 0; CameraCopy(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], VIDEO_BASEADDR, BUF_CAM); Camera24ToGray8(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], VIDEO_BASEADDR, CE_PROC_2_BASEADDR); init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); ImageSmoothGray8(640, 480, CE_PROC_2_BASEADDR, CE_BYTE_2_BASEADDR); CensusEngine8to32(640, 480, 20, 3, 7, CE_BYTE_2_BASEADDR, CE_OUTPUT_2_BASEADDR); count = get_cyclecount() - count; printf("CE software processing 2 time:%f \n", ((float) count) / CPUFREQ * 1000); ceswcount++; ceswsum += count; Xil_DCacheFlush(); } } else { if (!XCe_IsReady(&hlsCE)) { DBG_MSG( "!!! HLS_CE peripheral is not ready! Exiting...\n\r"); return XST_FAILURE; } if (!Camflag) { printf("Still image mode, Hardware CE processing\n"); XCe_SetReadaddress(&hlsCE, GET_INPUT_ADDR(fnum)); } else { printf("Camera mode, Hardware CE processing\n"); while (FRAME_INTR == 0) ; FRAME_INTR = 0; Camera24ToGray8(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], VIDEO_BASEADDR, CE_PROC_1_BASEADDR); Xil_DCacheFlush(); XCe_SetReadaddress(&hlsCE, CE_PROC_1_BASEADDR); } XCe_SetWriteaddress(&hlsCE, CE_OUTPUT_1_BASEADDR); init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); CE_start(); while (CEisdone == 0) ; CEisdone = 0; count = get_cyclecount() - count; printf("CE hardware processing 1 time:%f \n", ((float) count) / CPUFREQ * 1000); cehwcount++; cehwsum += count; if (!XCe_IsReady(&hlsCE)) { DBG_MSG( "!!! HLS_CE peripheral is not ready! Exiting...\n\r"); return XST_FAILURE; } if (!Camflag) { XCe_SetReadaddress(&hlsCE, GET_INPUT_ADDR(fnum+1)); } else { while (FRAME_INTR == 0) ; FRAME_INTR = 0; CameraCopy(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], VIDEO_BASEADDR, BUF_CAM); Camera24ToGray8(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], VIDEO_BASEADDR, CE_PROC_2_BASEADDR); Xil_DCacheFlush(); XCe_SetReadaddress(&hlsCE, CE_PROC_2_BASEADDR); } XCe_SetWriteaddress(&hlsCE, CE_OUTPUT_2_BASEADDR); init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); CE_start(); while (CEisdone == 0) ; CEisdone = 0; count = get_cyclecount() - count; printf("CE hardware processing 2 time:%f \n", ((float) count) / CPUFREQ * 1000); cehwcount++; cehwsum += count; } if (!meflag) { if (!Camflag) { printf("Still image mode, Software ME processing\n"); } else { printf("Camera mode, Software ME processing\n"); } init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); matchcount = MatchingEngine32HWO(640, 480, 7, 7, CE_OUTPUT_1_BASEADDR, CE_OUTPUT_2_BASEADDR, FEATURE_X1_BASEADDR); count = get_cyclecount() - count; printf("ME software processing time:%f \n", ((float) count) / CPUFREQ * 1000); printf("matchcount: %d\n", matchcount); meswcount++; meswsum += count; Xil_DCacheFlush(); } else { if (!Camflag) { printf("Still image mode, Hardware ME processing\n"); } else { printf("Camera mode, Hardware ME processing\n"); } if (!XMatchingengine32_IsReady(&hlsME)) { DBG_MSG( "!!! HLS_ME peripheral is not ready! Exiting...\n\r"); return XST_FAILURE; } init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); ME_start(); while (MEisdone == 0) ; MEisdone = 0; count = get_cyclecount() - count; printf("ME hardware processing time:%f \n", ((float) count) / CPUFREQ * 1000); matchcount = XMatchingengine32_GetReturn(&hlsME); printf("matchcount: %d\n", matchcount); mehwcount++; mehwsum += count; } if (!Camflag) { ConvGray8ToGray32(640, 480, GET_INPUT_ADDR(fnum+1), OUTPUT_ME_BASEADDR); DrawVector32hw(640, 480, FEATURE_X1_BASEADDR, matchcount, OUTPUT_ME_BASEADDR, 0); Xil_DCacheFlush(); } presample(FEATURE_X1_BASEADDR, FEATURE_IMG, matchcount, 640, 480); if (!eeeflag) { if (!Camflag) { printf("Still image mode, Software EEE processing\n"); } else { printf("Camera mode, Software EEE processing\n"); } init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); samplecount = sample_flow_vectors(FEATURE_IMG, COMP_VECTOR, 640, 480, 2, 8); ret = estimate_ego_motion_first_order_flow(COMP_VECTOR, samplecount, model_param_est, 300, 300, 2, 0.75F); count = get_cyclecount() - count; printf("SW EEE consuming time: %f ms\n", ((float) count) / CPUFREQ * 1000); printf("samplecount: %d\n", samplecount); if (ret) { printf("Software EEE succeeds!!\n"); eeeswcount++; eeeswsum += count; Xil_DCacheFlush(); } else { printf("Software EEE fails!!\n"); } } else { if (!Camflag) { printf("Still image mode, Hardware EEE processing\n"); } else { printf("Camera mode, Hardware EEE processing\n"); } if (!XEee_IsReady(&hlsEEE)) { DBG_MSG( "!!! HLS_EEE peripheral is not ready! Exiting...\n\r"); return XST_FAILURE; } XEee_SetMatchcount_v(&hlsEEE, matchcount); XEee_SetMode_v(&hlsEEE, 0); init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); EEE_start(); while (EEEisdone == 0) ; EEEisdone = 0; samplecount = compressvectorHW(PRE_COMP_VECTOR_HW, COMP_VECTOR_HW, 80, 60); ret = estimate_ego_motion_first_order_flow_HW( COMP_VECTOR_HW, samplecount, model_param_est, model_param_32, 300, 300); Xil_DCacheFlush(); if (ret) { if (!XEee_IsReady(&hlsEEE)) { DBG_MSG( "!!! HLS_EEE peripheral is not ready! Exiting...\n\r"); return XST_FAILURE; } XEee_SetMode_v(&hlsEEE, 1); XEee_SetModeladdr_v(&hlsEEE, (u32) model_param_32); EEE_start(); while (EEEisdone == 0) ; EEEisdone = 0; count = get_cyclecount() - count; printf("HW EEE consuming time: %f ms\n", ((float) count) / CPUFREQ * 1000); printf("samplecount: %d\n", samplecount); eeehwcount++; eeehwsum += count; int validvectors = Xil_In32(RESULT_ADDR) >> 16; int betteroutlier = Xil_In32(RESULT_ADDR) & 0xffff; bmid = Xil_In32(RESULT_ADDR + 4); printf(" XC: %f \n\r", ((float) model_param_32[4 * bmid]) / 8.0); printf(" YC: %f \n\r", ((float) model_param_32[4 * bmid + 1]) / 8.0); printf(" D : %f \n\r", ((float) model_param_32[4 * bmid + 2]) / 2147483648.0); printf(" R : %f \n\r", ((float) model_param_32[4 * bmid + 3]) / 2147483648.0); printf(" Total iterations : %d \n\r", 300); printf(" Outlier count : %d \n\r", betteroutlier); printf(" Total count : %d \n\r", validvectors); printf(" Outlier Ratio : %f \n\r", ((float) betteroutlier) / ((float) validvectors)); printf("HW EEE succeeds!!\n"); } else { count = get_cyclecount() - count; printf("HW EEE consuming time: %f ms\n", ((float) count) / CPUFREQ * 1000); printf("samplecount: %d\n", samplecount); printf("HW EEE fails!!\n"); } } if (ret) { if (!eceflag) { if (eeeflag) { model_param_est[0] = ((float) model_param_32[4 * bmid]) / 8.0; model_param_est[1] = ((float) model_param_32[4 * bmid + 1]) / 8.0; model_param_est[2] = ((float) model_param_32[4 * bmid + 2]) / 2147483648.0; model_param_est[3] = ((float) model_param_32[4 * bmid + 3]) / 2147483648.0; } init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); samplecount = sample_flow_vectors(FEATURE_IMG, FULL_VECTOR, 640, 480, 0, 1); gen_firstOrderFlow_vectors_4(model_param_est, samplecount, FULL_VECTOR, RES_VECTOR); diff_motion_vectors(FULL_VECTOR, RES_VECTOR, samplecount, RES_VECTOR, 2); count = get_cyclecount() - count; printf("SW ECE consuming time: %f ms\n", ((float) count) / CPUFREQ * 1000); if (!Camflag) { ConvGray8ToGray32(640, 480, GET_INPUT_ADDR(fnum+1), OUTPUT_BASEADDR); } else { CameraCopy(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], BUF_CAM, OUTPUT_BASEADDR); } DrawVector32eee(640, 480, samplecount, RES_VECTOR, OUTPUT_BASEADDR, 0); Xil_DCacheFlush(); eceswcount++; eceswsum += count; } else { if (!XEce_IsReady(&hlsECE)) { DBG_MSG( "!!! HLS_ECE peripheral is not ready! Exiting...\n\r"); return XST_FAILURE; } XEce_SetFullvectoraddr_v(&hlsECE, FEATURE_X1_BASEADDR); XEce_SetVeccount_v(&hlsECE, matchcount); XEce_SetResultvectoraddr_v(&hlsECE, FEATURE_X2_BASEADDR); XEce_SetErrthres_v(&hlsECE, 2); if (!eeeflag) { model_param_32_tmp[0] = (int) (model_param_est[0] * 8); model_param_32_tmp[1] = (int) (model_param_est[1] * 8); model_param_32_tmp[2] = (int) (model_param_est[2] * 2147483648); model_param_32_tmp[3] = (int) (model_param_est[3] * 2147483648); } else { model_param_32_tmp[0] = model_param_32[4 * bmid]; model_param_32_tmp[1] = model_param_32[4 * bmid + 1]; model_param_32_tmp[2] = model_param_32[4 * bmid + 2]; model_param_32_tmp[3] = model_param_32[4 * bmid + 3]; } Xil_Out32(BEST_MODEL, model_param_32_tmp[0]); Xil_Out32(BEST_MODEL + 4, model_param_32_tmp[1]); Xil_Out32(BEST_MODEL + 8, model_param_32_tmp[2]); Xil_Out32(BEST_MODEL + 12, model_param_32_tmp[3]); Xil_DCacheFlush(); XEce_SetBestmodeladdr_v(&hlsECE, BEST_MODEL); init_perfcounters(1, 0); EnablePerfCounters(); count = get_cyclecount(); ECE_start(); while (ECEisdone == 0) ; ECEisdone = 0; count = get_cyclecount() - count; matchcount2 = XEce_GetReturn(&hlsECE); printf("HW ECE consuming time: %f ms\n", ((float) count) / CPUFREQ * 1000); printf("Rest vector numbers: %d \n", matchcount2); if (!Camflag) { ConvGray8ToGray32(640, 480, GET_INPUT_ADDR(fnum+1), OUTPUT_BASEADDR); } else { CameraCopy(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], BUF_CAM, OUTPUT_BASEADDR); } DrawVector32hw(640, 480, FEATURE_X2_BASEADDR, matchcount2, OUTPUT_BASEADDR, 0); Xil_DCacheFlush(); ecehwcount++; ecehwsum += count; } } else { printf("Because of EEE failure, no compensation done!!\n"); if (!Camflag) { ConvGray8ToGray32(640, 480, GET_INPUT_ADDR(fnum+1), OUTPUT_BASEADDR); } else { CameraCopy(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], BUF_CAM, OUTPUT_BASEADDR); } DrawVector32hw(640, 480, FEATURE_X1_BASEADDR, matchcount, OUTPUT_BASEADDR, 0); Xil_DCacheFlush(); } } if (!Camflag) { ConfigHdmiVDMA(detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], OUTPUT_BASEADDR); if (ATV_GetElapsedMs(StartCount, NULL) >= HDMI_CALL_INTERVAL_MS) { StartCount = HAL_GetCurrentMsCount(); if (APP_DriverEnabled()) { ADIAPI_TransmitterMain(); } } } else { if (camceflag) { ConfigHdmiVDMA(detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], CE_OUTPUT_1_BASEADDR); } else if (cammeflag) { CameraCopy(640, 480, detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], BUF_CAM, OUTPUT_ME_BASEADDR); DrawVector32hw(640, 480, FEATURE_X1_BASEADDR, matchcount, OUTPUT_ME_BASEADDR, 0); Xil_DCacheFlush(); ConfigHdmiVDMA(detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], OUTPUT_ME_BASEADDR); } else { ConfigHdmiVDMA(detailedTiming[currentResolution][H_ACTIVE_TIME], detailedTiming[currentResolution][V_ACTIVE_TIME], OUTPUT_BASEADDR); } if (ATV_GetElapsedMs(StartCount, NULL) >= HDMI_CALL_INTERVAL_MS) { StartCount = HAL_GetCurrentMsCount(); if (APP_DriverEnabled()) { ADIAPI_TransmitterMain(); } } } }