LOCAL uint32_t SP0A19_flash(uint32_t param)
{
    g_flash_mode_en = param;
    Sensor_SetFlash(param);

    return 0;
}
LOCAL uint32_t GC0328_BeforeSnapshot(uint32_t param)
{

    uint16_t shutter = 0x00;
    uint16_t temp_reg = 0x00;
    uint16_t temp_r =0x00;
    uint16_t temp_g =0x00;
    uint16_t temp_b =0x00;    
    BOOLEAN b_AEC_on;
    

    SENSOR_TRACE("GC0328_BeforeSnapshot ");   

	printk("SENSOR: set flash on beforeSnapShot, g_flash_mode = %d \n",
	       g_flash_mode_en);
	if (g_flash_mode_en) {
		//Sensor_SetFlash(0x11);  // high light
		Sensor_SetFlash(1);
	}
#if 0	
    	if(GC0328_ReadReg(0X41)  & 0x08 == 0x08)  //AEC on
    		b_AEC_on = SENSOR_TRUE;
    	else
    		b_AEC_on = SENSOR_FALSE;

	temp_reg = GC0328_ReadReg(0xdb);
	temp_r = GC0328_ReadReg(0xcd);
	temp_g = GC0328_ReadReg(0xce);
	temp_b = GC0328_ReadReg(0xcf);

	shutter = (GC0328_ReadReg(0x03)<<8)  | (GC0328_ReadReg(0x04)&0x00ff) ;
	shutter = shutter /2;

	if(b_AEC_on)
		GC0328_WriteReg(0x41,GC0328_ReadReg(0x41) & 0xc5); //0x01);
	SENSOR_Sleep(300); 

///12m
	Sensor_SetMCLK(12);
	
	GC0328_WriteReg(0x03,shutter/256);
	GC0328_WriteReg(0x04,shutter & 0x00ff);	
   	//SENSOR_TRACE("GC0328_BeforeSnapshot, temp_r=%x,temp_reg=%x, final = %x ",temp_r,temp_reg, temp_r*temp_reg/ 0x80);    

	temp_r = (temp_r*temp_reg) / 0x80;
	temp_g = (temp_g*temp_reg) / 0x80;
	temp_b = (temp_b*temp_reg) / 0x80;
	if(b_AEC_on)
	{
		GC0328_WriteReg(0xcd, temp_r);
		GC0328_WriteReg(0xce, temp_g);
		GC0328_WriteReg(0xcf , temp_b);
	}
   	//SENSOR_TRACE("GC0328_BeforeSnapshot, temp_r=%x,temp_g=%x, temp_b = %x ",temp_r,temp_g,temp_b);    

	SENSOR_Sleep(300); 
#endif
    	return 0;
    
}
LOCAL uint32_t GC0328_After_Snapshot(uint32_t param)
{
	printk("SENSOR: set flash on beforeSnapShot, g_flash_mode = %d \n",
	       g_flash_mode_en);
	if (g_flash_mode_en) {
		Sensor_SetFlash(0x10);
	}
	
	//Sensor_SetMCLK(24);
	
	//GC0328_WriteReg(0x41,GC0328_ReadReg(0x41) | 0xf7);
	//SENSOR_Sleep(200);
	return 0;
    
}
LOCAL uint32_t _gc0328_flash(uint32_t param)
{
	g_flash_mode_en = param;
	Sensor_SetFlash(param);
	return 0;
}