⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 image_sensor.c

📁 MTK6225摄像头驱动。芯片是SIV120A。
💻 C
📖 第 1 页 / 共 5 页
字号:
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_WB(kal_uint32 iPara)
{
    /****************************************************************************
    *   camera_para.AWB.LightSource[m][n] is in 0x80 base, i.e. 0x80 = 1x gain  *
    ****************************************************************************/
    kal_uint16 iRGain = 0x80, iGGain = 0x80, iBGain = 0x80; // all set to 1x gain

    if (g_bCaptureMode == KAL_TRUE)
    {
        return KAL_TRUE;
    }

	write_cmos_sensor(0x00,0x02); //bank 2
	switch (iPara)
	{
	case CAM_WB_AUTO:   // enable AWB
	// CAM_WB_AUTO mode should not update R/G/B gains
		write_cmos_sensor(0x10, 0xD3);
	return KAL_TRUE;

	case CAM_WB_CLOUD:
		write_cmos_sensor(0x10, 0x00);  // disable AWB
		write_cmos_sensor(0x60, 0xD0);
		write_cmos_sensor(0x61, 0x88);
	break;

	case CAM_WB_DAYLIGHT:
		write_cmos_sensor(0x10, 0x00);  // disable AWB
		write_cmos_sensor(0x60, 0xC2);
		write_cmos_sensor(0x61, 0x9E);
	break;

	case CAM_WB_INCANDESCENCE:
		write_cmos_sensor(0x10, 0x00);  // disable AWB
		write_cmos_sensor(0x60, 0x98);
		write_cmos_sensor(0x61, 0xC8);
	break;

	case CAM_WB_FLUORESCENT:
		write_cmos_sensor(0x10, 0x00);  // disable AWB
		write_cmos_sensor(0x60, 0xAA);
		write_cmos_sensor(0x61, 0xBE);
	break;

	case CAM_WB_TUNGSTEN:
		write_cmos_sensor(0x10, 0x00);  // disable AWB
		write_cmos_sensor(0x60, 0x90);
		write_cmos_sensor(0x61, 0xC0);
	break;

	case CAM_WB_MANUAL:
	default:
        return KAL_FALSE;
    }

    return KAL_TRUE;
}   /* SIV120A_Set_Para_WB */

/*************************************************************************
* FUNCTION
*   SIV120A_Set_Para_EV
*
* DESCRIPTION
*   SIV120A exposure setting.
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_EV(kal_uint32 iPara)
{

    write_cmos_sensor(0x00,0x03); //bank 3
	
    switch (iPara)
    {
    case CAM_EV_NEG_4_3:    // -4 EV
        write_cmos_sensor(0x88, 0xA0);
        break;

    case CAM_EV_NEG_3_3:    // -3 EV
        write_cmos_sensor(0x88, 0x98);
        break;

    case CAM_EV_NEG_2_3:    // -2 EV
        write_cmos_sensor(0x88, 0x90);
        break;

    case CAM_EV_NEG_1_3:    // -1 EV
        write_cmos_sensor(0x88, 0x88);
        break;

    case CAM_EV_ZERO:   // +0 EV
        write_cmos_sensor(0x88, 0x00);
        break;

    case CAM_EV_POS_1_3:    // +1 EV
        write_cmos_sensor(0x88, 0x08);
        break;

    case CAM_EV_POS_2_3:    // +2 EV
        write_cmos_sensor(0x88, 0x10);
        break;

    case CAM_EV_POS_3_3:    // +3 EV
        write_cmos_sensor(0x88, 0x18);
        break;

    case CAM_EV_POS_4_3:    // +4 EV
        write_cmos_sensor(0x88, 0x20);
        break;

    default:
        return KAL_FALSE;    
    }

    return KAL_TRUE;	
}   /* SIV120A_Set_Para_EV */

/*************************************************************************
* FUNCTION
*   SIV120A_Set_Para_Banding
*
* DESCRIPTION
*   SIV120A banding setting.
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_Banding(kal_uint32 iPara)
{
    g_iBanding = iPara;
 
    switch (iPara)
    {
    case CAM_BANDING_50HZ:
        // all 50HZ blank register cannot be used
            if (g_bVideoMode == KAL_TRUE)
            	{
				write_cmos_sensor(0x00, 0x00);
				ConfigVBlank(VIDEO_MODE_VBLANK_50HZ_NORMAL, CAM_BANDING_50HZ);
				ConfigHBlank(VIDEO_MODE_HBLANK_50HZ_NORMAL, CAM_BANDING_50HZ);
				write_cmos_sensor(0x00, 0x01);
				write_cmos_sensor(0x34, VIDEO_MODE_STSTN_50HZ_NORMAL);
            }
            else
            {
				write_cmos_sensor(0x00, 0x00);            
				ConfigVBlank(PV_MODE_VBLANK_50HZ_NORMAL, CAM_BANDING_50HZ);
				ConfigHBlank(PV_MODE_HBLANK_50HZ_NORMAL, CAM_BANDING_50HZ);            			
				write_cmos_sensor(0x00, 0x01);
				write_cmos_sensor(0x34, PV_MODE_STSTN_50HZ_NORMAL);            
        }
        break;

    case CAM_BANDING_60HZ:
            if (g_bVideoMode == KAL_TRUE)
            {
				write_cmos_sensor(0x00, 0x00);            
				ConfigVBlank(VIDEO_MODE_VBLANK_60HZ_NORMAL, CAM_BANDING_60HZ);
				ConfigHBlank(VIDEO_MODE_HBLANK_60HZ_NORMAL, CAM_BANDING_60HZ);            			
				write_cmos_sensor(0x00, 0x01);
				write_cmos_sensor(0x34, VIDEO_MODE_STSTN_60HZ_NORMAL);

            }
            else
            {
				write_cmos_sensor(0x00, 0x00);            
				ConfigVBlank(PV_MODE_VBLANK_60HZ_NORMAL, CAM_BANDING_60HZ);
				ConfigHBlank(PV_MODE_HBLANK_60HZ_NORMAL, CAM_BANDING_60HZ);            			
				write_cmos_sensor(0x00, 0x01);
				write_cmos_sensor(0x34, PV_MODE_STSTN_60HZ_NORMAL);            
        }
        break;

    default:
        return KAL_FALSE;
    }

    return KAL_TRUE;
}   /* SIV120A_Set_Para_Banding */

/*************************************************************************
* FUNCTION
*   SIV120A_Set_Para_Saturation
*
* DESCRIPTION
*   SIV120A SATURATION setting.
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_Saturation(kal_uint32 iPara)
{
    return KAL_FALSE;
}   /* SIV120A_Set_Para_Saturation */

/*************************************************************************
* FUNCTION
*   SIV120A_Set_Para_NightMode
*
* DESCRIPTION
*   SIV120A night mode setting.
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_NightMode(kal_uint32 iPara)
{
    SIV120A_NightMode((kal_bool) iPara);

    return KAL_TRUE;
}   /* SIV120A_Set_Para_NightMode */

/*************************************************************************
* FUNCTION
*   SIV120A_Set_Para_AE_Meter
*
* DESCRIPTION
*   SIV120A AE metering mode
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_AE_Meter(kal_uint32 iPara)
{
    if (g_bCaptureMode == KAL_TRUE)
    {
        return KAL_TRUE;
    }

	write_cmos_sensor(0x00,0x01); //bank 1
    switch (iPara)
    {
    case CAM_AE_METER_AUTO: // NORMAL mode AE metering : window setting change
        write_cmos_sensor(0x60, 0xFF);
        write_cmos_sensor(0x61, 0xFF);       
	 write_cmos_sensor(0x62, 0xFF);
	 write_cmos_sensor(0x63, 0xFF);
	 write_cmos_sensor(0x64, 0xFF);
	 write_cmos_sensor(0x65, 0xFF);

        write_cmos_sensor(0x66, 0x00);
        write_cmos_sensor(0x67, 0x50);       
	 write_cmos_sensor(0x68, 0x50);
	 write_cmos_sensor(0x69, 0x50);
	 write_cmos_sensor(0x6A, 0x50);
	 write_cmos_sensor(0x6B, 0x00);

        g_iAE_Meter = CAM_AE_METER_AUTO;
        break;

    case CAM_AE_METER_SPOT: // SPOT mode AE metering : window setting change
        write_cmos_sensor(0x60, 0x18);
        write_cmos_sensor(0x61, 0x7E);       
	 write_cmos_sensor(0x62, 0xFF);
	 write_cmos_sensor(0x63, 0xFF);
	 write_cmos_sensor(0x64, 0x7E);
	 write_cmos_sensor(0x65, 0x18);

        write_cmos_sensor(0x66, 0x00);
        write_cmos_sensor(0x67, 0xA0);       
	 write_cmos_sensor(0x68, 0xA0);
	 write_cmos_sensor(0x69, 0xA0);
	 write_cmos_sensor(0x6A, 0xA0);
	 write_cmos_sensor(0x6B, 0x00);

        g_iAE_Meter = CAM_AE_METER_SPOT;
        break;

    case CAM_AE_METER_CENTRAL:
    case CAM_AE_METER_AVERAGE:
    default:
        return KAL_FALSE;
	}

    return KAL_TRUE;
}   /* SIV120A_Set_Para_AE_Meter */

/*************************************************************************
* FUNCTION
*   SIV120A_Get_Para_AF_Status
*
* DESCRIPTION
*   SIV120A AF status
*   Possible status: AF_SEARCH_SUCCESS, AF_SEARCH_FAIL, AF_BUSY
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Get_Para_AF_Status(kal_uint32 iPara)
{
    // SIV120A not support AF

	return AF_SEARCH_FAIL;
}   /* SIV120A_Get_Para_AF_Status */

/*************************************************************************
* FUNCTION
*   SIV120A_Set_Para_Shutter_Priority
*
* DESCRIPTION
*   SIV120A
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_Shutter_Priority(kal_uint32 iPara)
{
    return KAL_FALSE;
}   /* SIV120A_Set_Para_Shutter_Priority */

/*************************************************************************
* FUNCTION
*   SIV120A_Set_Para_Aperture_Priority
*
* DESCRIPTION
*   SIV120A
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_Aperture_Priority(kal_uint32 iPara)
{
    return KAL_FALSE;
}   /* SIV120A_Set_Para_Aperture_Priority */

/*************************************************************************
* FUNCTION
*   SIV120A_Set_Para_ISO
*
* DESCRIPTION
*   SIV120A
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_ISO(kal_uint32 iPara)
{
    switch (iPara)
    {
    case CAM_ISO_AUTO:
    case CAM_ISO_100:
    case CAM_ISO_200:
    case CAM_ISO_400:
    default:
        return KAL_FALSE;
    }

    return KAL_FALSE;
}   /* SIV120A_Set_Para_ISO */

/*************************************************************************
* FUNCTION
*   SIV120A_Set_Para_DSC_Mode
*
* DESCRIPTION
*   SIV120A
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_DSC_Mode(kal_uint32 iPara)
{
    switch (iPara)
    {
    case CAM_AUTO_DSC:
    case CAM_PORTRAIT:
    case CAM_LANDSCAPE:
    case CAM_SPORT:
    case CAM_FLOWER:
    case CAM_NIGHTSCENE:
    case CAM_TV_MODE:
    case CAM_AV_MODE:
    case CAM_ISO_MODE:
    default:
	    return KAL_FALSE;
    }

    return KAL_FALSE;
}   /* SIV120A_Set_Para_DSC_Mode */

/*************************************************************************
* FUNCTION
*   SIV120A_Set_Para_Effect
*
* DESCRIPTION
*   SIV120A
*
* PARAMETERS
*   None
*
* RETURNS
*   None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint32 SIV120A_Set_Para_Effect(kal_uint32 iPara)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -