/* ----------------------------------------------------------------------- FUNCTION : C_ite_dbg_VerifyFlashTriggered_cmd PURPOSE : Function to check flash is triggred or not ------------------------------------------------------------------------ */ CMD_COMPLETION C_ite_dbg_VerifyFlashTriggered_cmd( int a_nb_args, char **ap_args) { char mess[256]; RESULT_te result = SUCCESS; UNUSED(ap_args); sprintf(mess, "Testing for VerifyFlashTriggered"); MMTE_TEST_NEXT(mess); if (Flag_e_FALSE == Is_Flash_Supported()) { MMTE_TEST_SKIPPED(); return (CMD_COMPLETE); } if (a_nb_args == 1) { result |= (Verify_Params_Absorbed(Flag_e_FALSE, Flag_e_TRUE)); } if (SUCCESS == result) { MMTE_TEST_PASSED(); } else { MMTE_TEST_FAILED(); } Send_System_Params(Flag_e_FALSE, Flag_e_FALSE); //cleanup return (CMD_COMPLETE); }
/* ----------------------------------------------------------------------- FUNCTION : C_ite_dbg_FlashHelp_cmd PURPOSE : Displays Flash Test options for the user. ------------------------------------------------------------------------ */ CMD_COMPLETION C_ite_dbg_FlashHelp_cmd( int a_nb_args, char **ap_args) { char mess[256]; UNUSED(a_nb_args); UNUSED(ap_args); MMTE_TEST_START("FlashHelp", "/ite_nmf/test_results_nreg/flash_tests", "Testing for Flash_help"); sprintf(mess, "Testing for Flash_help"); MMTE_TEST_NEXT(mess); CLI_disp_msg("\n"); CLI_disp_msg("TestFlashSupport: Checks whether Flash is suppported by the firmware \n"); CLI_disp_msg("TestFlashSupport[Syntax]: TestFlashSupport \n\n"); CLI_disp_msg("FlashSanityTest: Performs Flash sanity test with default parameters \n"); CLI_disp_msg("FlashSanityTest[Syntax]: FlashSanityTest \n\n"); CLI_disp_msg("ConfigureFlash: Configures the Flash with user given arguments\n"); CLI_disp_msg("If 1st parameter is <wait>, verifies also for flash trigger. \n"); CLI_disp_msg( "ConfigureFlash[Syntax]: ConfigureFlash [<wait>|<nowait>] s32_DelayFromStartPoint u32_StrobeLength_us u8_FrameCount u8_MaximumNumberOfFrames e_StrobeStartPoint_Frame\n\n"); CLI_disp_msg("ConfigureFlash[Example]: ConfigureFlash wait -30 500 1 10 0\n\n"); CLI_disp_msg("VerifyFlashTriggered: Verifes whether flash triggered. \n"); CLI_disp_msg("VerifyFlashTriggered[Syntax]: VerifyFlashTriggered \n\n"); MMTE_TEST_SKIPPED(); return (CMD_COMPLETE); }
/* ----------------------------------------------------------------------- FUNCTION : C_ite_dbg_focusstatreadytest_cmd PURPOSE : ------------------------------------------------------------------------ */ CMD_COMPLETION C_ite_dbg_focusstatreadytest_cmd( int a_nb_args, char **ap_args) { Result_te result = Result_e_Success; char mess[256]; MMTE_TEST_START("focusstatreadytest","/ite_nmf/test_results_nreg/focus_tests","Testing for focusstatreadytest"); snprintf(mess,sizeof(mess),"focusstatreadytest"); MMTE_TEST_NEXT("focusstatreadytest"); if (a_nb_args > 2) { if (0 == strcmp(ap_args[1], "help")) { CLI_disp_error("syntax: fstattest <filename>\n"); MMTE_TEST_SKIPPED(); } } else { if (a_nb_args == 2) { ITE_NMF_FocusStatsPrepare(); result = AFSTatsReadyTest(ap_args[1], (t_uint32) (pFocusStatsBuffer->ISPBufferBaseAddress), (t_uint32) (pFocusStatsBuffer->logAddress)); if(result == Result_e_Success) { MMTE_TEST_PASSED(); } else { MMTE_TEST_FAILED(); } } else { CLI_disp_error("Not correct command arguments\n"); MMTE_TEST_SKIPPED(); } } return (CMD_COMPLETE); }
/* ----------------------------------------------------------------------- FUNCTION : C_ite_dbg_TestFlashSupport_cmd PURPOSE : Function to check the flash is supported or not ------------------------------------------------------------------------ */ CMD_COMPLETION C_ite_dbg_TestFlashSupport_cmd( int a_nb_args, char **ap_args) { char mess[256]; UNUSED(ap_args); MMTE_TEST_START("TestFlashSupport", "/ite_nmf/test_results_nreg/flash_tests", "Testing for Flash_SUPPORT"); sprintf(mess, "Testing for Flash_SUPPORT"); MMTE_TEST_NEXT(mess); if (a_nb_args != 1) { CLI_disp_error("TestFlashSupport: Checks whether Flash is suppported by the firmware \n"); CLI_disp_error("TestFlashSupport[Command]: TestFlashSupport \n\n"); CLI_disp_error("Not correct command arguments\n"); MMTE_TEST_SKIPPED(); return (CMD_ERR_ARGS); } if (Flag_e_FALSE == Is_Flash_Supported()) { snprintf(mess, sizeof(mess), "Flash NOT Supported by the device! \n"); MMTE_TEST_COMMENT(mess); MMTE_TEST_SKIPPED(); } else { snprintf(mess, sizeof(mess), "Flash Supported by the device! \n"); MMTE_TEST_COMMENT(mess); MMTE_TEST_PASSED(); } return (CMD_COMPLETE); }
/* ----------------------------------------------------------------------- FUNCTION : C_ite_dbg_ConfigureFlash_cmd PURPOSE : Function to configure user given flash parameters ------------------------------------------------------------------------ */ CMD_COMPLETION C_ite_dbg_ConfigureFlash_cmd( int a_nb_args, char **ap_args) { t_uint32 s32_DelayFromStartPoint, u32_StrobeLength_us, u8_FrameCount, u8_MaximumNumberOfFrames, e_StrobeStartPoint_Frame; char mess[256], fname[256], pathname[256]; RESULT_te result = SUCCESS; sprintf(fname, "ConfigureFlash_"); sprintf(mess, "%s_%s_%s_%s_%s_%s", ap_args[1],ap_args[2],ap_args[3],ap_args[4],ap_args[5],ap_args[6]); strcat(fname, mess); memset(g_out_path,0,KlogDirectoryLentgh*sizeof(char)); sprintf(pathname,"/ite_nmf/test_results_nreg/flash_tests"); MMTE_TEST_START(fname, pathname,"Testing for Flash_configure"); if (a_nb_args == 7) { if (Flag_e_FALSE == Is_Flash_Supported()) { MMTE_TEST_SKIPPED(); return (CMD_COMPLETE); } sprintf(mess, "Testing for Flash_configure"); MMTE_TEST_NEXT(mess); s32_DelayFromStartPoint = ITE_ConvToInt32(ap_args[2]); u32_StrobeLength_us = ITE_ConvToInt32(ap_args[3]); u8_FrameCount = ITE_ConvToInt32(ap_args[4]); u8_MaximumNumberOfFrames = ITE_ConvToInt32(ap_args[5]); e_StrobeStartPoint_Frame = ITE_ConvToInt32(ap_args[6]); Configure_Flash( s32_DelayFromStartPoint, u32_StrobeLength_us, u8_FrameCount, u8_MaximumNumberOfFrames, e_StrobeStartPoint_Frame); Send_System_Params(Flag_e_TRUE, Flag_e_TRUE); if (0 == strcmp(ap_args[1], "wait")) { result |= (Verify_Params_Absorbed(Flag_e_TRUE, Flag_e_TRUE)); } } else { CLI_disp_error("Not correct command arguments\n"); CLI_disp_error("ConfigureFlash: Configures the Flash with user given arguments\n"); CLI_disp_error( "ConfigureFlash[Syntax]: ConfigureFlash [<wait>|<nowait>] s32_DelayFromStartPoint u32_StrobeLength_us u8_FrameCount u8_MaximumNumberOfFrames e_StrobeStartPoint_Frame\n\n"); CLI_disp_error("ConfigureFlash[Example]: ConfigureFlash wait -30 500 1 10 0\n\n"); MMTE_TEST_SKIPPED(); return (CMD_ERR_ARGS); } if (SUCCESS == result) { MMTE_RESULT_PASSED(); } else { MMTE_RESULT_FAILED(); } if (0 == strcmp(ap_args[1], "wait")) { MMTE_TEST_END(); Send_System_Params(Flag_e_FALSE, Flag_e_FALSE); //cleanup } return (CMD_COMPLETE); }
/* ----------------------------------------------------------------------- FUNCTION : C_ite_dbg_FlashSanityTest_cmd PURPOSE : Function to Test default Flash support ------------------------------------------------------------------------ */ CMD_COMPLETION C_ite_dbg_FlashSanityTest_cmd( int a_nb_args, char **ap_args) { t_uint32 dataPathSelCount = 0, streamStatus = 0, configCount = 0, iLoop = 0, testCount = 0; int ret =EOK; char mess[256]; RESULT_te result = SUCCESS; Flag_te flashMode; UNUSED(ap_args); MMTE_TEST_START("TestFlashSanity", "/ite_nmf/test_results_nreg/flash_tests", "Test Flash_sanity"); if (a_nb_args != 1) { CLI_disp_error("FlashSanityTest: Performs Flash sanity test with default parameters \n"); CLI_disp_error("FlashSanityTest[Syntax]: FlashSanityTest \n\n"); MMTE_TEST_SKIPPED(); return (CMD_ERR_ARGS); } if (Flag_e_FALSE == Is_Flash_Supported()) { MMTE_TEST_SKIPPED(); goto END; } ret = Init_UseCase(); if(ret != EOK) { CLI_disp_error("Not correct command arguments C_ite_dbg_FlashSanityTest_cmd\n"); goto END; } //Loop - 0 : For various flash configurations for (configCount = 0; configCount < NO_OF_FLASH_CONFIGURATIONS; configCount++) { //Loop - 1: For LR(0) HR(1) BMS(2) LRHR(3) LRBMS(4) HRBMS(5) LRHRBMS(6) datapaths //[TBD] Currently looping from 0 through 3 only, //as (4),(5) and (6) are not supported by the Ite_Nmf APIs for (dataPathSelCount = 0; dataPathSelCount <= 3; dataPathSelCount++) { //Inner Loop - 2 : For Toggling Flashmode for (iLoop = 0; iLoop <= 1; iLoop++) { //Inner Loop - 3 : For STOP(0) and RUN(1) States for (streamStatus = 0; streamStatus <= 1; streamStatus++) { snprintf(mess, sizeof(mess), "[Test %ld] Next iteration for flash sanity test\n", ++testCount); MMTE_TEST_NEXT(mess); flashMode = (Flag_te)iLoop; snprintf(mess, sizeof(mess), "[Usecase] Datapath=%ld Flashmode=%d FW_state_during_Flash_Configuration=%ld\n", dataPathSelCount, flashMode, streamStatus); MMTE_TEST_COMMENT(mess); //reset result result = SUCCESS; if (((0 == dataPathSelCount) || (4 == dataPathSelCount)) && (1 == streamStatus)) { LOS_Log("Starting LR \n"); ITE_LR_Prepare(&usecase, INFINITY); ITE_LR_Start(INFINITY); MMTE_TEST_COMMENT("LR STARTED \n"); } if (((1 == dataPathSelCount) || (5 == dataPathSelCount)) && (1 == streamStatus)) { LOS_Log("Starting HR \n"); ITE_HR_Prepare(&usecase, INFINITY); ITE_HR_Start(INFINITY); MMTE_TEST_COMMENT("HR STARTED \n"); } if (((3 == dataPathSelCount) || (6 == dataPathSelCount)) && (1 == streamStatus)) { LOS_Log("Starting LRHR \n"); ITE_LRHR_Prepare(&usecase, INFINITY); ITE_LRHR_Start(INFINITY); MMTE_TEST_COMMENT("LRHR STARTED \n"); } if ( ( (2 == dataPathSelCount) || (4 == dataPathSelCount) || (5 == dataPathSelCount) || (6 == dataPathSelCount) ) && (1 == streamStatus) ) { LOS_Log("Starting BMS \n"); ITE_BMS_Prepare(&usecase, INFINITY); ITE_BMS_Start(1); MMTE_TEST_COMMENT("BMS STARTED \n"); } //workaround for CSI2 or GRAB errors LOS_Sleep(50); //Configure Exposure params, to check simulataneous exposure + flash use case if (testCount % 2 == 0) { //set some random values ConfigureSystemConfigParams(((testCount + configCount + 1) * 1000), ((configCount + 1) * 512)); } //Configure Flash Configure_Flash( (configCount + 1) * 10, (configCount + 1) * 100, 1, 10 - configCount, configCount % 2); //Toggle Coin if (1 == streamStatus) { Send_System_Params(Flag_e_TRUE, flashMode); } if (((0 == dataPathSelCount) || (4 == dataPathSelCount)) && (0 == streamStatus)) { Send_System_Params(Flag_e_TRUE, flashMode); LOS_Log("Starting LR \n"); ITE_LR_Prepare(&usecase, INFINITY); ITE_LR_Start(INFINITY); MMTE_TEST_COMMENT("LR STARTED \n"); } if (((1 == dataPathSelCount) || (5 == dataPathSelCount)) && (0 == streamStatus)) { Send_System_Params(Flag_e_TRUE, flashMode); LOS_Log("Starting HR \n"); ITE_HR_Prepare(&usecase, INFINITY); ITE_HR_Start(INFINITY); MMTE_TEST_COMMENT("HR STARTED \n"); } if (((3 == dataPathSelCount) || (6 == dataPathSelCount)) && (0 == streamStatus)) { Send_System_Params(Flag_e_TRUE, flashMode); LOS_Log("Starting LRHR \n"); ITE_LRHR_Prepare(&usecase, INFINITY); ITE_LRHR_Start(INFINITY); MMTE_TEST_COMMENT("LRHR STARTED \n"); } if ( ( (2 == dataPathSelCount) || (4 == dataPathSelCount) || (5 == dataPathSelCount) || (6 == dataPathSelCount) ) && (0 == streamStatus) ) { //ite_bms_start will implicitly toggle system coin Send_System_Params(Flag_e_TRUE, flashMode); LOS_Log("Starting BMS \n"); ITE_BMS_Prepare(&usecase, INFINITY); ITE_BMS_Start_Extention(1,"nowait","toggle"); //ITE_BMS_Start(1); MMTE_TEST_COMMENT("BMS STARTED \n"); } //workaround for CSI2 or GRAB errors LOS_Sleep(50); if (SUCCESS == result) { result |= (Verify_Params_Absorbed(streamStatus, flashMode)); } if ((0 == dataPathSelCount) || (4 == dataPathSelCount)) { ITE_LR_Stop(); ITE_LR_Free(); LOS_Log("LR STOPPED\n\n"); } if ((1 == dataPathSelCount) || (5 == dataPathSelCount)) { ITE_HR_Stop(); ITE_HR_Free(); LOS_Log("HR STOPPED\n\n"); } if ((3 == dataPathSelCount) || (6 == dataPathSelCount)) { ITE_LRHR_Stop(); ITE_LRHR_Free(); LOS_Log("LRHR STOPPED\n\n"); } if ( (2 == dataPathSelCount) || (4 == dataPathSelCount) || (5 == dataPathSelCount) || (6 == dataPathSelCount) ) { ITE_BMS_Stop(); ITE_BMS_Free(); LOS_Log("BMS STOPPED\n\n"); } //delay must here, for stop latency LOS_Sleep(50); if (SUCCESS == result) { MMTE_RESULT_PASSED(); } else { MMTE_RESULT_FAILED(); } } } } } MMTE_TEST_END(); Send_System_Params(Flag_e_FALSE, Flag_e_FALSE); //cleanup END: return (CMD_COMPLETE); }
/* ----------------------------------------------------------------------- FUNCTION : FlashTest_FlashDriver. PURPOSE : This function will test flash functionality with flash driver enabled and then check whether flash has been lit or not by analyzing the histogram stats. ------------------------------------------------------------------------ */ CMD_COMPLETION C_ite_dbg_Flash_TestLitFrame_cmd( int a_nb_args, char **ap_args) { t_uint16 i = 0; float f_meanRed = 0.0, f_meanBlue = 0.0, f_meanGreen = 0.0; float f_PreGreanMean = 0.0, f_PostGreanMean = 0.0; RESULT_te result = SUCCESS; volatile StatsBuffersStorage_t *pStore; char datapath[5]; MMTE_TEST_START("Flash_TestLitFrame", "/ite_nmf/test_results_nreg/flash_tests", "Flash_TestLitFrame"); if (a_nb_args != 2) { CLI_disp_error("Flash_TestLitFrame: Performs Flash test to check lit frame \n"); CLI_disp_error("Flash_TestLitFrame[Syntax]: Flash_TestLitFrame <LR/HR/LRHR/BMS> \n\n"); MMTE_TEST_SKIPPED(); return (CMD_ERR_ARGS); } if (Flag_e_FALSE == Is_Flash_Supported()) { MMTE_TEST_SKIPPED(); return (CMD_COMPLETE); } strcpy(datapath, ap_args[1]); //prepare the selected datapath if (0 == strcmp(datapath,"LR")) { ITE_LR_Prepare(&usecase, INFINITY); } else if (0 == strcmp(datapath,"HR")) { ITE_HR_Prepare(&usecase, INFINITY); } else if (0 == strcmp(datapath,"BMS")) { ITE_BMS_Prepare(&usecase, INFINITY); } else //LRHR { ITE_LRHR_Prepare(&usecase, INFINITY); } //1. Pass //Set the zoom factor as x1 ITE_writePE(Zoom_Control_f_SetFOVX_Byte0, 0); //Set the frame rate = 30dps ITE_SetFrameRateControl(30, 30); //Program the Glace/Histogram blocks ITE_NMF_SetGlaceBlockFraction(100, 100, 0, 0); ITE_NMF_SetHistoBlockFraction(100, 100, 0, 0); ITE_NMF_SetGlaceGrid(72, 54); ITE_NMF_SetGlaceSatLevel(255, 255, 255); pStore = g_pStatsBufferStorage; ITE_NMF_UpdateGlaceParam(); ITE_NMF_UpdateHistoParam(); //set stats request (witout flash) before streaming ITE_NMF_GlaceAndHistoReqNoWait(); ITE_NMF_GlaceAndHistoExpReqNoWait(); //Start streamind the datapath if (0 == strcmp(datapath,"LR")) { ITE_LR_Start( INFINITY); } else if (0 == strcmp(datapath,"HR")) { ITE_HR_Start( INFINITY); } else if (0 == strcmp(datapath,"BMS")) { ITE_BMS_Start( INFINITY); } else //LRHR { ITE_LRHR_Start( INFINITY); } ITE_NMF_WaitStatReady(ISP_GLACE_STATS_READY); //Glace and Histo gram stats recvd without flash //Calculate the mean energy from R component for(i = 0; i < 256; i++) { f_meanRed += *((pStore->apHistR) + i) / (256 - i ); f_meanBlue += *((pStore->apHistB) + i) / (256 - i ); f_meanGreen += *((pStore->apHistG) + i) / (256 - i ) ; } f_PreGreanMean = f_meanGreen; LOS_Log("\n Histogram mean energy .. \n"); LOS_Log("\n Red mean energy - %f \n",f_meanRed); LOS_Log("\n Blue mean energy - %f \n",f_meanBlue); LOS_Log("\n Green mean energy - %f \n",f_meanGreen); //2nd Pass. //Request for stats with flash this time f_meanRed = 0.0; f_meanBlue = 0.0; f_meanGreen = 0.0; memset(g_pStatsBufferStorage->apHistG, 0, 256 * 4); if (0 == strcmp(datapath,"LR")) { ITE_LR_Stop(); } else if (0 == strcmp(datapath,"HR")) { ITE_HR_Stop(); } else if (0 == strcmp(datapath,"BMS")) { ITE_BMS_Stop(); } else //LRHR { ITE_LRHR_Stop(); } // Fire flash and and re-calculate the energy ITE_NMF_GlaceAndHistoReqNoWait(); Send_System_Params(Flag_e_TRUE, Flag_e_TRUE); if (0 == strcmp(datapath,"LR")) { ITE_LR_Start( INFINITY); } else if (0 == strcmp(datapath,"HR")) { ITE_HR_Start( INFINITY); } else if (0 == strcmp(datapath,"BMS")) { ITE_BMS_Start( INFINITY); } else //LRHR { ITE_LRHR_Start( INFINITY); } ITE_NMF_WaitStatReady(ISP_GLACE_STATS_READY); //Glace and Histo gram stats recvd with flash //Calculate the mean energy from R component for(i = 0; i < 256; i++) { f_meanRed += *((pStore->apHistR) + i) / (256 - i ); f_meanBlue += *((pStore->apHistB) + i) / (256 - i ); f_meanGreen += *((pStore->apHistG) + i) / (256 - i ) ; } f_PostGreanMean = f_meanGreen; LOS_Log("\n Histogram mean energy .. \n"); LOS_Log("\n Red mean energy - %f \n",f_meanRed); LOS_Log("\n Blue mean energy - %f \n",f_meanBlue); LOS_Log("\n Green mean energy - %f \n",f_meanGreen); f_meanRed = 0.0; f_meanBlue = 0.0; f_meanGreen = 0.0; if((result == SUCCESS) && (f_PostGreanMean >= f_PreGreanMean)) { MMTE_RESULT_PASSED(); } else { MMTE_RESULT_FAILED(); } //Stop/clear the test if (0 == strcmp(datapath,"LR")) { ITE_LR_Stop(); ITE_LR_Free(); } else if (0 == strcmp(datapath,"HR")) { ITE_HR_Stop(); ITE_HR_Free(); } else if (0 == strcmp(datapath,"BMS")) { ITE_BMS_Stop(); ITE_BMS_Free(); } else //LRHR { ITE_LRHR_Stop(); ITE_LRHR_Free(); } MMTE_TEST_END(); Send_System_Params(Flag_e_FALSE, Flag_e_FALSE); //cleanup return (CMD_COMPLETE); }