Exemplo n.º 1
0
static HI_VOID cmos_slow_framerate_set(HI_U16 u16FullLines,
    AE_SENSOR_DEFAULT_S *pstAeSnsDft)
{
    HI_U16 u16Vmax = u16FullLines;
    HI_U16 u16Current;
    u16Current = sensor_read_register(VMAX_ADDR+2);
    
    sensor_write_register(VMAX_ADDR, (u16Vmax&0x00ff));
    sensor_write_register(VMAX_ADDR+1, ((u16Vmax&0xff00) >> 8));
    //sensor_write_register(VMAX_ADDR+2,(((u16Vmax & 0x10000) >> 16)+(u16Current&0xFE)));

    pstAeSnsDft->u32MaxIntTime = u16Vmax - 2;
    gu32FullLines = u16Vmax;

    return;
}
Exemplo n.º 2
0
/*
 * This function applies the new integration time to the ISP registers.
 */
static __inline void cmos_inttime_update(cmos_inttime_ptr_t p_inttime) 
{

    HI_U16 exp_time,current;
    ISP_I2C_DATA_S stI2cData;
    static HI_U32 _last_exposure_time = 0xFFFFFFFF;
    
    if(_last_exposure_time == p_inttime->exposure_ashort)
    {
        return;
    }else
    {
        _last_exposure_time = p_inttime->exposure_ashort;
    }
    
    switch(gu8SensorMode)
    {
        default:
        case 0: //linear mode
            exp_time = p_inttime->full_lines - p_inttime->exposure_ashort;  
            current = sensor_read_register(EXPOSURE_ADDR+2);
#if CMOS_IMX236_ISP_WRITE_SENSOR_ENABLE
            
            stI2cData.bDelayCfg = HI_FALSE;
            stI2cData.u8DevAddr = sensor_i2c_addr;
            stI2cData.u32AddrByteNum = sensor_addr_byte;
            stI2cData.u32DataByteNum = sensor_data_byte;
            
            stI2cData.u32RegAddr = 0x3020;
            stI2cData.u32Data = (exp_time & 0xFF);
            HI_MPI_ISP_I2cWrite(&stI2cData);  

            stI2cData.u32RegAddr = 0x3020+1;
            stI2cData.u32Data = ((exp_time & 0xFF00) >> 8);
            HI_MPI_ISP_I2cWrite(&stI2cData);

            
            stI2cData.u32RegAddr = 0x3020+2;
            stI2cData.u32Data = ((((exp_time & 0x10000) >> 16)+(current&0xFE)) );
            HI_MPI_ISP_I2cWrite(&stI2cData);
            
#else   
            sensor_write_register(EXPOSURE_ADDR, exp_time & 0xFF);
            sensor_write_register(EXPOSURE_ADDR + 1, (exp_time & 0xFF00) >> 8);
            current = sensor_read_register(EXPOSURE_ADDR+2);
            sensor_write_register(EXPOSURE_ADDR+2, (((exp_time & 0x10000) >> 16)+(current&0xFE)) );
#endif

        break;
        
        case 1: //WDR mode
            //short exposure
            if (p_inttime->exposure_ashort < p_inttime->min_lines_target)
            {
                p_inttime->exposure_ashort = p_inttime->min_lines_target;
            }
            if (p_inttime->exposure_ashort > p_inttime->max_lines_target)
            {
                p_inttime->exposure_ashort = p_inttime->max_lines_target;
            }
            
            exp_time = p_inttime->full_lines - p_inttime->exposure_ashort;
            current = sensor_read_register(EXPOSURE_ADDR+2);
#if CMOS_IMX236_ISP_WRITE_SENSOR_ENABLE

            stI2cData.bDelayCfg = HI_FALSE;
            stI2cData.u8DevAddr = sensor_i2c_addr;
            stI2cData.u32AddrByteNum = sensor_addr_byte;
            stI2cData.u32DataByteNum = sensor_data_byte;

            stI2cData.u32RegAddr = 0x3020;
            stI2cData.u32Data = exp_time & 0xFF;
            HI_MPI_ISP_I2cWrite(&stI2cData);  

            stI2cData.u32RegAddr = 0x3020+1;
            stI2cData.u32Data = ((exp_time & 0xFF00) >> 8);
            HI_MPI_ISP_I2cWrite(&stI2cData);  

            
            stI2cData.u32RegAddr = 0x3020+2;
            stI2cData.u32Data = (((exp_time & 0x10000) >> 16)+(current&0xFE));
            HI_MPI_ISP_I2cWrite(&stI2cData);  

            //long exposure
            exp_time = p_inttime->full_lines - (p_inttime->exposure_ashort << 4);
            stI2cData.u32RegAddr = 0x3023;
            stI2cData.u32Data = (exp_time & 0xFF);
            HI_MPI_ISP_I2cWrite(&stI2cData);

            stI2cData.u32RegAddr = 0x3023+1;
            stI2cData.u32Data = ( (exp_time & 0xFF00) >> 8);
            HI_MPI_ISP_I2cWrite(&stI2cData);

            current = sensor_read_register(LONG_EXPOSURE_ADDR+2);
            stI2cData.u32RegAddr = 0x3023+2;
            stI2cData.u32Data = (((exp_time & 0x10000) >> 16)+(current&0xFE));
            HI_MPI_ISP_I2cWrite(&stI2cData);
#else
            sensor_write_register(EXPOSURE_ADDR, exp_time & 0xFF);
            sensor_write_register(EXPOSURE_ADDR+1, (exp_time & 0xFF00) >> 8);
            current = sensor_read_register(EXPOSURE_ADDR+2);
            sensor_write_register(EXPOSURE_ADDR+2, (((exp_time & 0x10000) >> 16)+(current&0xFE)) );

            //long exposure
            exp_time = p_inttime->full_lines - (p_inttime->exposure_ashort << 4);
            
            sensor_write_register(LONG_EXPOSURE_ADDR, exp_time & 0xFF);
            sensor_write_register(LONG_EXPOSURE_ADDR+1, (exp_time & 0xFF00) >> 8);
            //current = sensor_read_register(LONG_EXPOSURE_ADDR+2);
            sensor_write_register(LONG_EXPOSURE_ADDR+2, (((exp_time & 0x10000) >> 16)+(current&0xFE)) );
#endif
        break;
    }

}
Exemplo n.º 3
0
/* while isp notify ae to update sensor regs, ae call these funcs. */
static HI_VOID cmos_inttime_update(HI_U32 u32IntTime)
{
    HI_U16 u16ExpTime,u16Current;

    switch(gu8SensorMode)
    {
        default:
        case 0: //linear mode
            //Integration time = (VMAX - (SHS1)) + tOFFSET
            u16ExpTime = gu32FullLines - u32IntTime;
            u16Current = sensor_read_register(EXPOSURE_ADDR+2);

            #if CMOS_IMX236_ISP_WRITE_SENSOR_ENABLE
            cmos_init_regs_info();
            g_stSnsRegsInfo.astI2cData[0].u32Data = u16ExpTime & 0xFF;
            g_stSnsRegsInfo.astI2cData[1].u32Data = (u16ExpTime & 0xFF00) >> 8;
            g_stSnsRegsInfo.astI2cData[2].u32Data = (((u16ExpTime & 0x10000) >> 16)+(u16Current&0xFE));
            #else            
            sensor_write_register(EXPOSURE_ADDR, u16ExpTime & 0xFF);
            sensor_write_register(EXPOSURE_ADDR+1, (u16ExpTime & 0xFF00) >> 8);
            sensor_write_register(EXPOSURE_ADDR+2, (((u16ExpTime & 0x10000) >> 16)+(u16Current&0xFE)) );
            #endif
        break;
        case 1: //WDR mode
            #if CMOS_IMX236_ISP_WRITE_SENSOR_ENABLE
            //short exposure
            u16ExpTime = gu32FullLines - u32IntTime;
            u16Current = sensor_read_register(EXPOSURE_ADDR+2);
            
            cmos_init_regs_info();
            g_stSnsRegsInfo.astI2cData[0].u32Data = u16ExpTime & 0xFF;
            g_stSnsRegsInfo.astI2cData[1].u32Data = (u16ExpTime & 0xFF00) >> 8;
            g_stSnsRegsInfo.astI2cData[2].u32Data = (((u16ExpTime & 0x10000) >> 16)+(u16Current&0xFE));
            
            //long exposure
            u16ExpTime = gu32FullLines - (u32IntTime << 4);
            u16Current = sensor_read_register(LONG_EXPOSURE_ADDR+2);

            g_stSnsRegsInfo.astI2cData[3].u32Data = u16ExpTime & 0xFF;
            g_stSnsRegsInfo.astI2cData[4].u32Data = (u16ExpTime & 0xFF00) >> 8;
            g_stSnsRegsInfo.astI2cData[5].u32Data = (((u16ExpTime & 0x10000) >> 16)+(u16Current&0xFE));
            #else
            //short exposure
            u16ExpTime = gu32FullLines - u32IntTime;
            u16Current = sensor_read_register(EXPOSURE_ADDR+2);
            
            sensor_write_register(EXPOSURE_ADDR, u16ExpTime & 0xFF);
            sensor_write_register(EXPOSURE_ADDR+1, (u16ExpTime & 0xFF00) >> 8);
            sensor_write_register(EXPOSURE_ADDR+2, (((u16ExpTime & 0x10000) >> 16)+(u16Current&0xFE)) );

            //long exposure
            u16ExpTime = gu32FullLines - (u32IntTime << 4);
            u16Current = sensor_read_register(LONG_EXPOSURE_ADDR+2);
            
            sensor_write_register(LONG_EXPOSURE_ADDR, u16ExpTime & 0xFF);
            sensor_write_register(LONG_EXPOSURE_ADDR+1, (u16ExpTime & 0xFF00) >> 8);
            sensor_write_register(LONG_EXPOSURE_ADDR+2, (((u16ExpTime & 0x10000) >> 16)+(u16Current&0xFE)) );
            #endif
        break;
    }

    return;
}