Example #1
0
static portBASE_TYPE handle_msg_cfg_timer(msg_id_t id, msg_data_t *msg)
{
  timer_cfg(
      msg->measure_cfg_timer.prescaler,
      msg->measure_cfg_timer.period);
  
  return pdTRUE;
}
Example #2
0
void SysInit_ResetShutDownTimer(void)
{
  // reset shutdown timer first
  rtc_resetShutdownTimer();

  if (timer_open((UINT *)&guiResetShutDownTimerID, SysInit_ResetShutDownTimerHdl) != E_OK)
     return;

  timer_cfg(guiResetShutDownTimerID, RESET_SHUTDOWN_TIMER_INTERVAL*1000, TIMER_MODE_FREE_RUN | TIMER_MODE_ENABLE_INT, TIMER_STATE_PLAY);
}
//UINT32 PerfData[20];
void IPL_FCB_GetCapRawNormal(IPL_PROC_ID Id, IPC_SIE_Info *Info, IPLCTRL_CAP_EXT_INFO *ExtInfo)
{
    EXPOSURE_SETTING ExpTSetting;
    GAIN_SETTING Gain;
    SENSOR_MODE Mode;
    UINT32 Ratio;
    UINT32 capiso,capext,iris,Iris_Step;
#if MS_CTRLBY_TIMER
    TIMER_ID    TimerID_MS;
    ER  TimerState;

    TimerState = timer_open(&TimerID_MS, IPL_FCB_MshutterClose);
    if(TimerState != E_OK)
    {
        GRS_Mode = 0;
        DBG_ERR("Timer oper fail, use rolling shutter!");
    }
    else
    {
        GRS_Mode = 1;
    }
#endif
    //Perf_Open();

    SENSOR_ID SenId;
    SenId = IPL_UTI_CONV2_SEN_ID(Id);

    //change sensor mode to capture
    //IPC_WaitVD(FALSE,IPL_ID_1);
    AE_GetCapAEArg(&capiso, &capext, &iris);
    if (MainFlashInfo.TriggerEnable == ENABLE)
    {
        capiso = MainFlashInfo.Flash_Cap_ISO;
        capext = MainFlashInfo.Flash_Cap_ExpoTime;
    }

    switch(iris)
    {
        case AEALG_IRIS_0:
        default:
            Iris_Step = IRIS_POS_F1_8;
            break;
        case AEALG_IRIS_1:
            Iris_Step = IRIS_POS_F2_8;
            break;
        case AEALG_IRIS_2:
            Iris_Step = IRIS_POS_F4_0;
            break;
        case AEALG_IRIS_3:
            Iris_Step = IRIS_POS_F5_6;
            break;
        case AEALG_IRIS_4:
            Iris_Step = IRIS_POS_F8_0;
            break;
    }
    Lens_Aperture_Move(Iris_Step);
    Lens_Shutter_Move(MOTOR_SHUTTER_CAP, ENABLE);

    //IPC_WaitVD(TRUE,IPL_ID_1);
    //PerfData[0] = Perf_Mark();

    Sensor_ChgMode(SenId, IPL_AlgGetUIInfo(IPL_SEL_CAPSENMODE));
    //PerfData[1] = Perf_Mark();
    Sensor_GetCurMode(SenId, &Mode);
    Ratio = Sensor_GetExpoSetting(SenId, capext, Mode, &ExpTSetting);
    Sensor_GetGainSetting(SenId, (capiso * Ratio / 100), &Gain);
    Sensor_SetExpTime(SenId, &ExpTSetting);
    Sensor_SetGain(SenId, &Gain);
    //IPC_WaitVD(FALSE,Id);
    if(GRS_Mode)
    {
        IPL_FCB_MshutterConfig();
        if (MainFlashInfo.TriggerEnable == ENABLE)
            IPL_FCB_FlashCfg_Main(&MainFlashInfo);
        //IPC_WaitVD(FALSE);
        //PerfData[2] = Perf_Mark();
        Sensor_SetGRS(SenId);
        IPC_WaitVD(TRUE,Id);
        //IPH_ENG_WaitSignal(IPL_HAL_SIE,SIE_FLDEND,FALSE);
        //PerfData[3] = Perf_Mark();
#if MS_CTRLBY_TIMER
        timer_cfg(TimerID_MS, 51000, TIMER_MODE_ONE_SHOT | TIMER_MODE_ENABLE_INT, TIMER_STATE_PLAY);
#endif
        IPL_CTRLRunTimeChg(IPC_SIE_, (void*)Info);
        IPL_CTRLStop(IPC_RESUME_SIE);
#if (MS_CTRLBY_TIMER == 0)
    /*** need to calibrate the delay time and modify the control methold ***/
        if(SENSOR_MODE_2 == Mode)
            Delay_DelayUs(51000);
        else
            Delay_DelayUs(32000);

        IPL_FCB_MshutterClose(0);
    /***********************************************************/
#endif
    }
    else// ERS mode
    {
        IPL_CTRLRunTimeChg(IPC_SIE_, (void*)Info);
        if (MainFlashInfo.TriggerEnable == ENABLE)
        {
            IPL_FCB_FlashTrig(&MainFlashInfo);
        }
        IPC_WaitVD(FALSE,Id);
        IPL_CTRLStop(IPC_RESUME_SIE);
    }
    IPC_WaitVD(FALSE,Id);
    //IPH_ENG_WaitSignal(IPL_HAL_SIE,SIE_FLDEND,FALSE);
    //PerfData[4] = Perf_Mark();
    IPL_CTRLStop(IPC_PAUSE_SIE);
    IPC_WaitVD(FALSE,Id);
    //IPH_ENG_WaitSignal(IPL_HAL_SIE,SIE_FLDEND,FALSE);
    //PerfData[5] = Perf_Mark();
    if(GRS_Mode)
    {
        IPL_FCB_MshutterOpen();
        Delay_DelayMs(15);
        Lens_Shutter_Move(MOTOR_SHUTTER_CAP, DISABLE);
#if MS_CTRLBY_TIMER
        timer_close(TimerID_MS);
#endif
    }
    //DBG_ERR("Perf1: %d\r\n", PerfData[1]-PerfData[0]);
    //DBG_ERR("Perf2: %d\r\n", PerfData[2]-PerfData[1]);
    //DBG_ERR("Perf3: %d\r\n", PerfData[3]-PerfData[2]);
    //DBG_ERR("Perf4: %d\r\n", PerfData[4]-PerfData[3]);
    //DBG_ERR("Perf5: %d\r\n", PerfData[5]-PerfData[4]);
}