static void
Enable_Adsoc_Radial_Peaking(
t_uint32    pipe_no,
t_bool      enableBit)
{
    LOS_Log("\n>> Enable_Adsoc_Radial_Peaking : pipe number = %d, enableBit = %d\n", pipe_no, enableBit);
    if (0 == pipe_no)
    {
        ITE_writePE(Adsoc_RP_Ctrl_0_e_Flag_Adsoc_RP_Enable_Byte0, enableBit);
    }


    if (1 == pipe_no)
    {
        ITE_writePE(Adsoc_RP_Ctrl_1_e_Flag_Adsoc_RP_Enable_Byte0, enableBit);
    }


    if (HostInterfaceHighLevelState_e_RUNNING == ITE_readPE(HostInterface_Status_e_HostInterfaceHighLevelState_Byte0))
    {
        ITE_NMF_GlaceHistoExpStatsRequestAndWait();
    }


    LOS_Log("<<Enable_Adsoc_Radial_Peaking\n");
}
/* -----------------------------------------------------------------------
FUNCTION :  Send_System_Params
PURPOSE  :  Function to set flash mode and then toggle system coin
------------------------------------------------------------------------ */
static void
Send_System_Params (
Flag_te toggleCoin, 
Flag_te enableFlash)
{
    Coin_te control_coin,
            status_coin;

    //1. Write Flashmode
    ITE_writePE(FlashControl_e_Flag_FlashMode_Byte0, (t_uint32) enableFlash);

    //2. Toggle System Coin
    control_coin = (Coin_te) ITE_readPE(SystemSetup_e_Coin_Ctrl_Byte0);
    status_coin = (Coin_te) ITE_readPE(SystemConfig_Status_e_Coin_Status_Byte0);

    if (control_coin == status_coin)
    {
        if (Flag_e_TRUE == toggleCoin)
        {
            LOS_Log("\nToggling Coin..\n");
            ITE_writePE(SystemSetup_e_Coin_Ctrl_Byte0, !control_coin);
        }
    }
    else
    {
        LOS_Log("\nWarning:coins in unexpected state. Could be because ite_bms_start() got called.\n");
    }
    
    
    ITE_RefreshEventCount(Event0_Count_u16_EVENT0_19_EXPOSURE_AND_WB_PARAMETERS_UDPATE_Byte0);
    ITE_RefreshEventCount(Event0_Count_u16_EVENT0_17_GLACE_STATS_READY_Byte0);
    ITE_RefreshEventCount(Event3_Count_u16_EVENT3_0_DMA_GRAB_OK_Byte0);
}
/* -----------------------------------------------------------------------
   FUNCTION : ITE_HRDatapath
   PURPOSE  : Put sensor in color bar test mode, stream on HR pipe and check ouput frame automaticaly
   ------------------------------------------------------------------------ */
void
ITE_HRDatapath(
char    *ap_test_id,
char    *ap_grabvpip_options)
{
    //char out_filename[64];
    //t_uint16 framerate=30;
    //t_uint8 error=TRUE;
    //disable log pageelement
    //MMITE_Log_RW_pageelements_disable();
    ITE_Log_RW_pageelements_enable();

    ITE_Log_Event_enable();

    /* HCL Services, alloc, Log, IT, xti ....*/
    // ITE_SKEInit();
    // start
    mmte_testStart("test_HR_datapath", " test pipe HR with sensor in test mode", g_out_path);

    ITE_InitUseCase(ap_test_id, ap_grabvpip_options, &usecase);

    ITE_Start_Env(&usecase, ap_grabvpip_options, 0, 0);

    if (g_InputImageSource == InputImageSource_e_Sensor0)
    {
        ITE_SensorMode(COLORBAR);
    }
    else
    {
        ITE_SetRxTestPattern(RxTestPattern_e_ColourBars);
    }


    ITE_HR_Prepare(&usecase, INFINITY);
    ITE_HR_Start(INFINITY);

    LOS_Log("\n2secs stream on HR pipe\n");
    LOS_Sleep(2000);

    ITE_HR_Stop();

    mmte_testNext("check if colorbar detected in HR buffer");
    if (TestColorBarbuffer(&(GrabBufferHR[0]), COLOR_BAR__DEFAULT_TESTING_POSITION) == 0)
    {
        LOS_Log("\nColor bar successfully detected on GrabBufferHR[0] buffer\n");
        mmte_testResult(TEST_PASSED);
    }
    else
    {
        LOS_Log("\nTEST FAIL: Color bar not properly detected on GrabBufferHR[0] buffer\n");
        mmte_testResult(TEST_FAILED);
    }


    ITE_HR_Free();

    ITE_Stop_Env();

    mmte_testEnd();
}
static void
Enable_Adsoc(
t_uint32    pipe_no,
t_bool      enableBit)
{
    LOS_Log("\n>> Enable_Adsoc : pipe number = %d, enableBit = %d\n", pipe_no, enableBit);
    if (0 == pipe_no)
    {
        ITE_writePE(Adsoc_PK_Ctrl_0_e_Flag_Adsoc_PK_Enable_Byte0, enableBit);
    }
    else if (1 == pipe_no)
    {
        ITE_writePE(Adsoc_PK_Ctrl_1_e_Flag_Adsoc_PK_Enable_Byte0, enableBit);
    }
    else
    {
        // HandleInvalidPipe(pipe_no);
    }


    if (HostInterfaceHighLevelState_e_RUNNING == ITE_readPE(HostInterface_Status_e_HostInterfaceHighLevelState_Byte0))
    {
        ITE_NMF_GlaceHistoExpStatsRequestAndWait();
    }


    LOS_Log("\n<< Enable_Adsoc");
}
t_uint32 TestForcedGrabMode_NOK()
{
    
    t_uint32 u32_Grab_Abort_Count_End = 0;
    t_uint32 u32_GrabOK_Count_End = 0;
    t_uint32 u32_Grab_NOK_Count_End = 0;    
    t_sint32 s32_error = 0;
    
    LOS_Log("\n>> TestForcedGrabMode_NOK \n");

    // set end counter for GRABOK done thus far
    u32_GrabOK_Count_End = ITE_readPE(Event3_Count_u16_EVENT3_0_DMA_GRAB_OK_Byte0); 

    // set end counter for GRAB NOK done thus far
    u32_Grab_NOK_Count_End = ITE_readPE(Event3_Count_u16_EVENT3_0_DMA_GRAB_NOK_Byte0);      

    // set end counter for total no. of bms aborts done so far
    u32_Grab_Abort_Count_End = ITE_readPE(Event3_Count_u16_EVENT3_2_DMA_GRAB_Abort_Byte0);         

    LOS_Log("u32_GrabOK_Count_End = %u, u32_Grab_NOK_Count_End = %u, u32_Grab_Abort_Count_End = %u\n", u32_GrabOK_Count_End, u32_Grab_NOK_Count_End, u32_Grab_Abort_Count_End);

    if((u32_Grab_NOK_Count_End > g_u32_Grab_NOK_Count_Begin) && (u32_GrabOK_Count_End == g_u32_GrabOK_Count_Begin) && (u32_Grab_Abort_Count_End == g_u32_Grab_Abort_Count_Begin))
    {
        LOS_Log("ForcedGrabMode_NOK test is successfull\n");
    }
    else
    {
        LOS_Log("ForcedGrabMode_NOK test is failed\n");
        s32_error = -1;
    }
        
    LOS_Log("<< TestForcedGrabMode_NOK \n");
    return s32_error;
}
/* -----------------------------------------------------------------------
   FUNCTION : C_ite_dbg_PrintGridIron_cmd
   PURPOSE  :
   ------------------------------------------------------------------------ */
CMD_COMPLETION
C_ite_dbg_PrintGridIron_cmd(
int     a_nb_args,
char    **ap_args)
{
    char    mess[256];

    MMTE_TEST_START("PrintGridIron", "/ite_nmf/test_results_nreg/GridIron_tests", "Test PrintGridIronStatus");

    sprintf(mess, "Testing for GridIron");
    mmte_testNext(mess);

    LOS_Log("********************* PRINT GRIDIRON STATUS PAGE **********************\n");
    if (a_nb_args > 1)
    {
        if (0 == strcmp(ap_args[1], "help"))
        {
            CLI_disp_error("Syntax: PrintGridIron , Tests GridIron interface provided by ISP FW \n");
        }
    }
    else
    {
        if (a_nb_args == 1)
        {
            Print_Gridiron_Parameters();
            LOS_Log("GridIron Status Page Printing done\n");
        }
    }


    LOS_Log("**************** PRINT GRIDIRON STATUS PAGE COMPLETE *****************\n");
    MMTE_TEST_PASSED();
    return (0);
}
static void
Configure_Adsoc_Peaking(
t_uint32    pipe_no)
{
    LOS_Log("\n>> Configure_Adsoc_Peaking : pipe number = %d\n", pipe_no);
    if (0 == pipe_no)
    {
        ITE_writePE(Adsoc_PK_Ctrl_0_e_Flag_Adsoc_PK_AdaptiveSharpening_Enable_Byte0, g_u32_PK_Sharpening_Enable);
        ITE_writePE(Adsoc_PK_Ctrl_0_u8_Adsoc_PK_Coring_Level_Byte0, g_u32_PK_Coring_Level);
        ITE_writePE(Adsoc_PK_Ctrl_0_u8_Adsoc_PK_OverShoot_Gain_Bright_Byte0, g_u32_PK_OverShoot_Gain_Bright);
        ITE_writePE(Adsoc_PK_Ctrl_0_u8_Adsoc_PK_OverShoot_Gain_Dark_Byte0, g_u32_PK_OverShoot_Gain_Dark);
        ITE_writePE(Adsoc_PK_Ctrl_0_u8_Adsoc_PK_Emboss_Effect_Ctrl_Byte0, g_u32_PK_Emboss_Effect_Ctrl);
        ITE_writePE(Adsoc_PK_Ctrl_0_u8_Adsoc_PK_Flipper_Ctrl_Byte0, g_u32_PK_Flipper_Ctrl);
        ITE_writePE(Adsoc_PK_Ctrl_0_u8_Adsoc_PK_GrayBack_Ctrl_Byte0, g_u32_PK_GrayBack_Ctrl);
        ITE_writePE(Adsoc_PK_Ctrl_0_u8_Adsoc_PK_Gain_Byte0, g_u32_PK_Gain);
    }
    else if (1 == pipe_no)
    {
        ITE_writePE(Adsoc_PK_Ctrl_1_e_Flag_Adsoc_PK_AdaptiveSharpening_Enable_Byte0, g_u32_PK_Sharpening_Enable);
        ITE_writePE(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Coring_Level_Byte0, g_u32_PK_Coring_Level);
        ITE_writePE(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_OverShoot_Gain_Bright_Byte0, g_u32_PK_OverShoot_Gain_Bright);
        ITE_writePE(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_OverShoot_Gain_Dark_Byte0, g_u32_PK_OverShoot_Gain_Dark);
        ITE_writePE(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Emboss_Effect_Ctrl_Byte0, g_u32_PK_Emboss_Effect_Ctrl);
        ITE_writePE(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Flipper_Ctrl_Byte0, g_u32_PK_Flipper_Ctrl);
        ITE_writePE(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_GrayBack_Ctrl_Byte0, g_u32_PK_GrayBack_Ctrl);
        ITE_writePE(Adsoc_PK_Ctrl_1_u8_Adsoc_PK_Gain_Byte0, g_u32_PK_Gain);
    }
    else
    {
        // HandleInvalidPipe(pipe_no);
    }


    LOS_Log("<< Configure_Adsoc_Peaking\n");
}
/* -----------------------------------------------------------------------
   FUNCTION : ITE_LRDatapath
   PURPOSE  : Put sensor in color bar test mode, stream on LR pipe and check ouput frame automaticaly
   ------------------------------------------------------------------------ */
void
ITE_LRDatapath(
char    *ap_test_id,
char    *ap_grabvpip_options)
{
    ITE_Log_RW_pageelements_enable();

    ITE_Log_Event_enable();

    mmte_testStart("test_LR_datapath", " test pipe LR with sensor in test mode", g_out_path);

    ITE_InitUseCase(ap_test_id, ap_grabvpip_options, &usecase);

    ITE_Start_Env(&usecase, ap_grabvpip_options, 0, 0);

    //Sensor in test mode

    if (g_InputImageSource == InputImageSource_e_Sensor0)
    {
        ITE_SensorMode(COLORBAR);
    }
    else
    {
        ITE_SetRxTestPattern(RxTestPattern_e_ColourBars);
    }


    ITE_LR_Prepare(&usecase, INFINITY);
    ITE_LR_Start(INFINITY);

    LOS_Log("\n2secs stream on LR pipe\n");
    LOS_Sleep(2000);

    ITE_LR_Stop();

    mmte_testNext("check if colorbar detected in LR buffer");
    if (TestColorBarbuffer(&(GrabBufferLR[0]), COLOR_BAR__DEFAULT_TESTING_POSITION) == 0)
    {
        LOS_Log("\nColor bar successfully detected on GrabBufferLR[0] buffer\n");
        mmte_testResult(TEST_PASSED);
    }
    else
    {
        LOS_Log("\nTEST FAIL: Color bar not properly detected on GrabBufferLR[0] buffer\n");
        mmte_testResult(TEST_FAILED);
    }


    ITE_LR_Free();

    ITE_Stop_Env();

    // end test
    mmte_testEnd();
}
int ITE_NMF_dusterload (char *filename, int hw){
#define DUSTER_SIZE_BYTE (DUSTER_MEM_POSITION_DEFECT_DIMENSION*4)

   t_los_file *fd;
   size_t read;
   size_t size;
   t_los_memory_handle mem_handle;
   t_los_logical_address logicalAddr;
 //  t_los_physical_address physicalAddr;
   int i;
   t_uint32 *duster_table;

   fd = LOS_fopen(filename, "rb");
   if (fd == NULL)
   {
      LOS_Log("unable to open duster file %s\n", (void*)filename, NULL, NULL, NULL, NULL, NULL);
      return 1;
   }

   LOS_fseek(fd, 0, LOS_SEEK_END);
   size = (size_t)LOS_ftell(fd);
   LOS_fseek(fd, 0, LOS_SEEK_SET);
   LOS_Log("duster size is %i bytes\n",  (void*)size, NULL, NULL, NULL, NULL, NULL);
   if (size != DUSTER_SIZE_BYTE){
	  LOS_Log("Size %i bytes instead of 2048\n", (void*)size, NULL, NULL, NULL, NULL, NULL);
          LOS_fclose(fd);
          return 1;
   }

   mem_handle=LOS_Alloc(size, 4, LOS_MAPPING_CREATE_UNCACHED_UNBUFFERED);
   logicalAddr = LOS_GetLogicalAddress(mem_handle) ;
//   physicalAddr = ILOS_GetPhysicalAddress(mem_handle) ;

   read = LOS_fread((void *)logicalAddr, 1, size, fd);
   if (read != size)
    {
          LOS_Log("Read %i bytes instead of %i\n", (void*)read, (void*)size, NULL, NULL, NULL, NULL);
	  LOS_Free(mem_handle);
          LOS_fclose(fd);
          return 1;
   }
   LOS_fclose(fd);

   duster_table= (t_uint32 *)logicalAddr;

   for(i=DUSTER_MEM_POSITION_DEFECT_OFFSET; i<(DUSTER_MEM_POSITION_DEFECT_OFFSET + DUSTER_SIZE_BYTE); i=i+4){ hv_SetReg(t1_to_arm(i),(*duster_table++) );}

   if (hw){
   } else {
   }

   LOS_Free(mem_handle);

   return 0;
}
Result_te
ITE_InitSecondary(void)
{
    OMX_ERRORTYPE   error = OMX_ErrorNone;
#ifndef MMIO_ENABLE_NEW_IF
    error = MMIO_Camera::setSecondaryCameraHWInterface();
    if (error != OMX_ErrorNone)
    {
        LOS_Log("\n MMIO_Camera::setSecondaryCameraHWInterface ERROR %d", error);
        return Result_e_Failure;
    }
#endif

#if (defined(ANDROID) || defined(__ARM_SYMBIAN))
    error = MMIO_Camera::powerSensor(OMX_TRUE);
    if (error != OMX_ErrorNone)
    {
        LOS_Log("MMIO_Camera::powerSensor Error %d", error);
        goto ERR_POWERSENSOR;
    }


    error = MMIO_Camera::setExtClk(OMX_TRUE);
    if (error != OMX_ErrorNone)
    {
        LOS_Log("MMIO_Camera::initSecondary FAILED Secondary Camera %d", error);
        goto ERR_SETCLK;
    }


    return Result_e_Success;

ERR_SETCLK:
    error = MMIO_Camera::powerSensor(OMX_FALSE);
    if (error != OMX_ErrorNone)
    {
        LOS_Log("Can't switch off sensor, error =  %d\n", error);
    }

ERR_POWERSENSOR:
#ifndef MMIO_ENABLE_NEW_IF
    error = MMIO_Camera::releaseSecondaryCameraHWInterface();

    if (error != OMX_ErrorNone)
    {
        LOS_Log("ite_Term:Can't release Secondary Camera HW Interface error %d\n", error);
    }
#endif
    return Result_e_Failure;

#endif

}
static void
Verify_Adsoc_Peaking(
t_uint32    pipe_no)
{
    UNUSED(pipe_no);
    LOS_Log("\n>> Verify_Adsoc_Peaking \n");

    // There is no status page for Adsoc peaking. And ISP FW is not doing any calculation on control PEs of adsoc peaking.
    // Control parameters are directly applied to HW registers.
    // So don't take anything apart from status coin testing.
    LOS_Log("<< Verify_Adsoc_Peaking\n");
}
int ITE_NMF_gammaload (char *filename, char *pipe,int hw){
#define GAMMA_SIZE_BYTE ((CE0_SHARP_MEM_LUT_RED_ELT_DIMENSION+CE0_SHARP_MEM_LUT_GREEN_ELT_DIMENSION+CE0_SHARP_MEM_LUT_BLUE_ELT_DIMENSION)*2)

   t_los_file *fd;
   size_t read;
   size_t size;
   t_los_memory_handle mem_handle;
   t_los_logical_address logicalAddr;
   //t_los_physical_address physicalAddr;
 
   fd = LOS_fopen(filename, "rb");
   if (fd == NULL)
   {
      LOS_Log("unable to open gamma file %s\n", (void*)filename, NULL, NULL, NULL, NULL, NULL);
      return 1;
   }

   LOS_fseek(fd, 0, LOS_SEEK_END);
   size = (size_t)LOS_ftell(fd);
   LOS_fseek(fd, 0, LOS_SEEK_SET);
   LOS_Log("gamma size is %i bytes\n",  (void*)size, NULL, NULL, NULL, NULL, NULL);
   if (size != GAMMA_SIZE_BYTE){
	  LOS_Log("Size %i bytes instead of 768\n", (void*)size, NULL, NULL, NULL, NULL, NULL);
          LOS_fclose(fd);
          return 1;
   }

   mem_handle=LOS_Alloc(size, 4, LOS_MAPPING_CREATE_UNCACHED_UNBUFFERED);
   logicalAddr = LOS_GetLogicalAddress(mem_handle) ;
   //physicalAddr = ILOS_GetPhysicalAddress(mem_handle) ;

   read = LOS_fread((void *)logicalAddr, 1, size, fd);
   if (read != size)
    {
          LOS_Log("Read %i bytes instead of %i\n", (void*)read, (void*)size, NULL, NULL, NULL, NULL);
	  LOS_Free(mem_handle);
          LOS_fclose(fd);
          return 1;
   }
   LOS_fclose(fd);

  
   if (0== strcmp(pipe,"LR"))
    	ITE_NMF_gammacopy1(logicalAddr,hw);
   if (0== strcmp(pipe,"HR"))
      	ITE_NMF_gammacopy0(logicalAddr,hw);

   LOS_Free(mem_handle);

   return 0;
}
void
Configure_Gridiron_StaticPrarams(
t_uint32    pixel_order,
t_uint32    reference_cast_count)
{
    /// Default Value for Cast Position0
    float   f_GridIronCastPosition0 = K_REFERENCE_CAST_0;

    /// Default Value for Cast Position1
    float   f_GridIronCastPosition1 = K_REFERENCE_CAST_1;

    /// Default Value for Cast Position2
    float   f_GridIronCastPosition2 = K_REFERENCE_CAST_2;

    /// Default Value for Cast Position3
    float   f_GridIronCastPosition3 = K_REFERENCE_CAST_3;

    LOS_Log("=====================GRID IRON STATIC CONFIGURAION=====================\n");

    LOS_Log("pixel_order = %d, reference_cast_count = %d\n", pixel_order, reference_cast_count);

    // <Hem> IEEE float conversion result was wrong when rValue of below expression is put in the 2nd argument of the ITE_writePE() being done below.
    // Therefore do casting below
    t_uint32    u32_GridIronCastPosition0 = *(( t_uint32 * ) &f_GridIronCastPosition0);
    t_uint32    u32_GridIronCastPosition1 = *(( t_uint32 * ) &f_GridIronCastPosition1);
    t_uint32    u32_GridIronCastPosition2 = *(( t_uint32 * ) &f_GridIronCastPosition2);
    t_uint32    u32_GridIronCastPosition3 = *(( t_uint32 * ) &f_GridIronCastPosition3);

    // set reference casts
    ITE_writePE(GridironControl_f_CastPosition0_Byte0, u32_GridIronCastPosition0);
    ITE_writePE(GridironControl_f_CastPosition1_Byte0, u32_GridIronCastPosition1);
    ITE_writePE(GridironControl_f_CastPosition2_Byte0, u32_GridIronCastPosition2);
    ITE_writePE(GridironControl_f_CastPosition3_Byte0, u32_GridIronCastPosition3);

    // set active reference cast count to 3
    ITE_writePE(GridironControl_u8_Active_ReferenceCast_Count_Byte0, reference_cast_count);

    // set gridIron grid width and height values
    ITE_writePE(GridironControl_u16_GridWidth_Byte0, 65);
    ITE_writePE(GridironControl_u16_GridHeight_Byte0, 49);

    // set verticle and horizontal flip values
    ITE_writePE(GridironControl_e_Flag_VerFlip_Byte0, VER_FLIP_VALUE);
    ITE_writePE(GridironControl_e_Flag_HorFlip_Byte0, HOR_FLIP_VALUE);

    ITE_writePE(GridironControl_e_PixelOrder_Byte0, pixel_order);

    Enable_Gridiron(Flag_e_TRUE);
    LOS_Log("=====================================================================\n");
}
void dbc_assert(int a, int errorId, const char * file, int line)
{
    if (!(a))
	{
        LOS_Log("assert : file %s, line %d\n", file, line, NULL, NULL, NULL, NULL);
    }
}
Ejemplo n.º 15
0
/* -----------------------------------------------------------------------
   FUNCTION : C_ite_dbg_focuszonesetupinper_cmd
   PURPOSE  :
   ------------------------------------------------------------------------ */
CMD_COMPLETION
C_ite_dbg_focuszonesetupinper_cmd(
int     a_nb_args,
char    **ap_args)
{
    if (a_nb_args > 1)
    {
        if (0 == strcmp(ap_args[1], "help"))
        {
            CLI_disp_error("syntax: fzsetper <>\n");
        }
    }
    else
    {
        if (a_nb_args == 1)
        {
            AFStats_HostZoneSetup();
            LOS_Log("CALLING STATS READY TEST...\n\n");

            //		  ITE_NMF_FocusStatsPrepare();
            //AFSTatsReadyTest(ap_args[1],(t_uint32)(pFocusStatsBuffer->ISPBufferBaseAddress),(t_uint32)(pFocusStatsBuffer->logAddress));
            //LOS_Log("TEST FINISHED: Result Depends on the AFStats Ready Test...\n\n");
        }
        else
        {
            CLI_disp_error("Not correct command arguments\n");
        }
    }


    return (CMD_COMPLETE);
}
void initNMFCallBackServices(void)
{
    t_cm_error err;

	// Start a channel to the CM engine - must be done prior to any CM call
    err = CM_CreateChannel(NMF_CHANNEL_SHARED,&nmfCallBackFifoID);
    if(err != NMF_OK)
    {
        CLI_disp_msg("NMF-DSP(DBG): Failed with error %d\n", err);
    }

#if 0
    /* enable NMF debug mode and disable power management (DSP will never be stopped) */
    err = CM_SetMode(CM_CMD_DBG_MODE, 1);
    if (err != CM_OK) {
       CLI_disp_msg("NMF-DSP(DBG): Failed error %d\n",err);
    }
#endif

    /* Force no trace */
    CM_SetMode(CM_CMD_TRACE_LEVEL, 0);


    LOS_Log("initNMFCallBackServices - nmfCallBackFifoID=%d, thread_id=%d\n",
		     nmfCallBackFifoID, LOS_GetCurrentId());

    // Start the thread managing the NMF MPC to HOST call backs
    LOS_ThreadCreate(NMF_CallBackThread, NULL,
		     NMF_CALL_BACK_STACK_SIZE, LOS_USER_URGENT_PRIORITY,
		     "NMF_MPC_2_HOST_CB_Thread");
}
/* -----------------------------------------------------------------------
FUNCTION : Apply flash settings.
PURPOSE  : Function to set flash settings.
------------------------------------------------------------------------ */
static void
Configure_Flash(
t_uint32    s32_DelayFromStartPoint,
t_uint32    u32_StrobeLength_us,
t_uint32    u8_FrameCount,
t_uint32    u8_MaximumNumberOfFrames,
t_uint32    e_StrobeStartPoint_Frame)
{
    char    comment[256];

    LOS_Log("\nConfigure Flash  now..\n");

    sprintf(
    comment,
    "Configuring  Flash for  s32_DelayFromStartPoint = %ld u32_StrobeLength_us = %ld u8_FrameCount = %ld u8_MaximumNumberOfFrames = %ld e_StrobeStartPoint_Frame = %ld \n",
    s32_DelayFromStartPoint,
    u32_StrobeLength_us,
    u8_FrameCount,
    u8_MaximumNumberOfFrames,
    e_StrobeStartPoint_Frame);
    MMTE_TEST_COMMENT(comment);

    ITE_writePE(FlashControl_s32_DelayFromStartPoint_lines_Byte0, s32_DelayFromStartPoint);
    ITE_writePE(FlashControl_u32_StrobeLength_us_Byte0, u32_StrobeLength_us);
    ITE_writePE(FlashControl_u8_FrameCount_Byte0, u8_FrameCount);
    ITE_writePE(FlashControl_u8_MaxFramesToWaitForFlashTrigger_Byte0, u8_MaximumNumberOfFrames);
    ITE_writePE(FlashControl_e_StrobeStartPoint_Frame_Byte0, e_StrobeStartPoint_Frame);

#if FLASH_DRIVER_INCLUDE
    // ER:408207: Flash driver integration in ITE NMF.
    ITE_FlashDriverConfigure();

#endif
}
/* -----------------------------------------------------------------------
   FUNCTION : C_ite_dbg_ConfigureAdsoc_cmd
   PURPOSE  :
   ------------------------------------------------------------------------ */
CMD_COMPLETION
C_ite_dbg_ConfigureAdsoc_cmd(
int     a_nb_args,
char    **ap_args)
{
    char    mess[256];

    sprintf(mess, "ConfigureAdsoc_%d", ( int ) g_u32_counter_adsoc_conf);
    g_u32_counter_adsoc_conf++;

    MMTE_TEST_START(mess, "/ite_nmf/test_results_nreg/Adsoc_tests", "Test ConfigureAdsoc");

    sprintf(mess, "Testing for Adsoc peaking");
    mmte_testNext(mess);

    LOS_Log("******************* ADSOC PEAKING CONFIGURATION ****************\n");

    if (a_nb_args > 1)
    {
        if (0 == strcmp(ap_args[1], "help"))
        {
            CLI_disp_error("Syntax: ConfigureAdsoc , Configures Adsoc interface provided by ISP FW \n");
        }


        if (0 == strcmp(ap_args[1], "0"))
        {
            Configure_Adsoc_Peaking(0);
            Enable_Adsoc(0, Flag_e_TRUE);
            LOS_Log("Adsoc peaking configuration done for pipe 0\n");
        }
        else if (0 == strcmp(ap_args[1], "1"))
        {
            Configure_Adsoc_Peaking(1);
            Enable_Adsoc(1, Flag_e_TRUE);
            LOS_Log("Adsoc peaking configuration done for pipe 1\n");
        }
    }


    LOS_Log("************************* ADSOC PEAKING TEST END**********************\n");
    MMTE_TEST_PASSED();
    return (CMD_COMPLETE);
}
/* -----------------------------------------------------------------------
FUNCTION : Apply exp, wb, analog gain settings.
PURPOSE  : Function to set system config settings.
------------------------------------------------------------------------ */
static void
ConfigureSystemConfigParams(
t_uint32    timeus,
t_uint32    AGain)
{
    LOS_Log("\nConfigure SystemConfigParams now..\n");

    ITE_writePE(Exposure_DriverControls_u32_TargetExposureTime_us_Byte0, timeus);
    ITE_writePE(Exposure_DriverControls_u16_TargetAnalogGain_x256_Byte0, AGain);
}
/* -----------------------------------------------------------------------
   FUNCTION : C_ite_dbg_VerityAdsocRP_cmd
   PURPOSE  :
   ------------------------------------------------------------------------ */
CMD_COMPLETION
C_ite_dbg_VerityAdsocRP_cmd(
int     a_nb_args,
char    **ap_args)
{
    char    mess[256];

    sprintf(mess, "VerityAdsoc_Radial_Peaking_%d", ( int ) g_u32_counter_RP_test);
    g_u32_counter_RP_test++;

    MMTE_TEST_START(mess, "/ite_nmf/test_results_nreg/Adsoc_tests", "Test VerifyAdsocRP");

    sprintf(mess, "Verifying AdsocRP configuration");
    mmte_testNext(mess);

    LOS_Log("********************* Verify Adsoc radial peaking STATUS PAGE **********************\n");
    if (a_nb_args != 2)
    {
        CLI_disp_error("Syntax: VerifyAdsocRP <pipe_number> \n");
        return (CMD_ERR_ARGS);
    }


    if (0 == Verify_Adsoc_Radial_Peaking(atoi(ap_args[1])))
    {
        snprintf(mess, sizeof(mess), "Adsoc radial peaking test successfull for pipe <%d>\n", atoi(ap_args[1]));
        MMTE_TEST_COMMENT(mess);
        MMTE_TEST_PASSED();
        return (CMD_COMPLETE);
    }
    else
    {
        snprintf(mess, sizeof(mess), "Adsoc radial peaking test failed for pipe <%d>\n", atoi(ap_args[1]));
        MMTE_TEST_COMMENT(mess);
        MMTE_TEST_FAILED();
        return (CMD_COMPLETE);
    }


    LOS_Log("**************** Verify Adsoc radial peaking STATUS PAGE COMPLETE *****************\n");
    return (CMD_COMPLETE);
}
Ejemplo n.º 21
0
int ITE_Check_Event_Count(t_uint16 no_of_event_recv)

{


if(1 == no_of_event_recv)

  {

     LOS_Log("SUCCESS!!! 1 EVENT RECEIVED\n\n");
     return 0;

  }

else
  {
    LOS_Log("Event Count Received Is Not 1 TEST FAILED\n\n");
    return (-1);
  }
}
/* -----------------------------------------------------------------------
   FUNCTION : C_ite_dbg_ConfigureAdsocRP_cmd
   PURPOSE  :
   ------------------------------------------------------------------------ */
CMD_COMPLETION
C_ite_dbg_ConfigureAdsocRP_cmd(
int     a_nb_args,
char    **ap_args)
{
    char    mess[256];

    sprintf(mess, "ConfigureAdsoc_Radial_Peaking_%d", ( int ) g_u32_counter_RP_conf);
    g_u32_counter_RP_conf++;

    MMTE_TEST_START(mess, "/ite_nmf/test_results_nreg/AdsocRP_tests", "Test ConfigureAdsocRP");

    sprintf(mess, "Testing for Adsoc peaking");
    mmte_testNext(mess);

    LOS_Log("************* ADSOC RADIAL PEAKING CONFIGURATION TEST ****************\n");
    if (a_nb_args != 2)
    {
        CLI_disp_error("Syntax: ConfigureAdsocRP , Configures Adsoc interface provided by ISP FW \n");
        return (CMD_ERR_ARGS);
    }


    if (0 == Configure_Adsoc_Radial_Peaking(atoi(ap_args[1])))
    {
        Enable_Adsoc_Radial_Peaking(atoi(ap_args[1]), Flag_e_TRUE);
        LOS_Log("Adsoc radial peaking configuration done for pipe <%d>\n", atoi(ap_args[1]));
    }
    else
    {
        snprintf(mess, sizeof(mess), "Adsoc radial peaking configuration failed for pipe <%d>\n", atoi(ap_args[1]));
        MMTE_TEST_COMMENT(mess);
        MMTE_TEST_FAILED();
        return (CMD_COMPLETE);
    }


    LOS_Log("********************* ADSOC RADIAL PEAKING TEST END*******************\n");
    MMTE_TEST_PASSED();
    return (CMD_COMPLETE);
}
Ejemplo n.º 23
0
int ITE_DisplayEvent()
{
    int start;
    //LOS_Log(" STE ITE_DisplayEvent - \n");

    for (start = ITE_EventQ.head; start != ITE_EventQ.tail; start = ((start+1)%ITE_EVENT_QUEUE_SIZE))
    {
        LOS_Log(" **** Events in queue **** %d \n",ITE_EventQ.events[start].type);
        ITE_traceISPCTLevent(ITE_EventQ.events[start]);
    }
    return 0;

}
/* -----------------------------------------------------------------------
   FUNCTION : C_ite_dbg_PrintAdsoc_cmd
   PURPOSE  :
   ------------------------------------------------------------------------ */
CMD_COMPLETION
C_ite_dbg_VerifyAdsoc_cmd(
int     a_nb_args,
char    **ap_args)
{
    char    mess[256];

    sprintf(mess, "VerityAdsoc_%d", ( int ) g_u32_counter_adsoc_test);
    g_u32_counter_adsoc_test++;

    MMTE_TEST_START(mess, "/ite_nmf/test_results_nreg/Adsoc_tests", "Test PrintAdsocStatus");

    sprintf(mess, "Verifying Adsoc");
    mmte_testNext(mess);

    LOS_Log("**********************************************************************\n");
    LOS_Log("******************* PRINT Adsoc peaking STATUS PAGE ********************\n");
    LOS_Log("**********************************************************************\n");
    if (a_nb_args > 1)
    {
        if (0 == strcmp(ap_args[1], "help"))
        {
            CLI_disp_error("Syntax: PrintAdsocRP , Tests Adsoc interface provided by ISP FW \n");
        }


        if (0 == strcmp(ap_args[1], "0"))
        {
            Verify_Adsoc_Peaking(0);
            LOS_Log("Adsoc peaking Status Page Printing done for pipe 0\n");
        }
        else if (0 == strcmp(ap_args[1], "1"))
        {
            Verify_Adsoc_Peaking(1);
            LOS_Log("Adsoc peaking Status Page Printing done for pipe 1\n");
        }
    }
    else
    {
        CLI_disp_error("Syntax: PrintAdsoc , Tests Adsoc peaking interface provided by ISP FW \n");
    }


    LOS_Log("**********************************************************************\n");
    LOS_Log("****************** PRINT Adsoc peaking STATUS PAGE COMPLETE *******************\n");
    LOS_Log("**********************************************************************\n");
    MMTE_TEST_PASSED();
    return (CMD_COMPLETE);
}
t_uint32 ConfigureForcedGrabMode(GrabMode_te e_Grab_Mode)
{
    LOS_Log("\n>> ConfigureForcedGrabMode \n");

    // set beginning counter for GRABOK done thus far
    g_u32_GrabOK_Count_Begin = ITE_readPE(Event3_Count_u16_EVENT3_0_DMA_GRAB_OK_Byte0); 

    // set beginning counter for GRAB NOK done thus far
    g_u32_Grab_NOK_Count_Begin = ITE_readPE(Event3_Count_u16_EVENT3_0_DMA_GRAB_NOK_Byte0);     

    // set beginning counter for total no. of bms abort done thus far
    g_u32_Grab_Abort_Count_Begin = ITE_readPE(Event3_Count_u16_EVENT3_2_DMA_GRAB_Abort_Byte0);     

    LOS_Log("g_u32_GrabOK_Count_Begin = %u, g_u32_Grab_NOK_Count_Begin = %u, g_u32_Grab_Abort_Count_Begin = %u\n", g_u32_GrabOK_Count_Begin, g_u32_Grab_NOK_Count_Begin, g_u32_Grab_Abort_Count_Begin);
    
    // now set ForceGrabOk PE to value as indicated by caller
    ITE_writePE(SystemSetup_e_GrabMode_Ctrl_Byte0, e_Grab_Mode);
    
    LOS_Log("<< ConfigureForcedGrabMode \n");

    return 0;
}
/* -----------------------------------------------------------------------
   FUNCTION : C_ite_dbg_ConfigureGridIron_StaticPrams_cmd
   PURPOSE  :
   ------------------------------------------------------------------------ */
CMD_COMPLETION
C_ite_dbg_ConfigureGridIron_StaticPrams_cmd(
int     a_nb_args,
char    **ap_args)
{
    char    mess[256];

    sprintf(mess, "ConfigureGridIron_%d", ( int ) g_u32_counter_gridiron_conf);
    g_u32_counter_gridiron_conf++;

    MMTE_TEST_START(mess, "/ite_nmf/test_results_nreg/GridIron_tests", "Test ConfigureGridIronStatic");

    sprintf(mess, "Testing for GridIron");
    mmte_testNext(mess);

    LOS_Log("******************* GRIDIRON STATIC CONFIGURATION START **********************\n");

    if (a_nb_args != 3)
    {
        if (0 == strcmp(ap_args[1], "help"))
        {
            CLI_disp_error("Syntax: ConfigureGridIronStatic , Configures GridIron interface provided by ISP FW \n");
        }
    }
    else
    {
        Configure_Gridiron_StaticPrarams(ap_args[1][0] - '0', ap_args[2][0] - '0');
        Enable_Gridiron(Flag_e_TRUE);
        LOS_Log("GridIron configuration done\n");
    }


    LOS_Log("**************************** GRIDIRON STATIC CONFIGURATION END************************\n");

    MMTE_TEST_PASSED();
    return (0);
}
static t_uint32
Configure_Adsoc_Radial_Peaking(
t_uint32    pipe_no)
{
    LOS_Log("\n>> Configure_Adsoc_Radial_Peaking : pipe number = %d\n", pipe_no);
    if (0 == pipe_no)
    {
        ITE_writePE(Adsoc_RP_Ctrl_0_u16_Lens_Centre_HOffset_Byte0, g_u32_RP_Lens_Centre_HOffset);
        ITE_writePE(Adsoc_RP_Ctrl_0_u16_Lens_Centre_VOffset_Byte0, g_u32_RP_Lens_Centre_VOffset);
        ITE_writePE(Adsoc_RP_Ctrl_0_e_Flag_Adsoc_RP_Enable_Byte0, g_u32_RP_Flag_Adsoc_RP_Enable);
        ITE_writePE(Adsoc_RP_Ctrl_0_u8_Radial_Adsoc_RP_Polycoef0_Byte0, g_u32_RP_Radial_Adsoc_RP_Polycoef0);
        ITE_writePE(Adsoc_RP_Ctrl_0_u8_Radial_Adsoc_RP_Polycoef1_Byte0, g_u32_RP_Radial_Adsoc_RP_Polycoef1);
        ITE_writePE(Adsoc_RP_Ctrl_0_u8_Radial_Adsoc_RP_COF_Shift_Byte0, g_u32_RP_Radial_Adsoc_RP_COF_Shift);
        ITE_writePE(Adsoc_RP_Ctrl_0_u8_Radial_Adsoc_RP_Out_COF_Shift_Byte0, g_u32_RP_Radial_Adsoc_RP_Out_COF_Shift);
        ITE_writePE(Adsoc_RP_Ctrl_0_u8_Radial_Adsoc_RP_Unity_Byte0, g_u32_RP_Radial_Adsoc_RP_Unity);
    }
    else if (1 == pipe_no)
    {
        ITE_writePE(Adsoc_RP_Ctrl_1_u16_Lens_Centre_HOffset_Byte0, g_u32_RP_Lens_Centre_HOffset);
        ITE_writePE(Adsoc_RP_Ctrl_1_u16_Lens_Centre_VOffset_Byte0, g_u32_RP_Lens_Centre_VOffset);
        ITE_writePE(Adsoc_RP_Ctrl_1_e_Flag_Adsoc_RP_Enable_Byte0, g_u32_RP_Flag_Adsoc_RP_Enable);
        ITE_writePE(Adsoc_RP_Ctrl_1_u8_Radial_Adsoc_RP_Polycoef0_Byte0, g_u32_RP_Radial_Adsoc_RP_Polycoef0);
        ITE_writePE(Adsoc_RP_Ctrl_1_u8_Radial_Adsoc_RP_Polycoef1_Byte0, g_u32_RP_Radial_Adsoc_RP_Polycoef1);
        ITE_writePE(Adsoc_RP_Ctrl_1_u8_Radial_Adsoc_RP_COF_Shift_Byte0, g_u32_RP_Radial_Adsoc_RP_COF_Shift);
        ITE_writePE(Adsoc_RP_Ctrl_1_u8_Radial_Adsoc_RP_Out_COF_Shift_Byte0, g_u32_RP_Radial_Adsoc_RP_Out_COF_Shift);
        ITE_writePE(Adsoc_RP_Ctrl_1_u8_Radial_Adsoc_RP_Unity_Byte0, g_u32_RP_Radial_Adsoc_RP_Unity);
    }
    else
    {
        // HandleInvalidPipe(pipe_no);
    }


    LOS_Log("\n<< Configure_Adsoc_Radial_Peaking\n");
    return (0);
}
Result_te
ITE_DeInitPrimary(void)
{
    OMX_ERRORTYPE   error = OMX_ErrorNone;

    error = MMIO_Camera::setExtClk(OMX_FALSE);
    if (error != OMX_ErrorNone)
    {
        LOS_Log("ite_Term:Can't switch of sensor clocks, error =  %d\n", error);
        goto ERR_DeInitPrimary;
    }


    error = MMIO_Camera::powerSensor(OMX_FALSE);
    if (error != OMX_ErrorNone)
    {
        LOS_Log("ite_Term:Can't switch off sensor, error =  %d\n", error);
        goto ERR_DeInitPrimary;
    }


#ifndef MMIO_ENABLE_NEW_IF
    LOS_Log("ite_DeInit: release Primary Camera HW Interface\n");
    error = MMIO_Camera::releasePrimaryCameraHWInterface();

    if (error != OMX_ErrorNone)
    {
        LOS_Log("ite_Term:Can't release Primary Camera HW Interface error %d\n", error);
        goto ERR_DeInitPrimary;
    }


#else
    error = MMIO_Camera::desinitBoard();
    if (error != OMX_ErrorNone)
    {
        LOS_Log("ite_Term:ERROR in MMIO_Camera::desinitBoard, error =  %d\n", error);
        goto ERR_DeInitPrimary;
    }


    error = MMIO_Camera::releaseDriver();
    if (error != OMX_ErrorNone)
    {
        LOS_Log("ite_Term:ERROR in MMIO_Camera::releaseDriver, error =  %d\n", error);
        goto ERR_DeInitPrimary;
    }
#endif
    return Result_e_Success;

ERR_DeInitPrimary:
    return Result_e_Failure;

}
// NMF Call Back thread function
void NMF_CallBackThread(void *fct)
 {
    char *buffer;
    void *itfref=0;
    t_cm_error err;

    LOS_Log("NMF-DSP Callbackthread - Starting Callback the Thread\n");
    mapInstallActiveScheduler();

    // CM Callback Thread
    while(1 && g_exit_CM_CALLBACK_THREAD)
    {
        err = CM_GetMessage(nmfCallBackFifoID, &itfref, &buffer, (t_bool)TRUE);

        if(err == CM_OK)
        {
            // Execute the call back
            if (itfref)
            {
                CM_ExecuteMessage(itfref, buffer);
            } else
            {
                // NMF service message (panic, ...)
                LOS_Log("NMF-DSP CallbackThread: CM_Empty Message\n");
                CM_ExecuteMessage(0, buffer);
            }
        }
        else if ( err == NMF_FLUSH_MESSAGE )
        {
            LOS_Log("NMF-DSP CallbackThread: PANIC PANIC PANIC NMF_FLUSH_MESSAGE\n");
            //Shuts down the thread
            break;
        }
        else if ( err == CM_NO_MESSAGE )
        {
            LOS_Log("NMF-DSP CallbackThread: CM_NO_MESSAGE\n");
            //Shuts down the thread
            break;
        }
        else
        {
            LOS_Log("NMF-DSP CallbackThread: ERROR REPLY\n");
            //Shuts down the thread
            break;
        }
    }

    mapDeleteActiveScheduler();
    LOS_Log("NMF-DSP Callbackthread - Exiting the Thread\n");
}
CMD_COMPLETION
C_ite_dbg_Configure_GrabMode_cmd(
int     a_nb_args,
char    **ap_args)
{
    char    mess[256];

    sprintf(mess, "Forced_Grab_Mode_%d", (int)g_u32_grabok_counter_config);
    g_u32_grabok_counter_config++;

    MMTE_TEST_START(
    mess,
    "/ite_nmf/test_results_nreg/Forced_Grab_Mode",
    "Forced_Grab_Mode");

    sprintf(mess, "Configuring begin point for grab ok mechanism");
    mmte_testNext(mess);    
    
    switch(a_nb_args)
    {       
        case 2:                 // configureForcedGrabMode  <forced_grab_mode>
        {                              
            ConfigureForcedGrabMode(atoi(ap_args[1]));                
            break;
        }

        default:     // wrong syntax : print on stdout how to use test framework for grabOK testing
        {
            LOS_Log("syntax : configureForcedGrabMode  <forced_grab_mode> \n"); 
            break;            
        }                     
    }

    sprintf(mess, "Configuration of forced grab mode mechanism done\n");
    mmte_testComment(mess);
    MMTE_TEST_PASSED();          

    return 0;
}