?? lcd_if.c
字號:
(main_lcd_operation_state==LCD_HW_UPDATE_SLEEP_STATE)||
(main_lcd_operation_state==LCD_DC_UPDATE_SLEEP_STATE)||
(main_lcd_operation_state==LCD_HW_SLEEP_CMD_QUEUE_STATE)||
(main_lcd_operation_state==LCD_DC_SLEEP_CMD_QUEUE_STATE))
{
for (j=0;j<50;j++);
#if ((defined(MT6228)||defined(MT6229))&& (!defined(__MAUI_BASIC__))&& (!defined(__L1_STANDALONE__)))
if (tv_output_owner == TV_OUT_OWNER_LCD)
{
if (tv_out_current_fb==0)
// REG_LCD_ROI_WMEM_ADDR=main_lcd_fb_update_para.tv_output_frame_buffer1_address;
lcd_mem_out_address_shadow1=main_lcd_fb_update_para.tv_output_frame_buffer1_address;
else
// REG_LCD_ROI_WMEM_ADDR=main_lcd_fb_update_para.tv_output_frame_buffer2_address;
lcd_mem_out_address_shadow1=main_lcd_fb_update_para.tv_output_frame_buffer2_address;
}
#endif
save_irq_mask=SaveAndSetIRQMask();
DRV_WriteReg32(LCD_ROI_CTRL_REG,lcd_hw_trigger_roi_ctrl);
DRV_WriteReg32(LCD_ROI_OFFSET_REG,lcd_hw_trigger_roi_offset);
DRV_WriteReg32(LCD_ROI_SIZE_REG,lcd_hw_trigger_roi_size);
#if ((defined(MT6228)||defined(MT6229))&& (!defined(__MAUI_BASIC__))&& (!defined(__L1_STANDALONE__)))
DRV_WriteReg32(LCD_ROI_WMEM_ADDR_REG,lcd_mem_out_address_shadow1);
#endif
for (i=0;i<LCD_CMD_QUEUE_LENGTH;i++)
// DRV_WriteReg32(LCD_CMD_PARAMETER_ADDR+(i<<2),lcd_hw_trigger_para[i]);
*((volatile unsigned int *) (LCD_CMD_PARAMETER_ADDR+(i<<2)))=lcd_hw_trigger_para[i];
RestoreIRQMask(save_irq_mask);
START_LCD_TRANSFER;
for (j=0;j<30;j++);
}
else
kal_set_eg_events(lcd_event_id,LCD_CMD_COMPLETE_EVENT,KAL_OR);
#if ((defined(MT6228)||defined(MT6229))&& (!defined(__MAUI_BASIC__))&& (!defined(__L1_STANDALONE__)))
if (tv_output_owner!=TV_OUT_OWNER_LCD)
DISABLE_LCD_TRANSFER_COMPLETE_INT;
#else
DISABLE_LCD_TRANSFER_COMPLETE_INT;
#endif
}
else
{
if ((main_lcd_operation_state==LCD_HW_CMD_QUEUE_STATE)||
(main_lcd_operation_state==LCD_DC_CMD_QUEUE_STATE)||
(main_lcd_operation_state==LCD_HW_UPDATE_SLEEP_STATE)||
(main_lcd_operation_state==LCD_DC_UPDATE_SLEEP_STATE)||
(main_lcd_operation_state==LCD_HW_SLEEP_CMD_QUEUE_STATE)||
(main_lcd_operation_state==LCD_DC_SLEEP_CMD_QUEUE_STATE))
kal_set_eg_events(lcd_event_id,LCD_CMD_COMPLETE_EVENT,KAL_OR);
save_irq_mask=SaveAndSetIRQMask();
lcd_cmd_latch_complete=KAL_FALSE;
RestoreIRQMask(save_irq_mask);
}
}
}
#if ((defined(MT6228)||defined(MT6229))&& (!defined(__MAUI_BASIC__))&& (!defined(__L1_STANDALONE__)))
if (tv_output_buffer_rotate==1)
{
g2d_tv_output_src_buff.base_address=tv_output_buffer_base_address1;
g2d_bitblt1(G2D_OWNER_LCD, &g2d_tv_output_bitblt);
tv_output_buffer_rotate=0;
}
else if (tv_output_buffer_rotate==2)
{
g2d_tv_output_src_buff.base_address=tv_output_buffer_base_address2;
g2d_bitblt1(G2D_OWNER_LCD,&g2d_tv_output_bitblt);
tv_output_buffer_rotate=0;
}
#endif
#ifdef DUAL_LCD
else if (current_update_lcd==SUB_LCD)
{
if (lcd_transfer_complete==KAL_TRUE)
{
if ((sub_lcd_operation_state==LCD_SW_UPDATE_STATE)||
(sub_lcd_operation_state==LCD_WAIT_LAST_UPDATE_STATE))
kal_set_eg_events(lcd_event_id,LCD_TRANSFER_COMPLETE_EVENT,KAL_OR);
save_irq_mask=SaveAndSetIRQMask();
lcd_transfer_complete=KAL_FALSE;
RestoreIRQMask(save_irq_mask);
if (wait_lcd_update_flag==KAL_TRUE)
{ /* for software udpate only */
wait_lcd_update_flag=KAL_FALSE;
if (sub_lcd_operation_state==LCD_SW_UPDATE_STATE)
sub_lcd_operation_state=LCD_STANDBY_STATE;
config_lcd_layer_window_queue();
if (lcd_block_cb!=NULL)
lcd_block_cb();
}
}
if (lcd_cmd_latch_complete==KAL_TRUE)
{
if (lcd_hw_trigger_flag==KAL_TRUE)
{
lcd_hw_trigger_flag=KAL_FALSE;
if ((sub_lcd_operation_state==LCD_HW_CMD_QUEUE_STATE)||
(sub_lcd_operation_state==LCD_DC_CMD_QUEUE_STATE)||
(sub_lcd_operation_state==LCD_HW_UPDATE_SLEEP_STATE)||
(sub_lcd_operation_state==LCD_DC_UPDATE_SLEEP_STATE)||
(sub_lcd_operation_state==LCD_HW_SLEEP_CMD_QUEUE_STATE)||
(sub_lcd_operation_state==LCD_DC_SLEEP_CMD_QUEUE_STATE))
{
for (j=0;j<100;j++);
DRV_WriteReg32(LCD_ROI_CTRL_REG,lcd_hw_trigger_roi_ctrl);
DRV_WriteReg32(LCD_ROI_OFFSET_REG,lcd_hw_trigger_roi_offset);
DRV_WriteReg32(LCD_ROI_SIZE_REG,lcd_hw_trigger_roi_size);
for (i=0;i<LCD_CMD_QUEUE_LENGTH;i++)
DRV_WriteReg32(LCD_CMD_PARAMETER_ADDR+(i<<2),lcd_hw_trigger_para[i]);
START_LCD_TRANSFER;
}
else
kal_set_eg_events(lcd_event_id,LCD_CMD_COMPLETE_EVENT,KAL_OR);
#if ((defined(MT6228)||defined(MT6229))&& (!defined(__MAUI_BASIC__))&& (!defined(__L1_STANDALONE__)))
if (tv_output_owner!=TV_OUT_OWNER_LCD)
DISABLE_LCD_TRANSFER_COMPLETE_INT;
#else
DISABLE_LCD_TRANSFER_COMPLETE_INT;
#endif
}
else
{
if ((sub_lcd_operation_state==LCD_HW_CMD_QUEUE_STATE)||
(sub_lcd_operation_state==LCD_DC_CMD_QUEUE_STATE)||
(sub_lcd_operation_state==LCD_HW_UPDATE_SLEEP_STATE)||
(sub_lcd_operation_state==LCD_DC_UPDATE_SLEEP_STATE)||
(sub_lcd_operation_state==LCD_HW_SLEEP_CMD_QUEUE_STATE)||
(sub_lcd_operation_state==LCD_DC_SLEEP_CMD_QUEUE_STATE))
kal_set_eg_events(lcd_event_id,LCD_CMD_COMPLETE_EVENT,KAL_OR);
save_irq_mask=SaveAndSetIRQMask();
lcd_cmd_latch_complete=KAL_FALSE;
RestoreIRQMask(save_irq_mask);
}
}
}
#endif /* DUAL_LCD */
IRQUnmask(IRQ_LCD_CODE);
#endif /* MT6219 */
#endif /*MT6218B, MT6219 */
} /* lcd_HISR() */
/*************************************************************************
* FUNCTION
* lcd_system_init
*
* DESCRIPTION
* This function is used to initialize the system correlated parameters of
* LCD interface
*
* PARAMETERS
* None
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
void lcd_system_init(void)
{
#if (defined(MT6217)||defined(MT6218B) || defined(MT6219)||defined(MT6226)||defined(MT6226M)||defined(MT6227)||defined(MT6228)||defined(MT6229))
kal_uint32 temp_reg;
#endif /* MT6218B, MT6219 */
LCD_FunConfig();
lcd_power_up();
#if (defined(MT6217)||defined(MT6218B) || defined(MT6219)||defined(MT6226)||defined(MT6226M)||defined(MT6227)||defined(MT6228)||defined(MT6229))
init_lcd_interface();
#endif /* MT6218B, MT6219 */
#ifndef __MAUI_BASIC__
if (lcd_sleep_mode_handler==0xFF)
lcd_sleep_mode_handler = L1SM_GetHandle();
#endif /* __MAUI_BASIC__ */
#if (defined(MT6217)||defined(MT6218B) || defined(MT6219)||defined(MT6226)||defined(MT6226M)||defined(MT6227)||defined(MT6228)||defined(MT6229))
if (lcd_event_id==NULL)
lcd_event_id=kal_create_event_group("LCD_EVT");
IRQ_Register_LISR(IRQ_LCD_CODE, lcd_LISR,"LCD ISR");
IRQSensitivity(IRQ_LCD_CODE,LEVEL_SENSITIVE);
if (INT_QueryExceptionStatus()!=KAL_TRUE)
IRQUnmask(IRQ_LCD_CODE);
temp_reg=DRV_Reg(LCD_INT_STATUS_REG); /* remove LCD int status */
DRV_Register_HISR(DRV_LCD_HISR_ID,lcd_HISR);
#endif /* MT6217, MT6218B, MT6219 */
#if (defined(MT6217)||defined(MT6218B) || defined(MT6219)||defined(MT6226)||defined(MT6226M)||defined(MT6227)||defined(MT6228)||defined(MT6229))
wait_lcd_update_flag=KAL_FALSE;
lcd_block_cb=NULL;
#endif
#if ((defined(MT6228)||defined(MT6229))&& (!defined(__MAUI_BASIC__))&& (!defined(__L1_STANDALONE__)))
tv_output_owner=TV_OUT_OWNER_MMI;
#endif
lcd_power_down();
} /* lcd_system_init() */
/*************************************************************************
* FUNCTION
* lcd_init
*
* DESCRIPTION
* This function is used to initialize the LCD interface and LCD module
*
* PARAMETERS
* lcd_id : selection MAIN_LCD or SUB_LCD
* background_color : RGB565 color that LCM will display after initial
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
void lcd_init(kal_uint8 lcd_id, kal_uint16 background_color)
{
#if (defined(MT6217)||defined(MT6218B)||defined(MT6219)||defined(MT6226)||defined(MT6226M)||defined(MT6227)||defined(MT6228)||defined(MT6229))
kal_uint8 i;
#endif /* MT6218B, MT6219 */
#ifndef DUAL_LCD
if (main_lcd_operation_state==LCD_IDLE_STATE)
lcd_system_init();
#else
if ((main_lcd_operation_state==LCD_IDLE_STATE)&&(sub_lcd_operation_state==LCD_IDLE_STATE))
lcd_system_init();
#endif
#if (defined(MT6217)||defined(MT6218B)||defined(MT6219)||defined(MT6226)||defined(MT6226M)||defined(MT6227)||defined(MT6228)||defined(MT6229))
for (i=0;i<4;i++)
lcd_layer_data[i].layer_update_queue=KAL_FALSE;
#if (defined(CAMERA_MODULE))
/* for AIT102N module, since the LCD interface is use the same bus with AIT102N
camera module. we should set the reset pin high and power pin low to disable AIT102N
brfore LCD interface init */
cam_module_func_config();
ext_cam_func->cam_module_power_off();
#endif /* CAMERA_MODULE */
main_lcd_fb_update_para.block_mode_flag=KAL_TRUE;
main_lcd_fb_update_para.lcd_block_mode_cb=NULL;
#ifdef DUAL_LCD
sub_lcd_fb_update_para.block_mode_flag=KAL_TRUE;
sub_lcd_fb_update_para.lcd_block_mode_cb=NULL;
#endif
lcd_power_up();
#if (defined(MT6226)||defined(MT6226M)||defined(MT6227))
main_lcd_fb_update_para.memory_output=KAL_FALSE;
#ifdef DUAL_LCD
sub_lcd_fb_update_para.memory_output=KAL_FALSE;
#endif
SET_LCD_ROI_WMEM_OFFSET(0,0);
#elif (defined(MT6228)||defined(MT6229))
main_lcd_fb_update_para.memory_output=KAL_FALSE;
main_lcd_fb_update_para.tv_output=KAL_FALSE;
#ifdef DUAL_LCD
sub_lcd_fb_update_para.memory_output=KAL_FALSE;
sub_lcd_fb_update_para.tv_output=KAL_FALSE;
#endif
SET_LCD_ROI_WMEM_OFFSET(0,0);
#endif
#if (defined(MT6226)||defined(MT6226M)||defined(MT6227)||defined(MT6229))
SET_LCD_CMD_QUEUE1;
#endif
DISABLE_LCD_ROI_CTRL_W2MEM;
switch (lcd_id)
{
case MAIN_LCD:
main_lcd_operation_state=LCD_INITIAL_STATE;
DRV_WriteReg32(LCD_ROI_CMD_ADDR_REG,MAIN_LCD_CMD_ADDR);
DRV_WriteReg32(LCD_ROI_DATA_ADDR_REG,MAIN_LCD_DATA_ADDR);
SET_LCD_ROI_CTRL_OUTPUT_FORMAT(MAIN_LCD_OUTPUT_FORMAT);
MainLCD->Init(background_color,0);
main_lcd_operation_state=LCD_STANDBY_STATE;
break;
#ifdef DUAL_LCD
case SUB_LCD:
sub_lcd_operation_state=LCD_INITIAL_STATE;
DRV_WriteReg32(LCD_ROI_CMD_ADDR_REG,SUB_LCD_CMD_ADDR);
DRV_WriteReg32(LCD_ROI_DATA_ADDR_REG,SUB_LCD_DATA_ADDR);
SET_LCD_ROI_CTRL_OUTPUT_FORMAT(SUB_LCD_OUTPUT_FORMAT);
SubLCD->Init(background_color,0);
sub_lcd_operation_state=LCD_STANDBY_STATE;
break;
#endif /* DUAL_LCD */
default:
ASSERT(0);
break;
}
lcd_power_down();
#elif (defined(MT6205B)||defined(MT6208))
lcd_power_up();
switch (lcd_id)
{
case MAIN_LCD:
main_lcd_operation_state=LCD_INITIAL_STATE;
MainLCD->Init(background_color,0);
main_lcd_operation_state=LCD_STANDBY_STATE;
break;
#ifdef DUAL_LCD
case SUB_LCD:
sub_lcd_operation_state=LCD_INITIAL_STATE;
SubLCD->Init(background_color,0);
sub_lcd_operation_state=LCD_STANDBY_STATE;
break;
#endif /* DUAL_LCD */
default:
ASSERT(0);
break;
}
#endif /* MT6218B, MT6219 */
} /* lcd_init() */
void save_lcd_register()
{
#if (defined(MT6228)||defined(MT6229))
kal_uint8 i;
lcd_hw_trigger_reg = REG_LCD_ROI_HW_CTRL;
lcd_roi_size_reg=REG_LCD_ROI_SIZE;
lcd_ctrl_reg=REG_LCD_ROI_CTRL;
for (i=0;i<LCD_CMD_QUEUE_LENGTH;i++)
lcd_cmq_para[i]=DRV_Reg32(LCD_CMD_PARAMETER_ADDR+(i<<2));
#endif
} /* save_lcd_register() */
void restore_lcd_register()
{
#if (defined(MT6228)||defined(MT6229))
kal_uint8 i;
REG_LCD_ROI_HW_CTRL=lcd_hw_trigger_reg;
REG_LCD_ROI_SIZE=lcd_roi_size_reg;
REG_LCD_ROI_CTRL=lcd_ctrl_reg;
for (i=0;i<LCD_CMD_QUEUE_LENGTH;i++)
DRV_WriteReg32(LCD_CMD_PARAMETER_ADDR+(i<<2),lcd_cmq_para[i]);
START_LCD_TRANSFER;
#endif
} /* restore_lcd_register() */
/*************************************************************************
* FUNCTION
* lcd_sleep_in
*
* DESCRIPTION
* This function is used to let LCD module enter sleep mode
*
* PARAMETERS
* lcd_id : selection MAIN_LCD or SUB_LCD
*
* RETURNS
* None
*
* GLOBALS AFFECTED
*
*************************************************************************/
void lcd_sleep_in(kal_uint8 lcd_id)
{
kal_uint32 save_irq_mask;
lcd_power_up();
switch (lcd_id)
{
case MAIN_LCD:
#if (defined(MT6217)||defined(MT6218B)||defined(MT6219)||defined(MT6226)||defined(MT6226M)||defined(MT6227)||defined(MT6228)||defined(MT6229))
DRV_WriteReg32(LCD_ROI_CMD_ADDR_REG,MAIN_LCD_CMD_ADDR);
DRV_WriteReg32(LCD_ROI_DATA_ADDR_REG,MAIN_LCD_DATA_ADDR);
#endif /* MT6218B, MT6219 */
#if (defined(MT6228)||defined(MT6229))
#if ((!defined(__MAUI_BASIC__))&& (!defined(__L1_STANDALONE__)))
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
#endif
if (main_lcd_operation_state==LCD_DC_UPDATE_STATE)
{
save_irq_mask=SaveAndSetIRQMask();
lcd_sleeping_state=KAL_TRUE;
RestoreIRQMask(save_irq_mask);
while (IMGDMA_IBW2_IS_BUSY) {};
IRQMask(IRQ_LCD_CODE);
save_lcd_register();
REG_LCD_ROI_HW_CTRL = 0;
MainLCD->SleepIn();
restore_lcd_register();
ENABLE_LCD_TRANSFER_COMPLETE_INT;
LCD_WRITE_MEM_ONLY;
DISABLE_LCD_ROI_CTRL_CMD_FIRST;
lcd_hw_trigger_roi_ctrl &= ~LCD_ROI_CTRL_CMD_ENABLE_BIT;
IRQUnmask(IRQ_LCD_CODE);
main_lcd_operation_state=LCD_DC_UPDATE_SLEEP_STATE;
save_irq_mask=SaveAndSetIRQMask();
#if ((!defined(__MAUI_BASIC__))&& (!defined(__L1_STANDALONE__)))
if (tv_output_owner == TV_OUT_OWNER_LCD)
#endif
lcd_sleeping_state=KAL_FALSE;
RestoreIRQMask(save_irq_mask);
}
else if (main_lcd_operation_state==LCD_HW_UPDATE_STATE)
{
save_irq_mask=SaveAndSetIRQMask();
lcd_sleeping_state=KAL_TRUE;
RestoreIRQMask(save_irq_mask);
while (IMGDMA_IBW2_IS_BUSY) {};
main_lcd_hw_trigger_output_mode=KAL_FALSE;
IRQMask(IRQ_LCD_CODE);
save_lcd_register();
REG_LCD_ROI_HW_CTRL = 0;
MainLCD->SleepIn();
restore_lcd_register();
LCD_WRITE_MEM_ONLY;
DISABLE_LCD_ROI_CTRL_CMD_FIRST;
lcd_hw_trigger_roi_ctrl &= ~LCD_ROI_CTRL_CMD_ENABLE_BIT;
ENABLE_LCD_TRANSFER_COMPLETE_INT;
IRQUnmask(IRQ_LCD_CODE);
main_lcd_operation_state=LCD_HW_UPDATE_SLEEP_STATE;
save_irq_mask=SaveAndSetIRQMask();
#if ((!defined(__MAUI_BASIC__))&& (!defined(__L1_STANDALONE__)))
if (tv_output_owner == TV_OUT_OWNER_LCD)
#endif
lcd_sleeping_state=KAL_FALSE;
RestoreIRQMask(save_irq_mask);
}
else if ((main_lcd_operation_state==LCD_DC_CMD_QUEUE_STATE)||
(main_lcd_operation_state==LCD_HW_CMD_QUEUE_STATE))
{
ASSERT(0);
}
else
{
MainLCD->SleepIn();
main_lcd_operation_state=LCD_SLEEP_STATE;
}
#else
MainLCD->SleepIn();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -