mainlcd.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:57k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  *  mainlcd.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *  MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  define LCD and sub-LCD routines.
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  * -------
  53.  *
  54.  *============================================================================
  55.  *             HISTORY
  56.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  57.  *------------------------------------------------------------------------------
  58.  * removed!
  59.  *
  60.  * removed!
  61.  * removed!
  62.  * removed!
  63.  *
  64.  * removed!
  65.  * removed!
  66.  * removed!
  67.  *
  68.  * removed!
  69.  * removed!
  70.  * removed!
  71.  *
  72.  * removed!
  73.  * removed!
  74.  * removed!
  75.  *
  76.  * removed!
  77.  * removed!
  78.  * removed!
  79.  *
  80.  * removed!
  81.  * removed!
  82.  * removed!
  83.  *
  84.  *------------------------------------------------------------------------------
  85.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  86.  *============================================================================
  87.  ****************************************************************************/
  88. #ifndef _MAINLCD_C
  89. #define _MAINLCD_C
  90. #include "mmi_features.h"
  91. #include "kal_non_specific_general_types.h"
  92. #include "gui.h"
  93. /* target    : custom/drv/LCD/XXXXLCM/lcd_sw_inc.h */
  94. /* simulator : plutommi/mmi/DrvSim/DrvSimInc/lcd_sw_inc.h */
  95. #include "lcd_sw.h"
  96. /* interface/Include/lcd_if.h */
  97. #include "lcd_if.h"
  98. #include "gdi_include.h"
  99. #include "KeyMap.h"
  100. #include "lcd_sw_rnd.h"
  101. /***************************************************************************** 
  102. * Define
  103. *****************************************************************************/
  104. #if 0
  105. /* under construction !*/
  106. /* under construction !*/
  107. /* under construction !*/
  108. /* under construction !*/
  109. #endif /* 0 */ 
  110. #define SIMULATOR_LAYER_COUNT       (4)
  111. #define  BUF_PIXEL_DATA(buff_ptr,x , y, width)  (*(buff_ptr + ((y) * width + (x))))
  112. #define  RGB_TO_HW(R, G, B)                     ((((B) & 0xf8) >> 3) | (((G) & 0xfc) << 3) | (((R) & 0xf8) << 8))
  113. #define  HW_TO_RGB_R(VALUE)                     ((U8)(((VALUE) & 0xf800) >> 8))
  114. #define  HW_TO_RGB_G(VALUE)                     ((U8)(((VALUE) & 0x07e0) >> 3))
  115. #define  HW_TO_RGB_B(VALUE)                     ((U8)(((VALUE) & 0x001f) << 3))
  116. #define  LCD_LAYER0_ENABLE    0x80000000
  117. #define  LCD_LAYER1_ENABLE    0x40000000
  118. #define  LCD_LAYER2_ENABLE    0x20000000
  119. #define  LCD_LAYER3_ENABLE    0x10000000
  120. /***************************************************************************** 
  121. * Typedef 
  122. *****************************************************************************/
  123. /* it must be identical to what was defined in MODIS_UI.h */
  124. typedef struct
  125. {
  126.     unsigned int layer_enable;
  127.     unsigned int frame_buffer_address;
  128.     int text_clip_left;
  129.     int text_clip_top;
  130.     int text_clip_right;
  131.     int text_clip_bottom;
  132.     int gfx_clip_left;
  133.     int gfx_clip_top;
  134.     int gfx_clip_right;
  135.     int gfx_clip_bottom;
  136.     int active_layer;
  137.     unsigned short layer_x_offset;
  138.     unsigned short layer_y_offset;
  139.     unsigned short layer_width;
  140.     unsigned short layer_height;
  141.     unsigned short roi_x_offset;
  142.     unsigned short roi_y_offset;
  143.     unsigned short roi_width;
  144.     unsigned short roi_height;
  145.     unsigned char source_key_enable;
  146.     unsigned char opacity_enable;
  147.     unsigned short source_key;
  148.     unsigned char opacity_value;
  149. } MODIS_UI_layer_info_struct;
  150. /***************************************************************************** 
  151. * Local Variable
  152. *****************************************************************************/
  153. /* Main LCD simulator shadow buffer */
  154. U16 simulator_shadow_buffer[LCD_WIDTH * LCD_HEIGHT];
  155. /* Sub LCD simulator shadow buffer */
  156. #ifdef __MMI_SUBLCD__
  157. U16 simulator_sub_shadow_buffer[SUBLCD_WIDTH * SUBLCD_HEIGHT];
  158. #endif 
  159. /* Main LCD frame buffer for bitmap */
  160. unsigned int simulator_frame_buffer[LCD_WIDTH * LCD_HEIGHT];
  161. #ifdef __MMI_SUBLCD__
  162. /* Sub LCD frame buffer for bitmap */
  163. unsigned int sub_simulator_frame_buffer[SUBLCD_WIDTH * SUBLCD_HEIGHT];
  164. #endif /* __MMI_SUBLCD__ */ 
  165. BITMAPINFO bitmap_info;
  166. BITMAPINFO sub_bitmap_info;
  167. T_W32_SCREEN_DEVICE *device;
  168. U16 SIMULATOR_SKIN_LCD_X;
  169. U16 SIMULATOR_SKIN_LCD_Y;
  170. U16 SIMULATOR_SKIN_SUB_LCD_X;
  171. U16 SIMULATOR_SKIN_SUB_LCD_Y;
  172. #ifdef __MMI_SUBLCD__
  173. kal_uint8 SubLCDSetArray[] = 
  174. {
  175.     0x01,   /* 0000 0001 */
  176.     0x02,   /* 0000 0010 */
  177.     0x04,   /* 0000 0100 */
  178.     0x08,   /* 0000 1000 */
  179.     0x10,   /* 0001 0000 */
  180.     0x20,   /* 0010 0000 */
  181.     0x40,   /* 0100 0000 */
  182.     0x80    /* 1000 0000 */
  183. };
  184. kal_uint8 SubLCDReSetArray[] = 
  185. {
  186.     0xFE,   /* 1111 1110 */
  187.     0xFD,   /* 1111 1101 */
  188.     0xFB,   /* 1111 1011 */
  189.     0xF7,   /* 1111 0111 */
  190.     0xEF,   /* 1110 1111 */
  191.     0xDF,   /* 1101 1111 */
  192.     0xBF,   /* 1011 1111 */
  193.     0x7F    /* 0111 1111 */
  194. };
  195. #endif /* __MMI_SUBLCD__ */ 
  196. /* main window */
  197. /* layer_sim_size    layer_sim_main_window; */
  198. /* ROI */
  199. /* layer_sim_offset  layer_sim_ROI_offset; */
  200. /* layer_sim_size    layer_sim_ROI_size; /*
  201.    
  202.    /* layers */
  203. lcd_layer_struct lcd_layer_data[SIMULATOR_LAYER_COUNT];
  204. /* palette look up table */
  205. U16 layer_sim_LUT0[256];
  206. U16 layer_sim_LUT1[256];
  207. BOOL IsLcdFirstInit = TRUE;
  208. HDC hdcMem, hdc;
  209. #ifdef __MMI_SUBLCD__
  210. HDC sub_hdcMem;
  211. HBITMAP sub_hbmp;
  212. #endif /* __MMI_SUBLCD__ */ 
  213. HBITMAP hbmp;
  214. MODIS_UI_layer_info_struct MODIS_UI_layer[SIMULATOR_LAYER_COUNT];
  215. MODIS_UI_layer_info_struct **MODIS_UI_layer_ptr;
  216. MODIS_UI_layer_info_struct *uil_ptr;
  217. unsigned char new_application_flag = 0;
  218. S32 active_layer;
  219. /***************************************************************************** 
  220. * Local Function
  221. *****************************************************************************/
  222. /***************************************************************************** 
  223. * Global Variable
  224. *****************************************************************************/
  225. extern HWND hWnd;
  226. /***************************************************************************** 
  227. * Global Function
  228. *****************************************************************************/
  229. extern T_W32_SCREEN_DEVICE *GetDeviceData();
  230. extern __declspec(dllimport)
  231.      void set_MODIS_UI_layer_data(MODIS_UI_layer_info_struct **layer,
  232.                                   int lcd_width, int lcd_height, int layer_count, unsigned char *new_app_flag);
  233. /*****************************************************************************
  234.  * FUNCTION
  235.  *  assert_lcd_fb_update
  236.  * DESCRIPTION
  237.  *  void
  238.  * PARAMETERS
  239.  *  lcd_id              [IN]        U8
  240.  *  start_x             [IN]        U16
  241.  *  start_y             [IN]        U16
  242.  *  end_x               [IN]        U16
  243.  *  end_y               [IN]        U16
  244.  *  roi_offset_x        [IN]        U16
  245.  *  roi_offset_y        [IN]        U16
  246.  *  update_layer        [IN]        U32
  247.  * RETURNS
  248.  *  void
  249.  *****************************************************************************/
  250.      void assert_lcd_fb_update(
  251.             kal_uint8 lcd_id,
  252.             kal_uint16 start_x,
  253.             kal_uint16 start_y,
  254.             kal_uint16 end_x,
  255.             kal_uint16 end_y,
  256.             kal_uint16 roi_offset_x,
  257.             kal_uint16 roi_offset_y,
  258.             kal_uint32 update_layer)
  259. {
  260.     /*----------------------------------------------------------------*/
  261.     /* Local Variables                                                */
  262.     /*----------------------------------------------------------------*/
  263.     /*----------------------------------------------------------------*/
  264.     /* Code Body                                                      */
  265.     /*----------------------------------------------------------------*/
  266. }   /* end of assert_lcd_fb_update */
  267. /*****************************************************************************
  268.  * FUNCTION
  269.  *  reset_lcd_if
  270.  * DESCRIPTION
  271.  *  void
  272.  * PARAMETERS
  273.  *  void
  274.  * RETURNS
  275.  *  void
  276.  *****************************************************************************/
  277. void reset_lcd_if(void)
  278. {
  279.     /*----------------------------------------------------------------*/
  280.     /* Local Variables                                                */
  281.     /*----------------------------------------------------------------*/
  282.     /*----------------------------------------------------------------*/
  283.     /* Code Body                                                      */
  284.     /*----------------------------------------------------------------*/
  285. }   /* end of reset_lcd_if */
  286. /*****************************************************************************
  287.  * FUNCTION
  288.  *  config_lcd_layer_window
  289.  * DESCRIPTION
  290.  *  void
  291.  * PARAMETERS
  292.  *  lcd_layer       [IN]        Unsigned char
  293.  *  layer_data      [IN]        Lcd_layer_struct
  294.  * RETURNS
  295.  * TRUE
  296.  *****************************************************************************/
  297. BOOL config_lcd_layer_window(unsigned char lcd_layer, lcd_layer_struct *layer_data)
  298. {
  299.     /*----------------------------------------------------------------*/
  300.     /* Local Variables                                                */
  301.     /*----------------------------------------------------------------*/
  302.     /*----------------------------------------------------------------*/
  303.     /* Code Body                                                      */
  304.     /*----------------------------------------------------------------*/
  305.     lcd_layer_data[lcd_layer] = *layer_data;
  306.     return TRUE;
  307. }   /* end of config_lcd_layer_window */
  308. /*****************************************************************************
  309.  * FUNCTION
  310.  *  lcd_dspl_init
  311.  * DESCRIPTION
  312.  *  screen initialization
  313.  * PARAMETERS
  314.  *  void
  315.  * RETURNS
  316.  *  void
  317.  *****************************************************************************/
  318. void lcd_dspl_init()
  319. {
  320.     /*----------------------------------------------------------------*/
  321.     /* Local Variables                                                */
  322.     /*----------------------------------------------------------------*/
  323.     int i;
  324.     /*----------------------------------------------------------------*/
  325.     /* Code Body                                                      */
  326.     /*----------------------------------------------------------------*/
  327.     MODIS_UI_layer_ptr =
  328.         (MODIS_UI_layer_info_struct **) malloc(SIMULATOR_LAYER_COUNT * sizeof(MODIS_UI_layer_info_struct*));
  329.     /* initialize pointer allocation for MODIS_UI_layer */
  330.     for (i = 0; i < SIMULATOR_LAYER_COUNT; i++)
  331.     {
  332.         MODIS_UI_layer_ptr[i] = &MODIS_UI_layer[i];
  333.     }
  334.     /* initialize layout data */
  335.     device = GetDeviceData();
  336.     SIMULATOR_SKIN_LCD_X = device->skin_main_lcd_x;
  337.     SIMULATOR_SKIN_LCD_Y = device->skin_main_lcd_y;
  338. #ifdef __MMI_SUBLCD__
  339.     SIMULATOR_SKIN_SUB_LCD_X = device->skin_sub_lcd_x;
  340.     SIMULATOR_SKIN_SUB_LCD_Y = device->skin_sub_lcd_y;
  341. #endif /* __MMI_SUBLCD__ */ 
  342.     /* adjust the diplaying position for LCD if the skin is bigger than real one */
  343.     if (LCD_WIDTH < device->main_lcd_width)
  344.     {
  345.         SIMULATOR_SKIN_LCD_X = SIMULATOR_SKIN_LCD_X + (device->main_lcd_width - LCD_WIDTH) / 2;
  346.         device->skin_main_lcd_x = SIMULATOR_SKIN_LCD_X;
  347.     }
  348.     if (LCD_HEIGHT < device->main_lcd_height)
  349.     {
  350.         SIMULATOR_SKIN_LCD_Y = SIMULATOR_SKIN_LCD_Y + (device->main_lcd_height - LCD_HEIGHT) / 2;
  351.         device->skin_main_lcd_y = SIMULATOR_SKIN_LCD_Y;
  352.     }
  353. #ifdef __MMI_SUBLCD__
  354.     /* adjust the diplaying position for sub-LCD if the skin is bigger than real one */
  355.     if (SUBLCD_WIDTH < device->sub_lcd_width)
  356.     {
  357.         SIMULATOR_SKIN_SUB_LCD_X = SIMULATOR_SKIN_SUB_LCD_X + (device->sub_lcd_width - SUBLCD_WIDTH) / 2;
  358.         device->skin_sub_lcd_x = SIMULATOR_SKIN_SUB_LCD_X;
  359.     }
  360.     if (SUBLCD_HEIGHT < device->sub_lcd_height)
  361.     {
  362.         SIMULATOR_SKIN_SUB_LCD_Y = SIMULATOR_SKIN_SUB_LCD_Y + (device->sub_lcd_height - SUBLCD_HEIGHT) / 2;
  363.         device->skin_sub_lcd_y = SIMULATOR_SKIN_SUB_LCD_Y;
  364.     }
  365. #endif /* __MMI_SUBLCD__ */ 
  366.     /* set up the bitmap infomation */
  367.     bitmap_info.bmiHeader.biSize = sizeof(bitmap_info.bmiHeader);
  368.     bitmap_info.bmiHeader.biWidth = LCD_WIDTH;
  369.     bitmap_info.bmiHeader.biHeight = LCD_HEIGHT;
  370.     bitmap_info.bmiHeader.biPlanes = 1;
  371.     bitmap_info.bmiHeader.biBitCount = 32;
  372.     bitmap_info.bmiHeader.biCompression = BI_RGB;
  373.     bitmap_info.bmiHeader.biSizeImage = LCD_WIDTH * LCD_HEIGHT * 4;
  374.     bitmap_info.bmiHeader.biClrUsed = 0;
  375.     bitmap_info.bmiHeader.biClrImportant = 0;
  376. #ifdef __MMI_SUBLCD__
  377.     /* set up the sub-bitmap infomation */
  378.     sub_bitmap_info.bmiHeader.biSize = sizeof(sub_bitmap_info.bmiHeader);
  379.     sub_bitmap_info.bmiHeader.biWidth = SUBLCD_WIDTH;
  380.     sub_bitmap_info.bmiHeader.biHeight = SUBLCD_HEIGHT;
  381.     sub_bitmap_info.bmiHeader.biPlanes = 1;
  382.     sub_bitmap_info.bmiHeader.biBitCount = 32;
  383.     sub_bitmap_info.bmiHeader.biCompression = BI_RGB;
  384.     sub_bitmap_info.bmiHeader.biSizeImage = SUBLCD_WIDTH * SUBLCD_HEIGHT * 4;
  385.     sub_bitmap_info.bmiHeader.biClrUsed = 0;
  386.     sub_bitmap_info.bmiHeader.biClrImportant = 0;
  387. #endif /* __MMI_SUBLCD__ */ 
  388.     /* draw to simulator's main LCD region */
  389.     hdc = GetDC(hWnd);
  390.     hdcMem = CreateCompatibleDC(hdc);
  391.     hbmp = CreateCompatibleBitmap(hdc, LCD_WIDTH, LCD_HEIGHT);
  392.     SelectObject(hdcMem, hbmp);
  393. #ifdef __MMI_SUBLCD__
  394.     /* draw to simulator's sub LCD region */
  395.     hdc = GetDC(hWnd);
  396.     sub_hdcMem = CreateCompatibleDC(hdc);
  397.     sub_hbmp = CreateCompatibleBitmap(hdc, SUBLCD_WIDTH, SUBLCD_HEIGHT);
  398.     SelectObject(sub_hdcMem, sub_hbmp);
  399. #endif /* __MMI_SUBLCD__ */ 
  400. }   /* end of lcd_dspl_init */
  401. /*****************************************************************************
  402.  * FUNCTION
  403.  *  set_global_window_handle
  404.  * DESCRIPTION
  405.  *  set global the window handle
  406.  * PARAMETERS
  407.  *  hwnd        [IN]        The input window handle
  408.  * RETURNS
  409.  *  void
  410.  *****************************************************************************/
  411. void set_global_window_handle(HWND hwnd)
  412. {
  413.     /*----------------------------------------------------------------*/
  414.     /* Local Variables                                                */
  415.     /*----------------------------------------------------------------*/
  416.     /*----------------------------------------------------------------*/
  417.     /* Code Body                                                      */
  418.     /*----------------------------------------------------------------*/
  419.     hWnd = hwnd;
  420. }   /* end of set_global_window_handle */
  421. /*****************************************************************************
  422.  * FUNCTION
  423.  *  lcd_screen_init
  424.  * DESCRIPTION
  425.  *  screen initialization
  426.  * PARAMETERS
  427.  *  hWnd            [IN]        
  428.  *  hInstance       [IN]        
  429.  * RETURNS
  430.  *  void
  431.  *****************************************************************************/
  432. void lcd_screen_init(HWND hWnd, HINSTANCE hInstance)
  433. {
  434.     /*----------------------------------------------------------------*/
  435.     /* Local Variables                                                */
  436.     /*----------------------------------------------------------------*/
  437.     /*----------------------------------------------------------------*/
  438.     /* Code Body                                                      */
  439.     /*----------------------------------------------------------------*/
  440.     device = GetDeviceData();
  441.     device->hwnd = hWnd;
  442.     set_global_window_handle(hWnd);
  443.     lcd_dspl_init();
  444. }   /* end of lcd_screen_init */
  445. /*****************************************************************************
  446.  * FUNCTION
  447.  *  update_screen
  448.  * DESCRIPTION
  449.  *  update the screen
  450.  * PARAMETERS
  451.  *  void
  452.  * RETURNS
  453.  *  void
  454.  *****************************************************************************/
  455. void update_screen()
  456. {
  457.     /*----------------------------------------------------------------*/
  458.     /* Local Variables                                                */
  459.     /*----------------------------------------------------------------*/
  460.     /*----------------------------------------------------------------*/
  461.     /* Code Body                                                      */
  462.     /*----------------------------------------------------------------*/
  463.     hdc = GetDC(hWnd);
  464.     hdcMem = CreateCompatibleDC(hdc);
  465.     hbmp = CreateCompatibleBitmap(hdc, LCD_WIDTH, LCD_HEIGHT);
  466.     SelectObject(hdcMem, hbmp);
  467.     if (simulator_frame_buffer != NULL)
  468.     {
  469.         SetDIBits(NULL, hbmp, 0, LCD_HEIGHT, simulator_frame_buffer, &bitmap_info, DIB_RGB_COLORS);
  470.     }
  471.     BitBlt(
  472.         hdc,
  473.         SIMULATOR_SKIN_LCD_X,
  474.         SIMULATOR_SKIN_LCD_Y,
  475.         SIMULATOR_SKIN_LCD_X + LCD_WIDTH,
  476.         SIMULATOR_SKIN_LCD_Y + LCD_HEIGHT,
  477.         hdcMem,
  478.         0,
  479.         0,
  480.         SRCCOPY);
  481.     ReleaseDC(hWnd, hdc);
  482.     DeleteDC(hdcMem);
  483.     DeleteObject(hbmp);
  484. #ifdef __MMI_SUBLCD__
  485.     hdc = GetDC(hWnd);
  486.     sub_hdcMem = CreateCompatibleDC(hdc);
  487.     sub_hbmp = CreateCompatibleBitmap(hdc, SUBLCD_WIDTH, SUBLCD_HEIGHT);
  488.     SelectObject(sub_hdcMem, sub_hbmp);
  489.     if (sub_simulator_frame_buffer != NULL)
  490.     {
  491.         SetDIBits(NULL, sub_hbmp, 0, SUBLCD_HEIGHT, sub_simulator_frame_buffer, &sub_bitmap_info, DIB_RGB_COLORS);
  492.     }
  493.     BitBlt(
  494.         hdc,
  495.         SIMULATOR_SKIN_SUB_LCD_X,
  496.         SIMULATOR_SKIN_SUB_LCD_Y,
  497.         SIMULATOR_SKIN_SUB_LCD_X + SUBLCD_WIDTH,
  498.         SIMULATOR_SKIN_SUB_LCD_Y + SUBLCD_HEIGHT,
  499.         sub_hdcMem,
  500.         0,
  501.         0,
  502.         SRCCOPY);
  503.     ReleaseDC(hWnd, hdc);
  504.     DeleteDC(sub_hdcMem);
  505.     DeleteObject(sub_hbmp);
  506. #endif /* __MMI_SUBLCD__ */ /* end of __MMI_SUBLCD__ */
  507. }   /* end of update_screen */
  508. /*****************************************************************************
  509.  * FUNCTION
  510.  *  win32_ui_set_layer_data
  511.  * DESCRIPTION
  512.  *  set the flag to indicate that a new application starts
  513.  * PARAMETERS
  514.  *  layer_index             [IN]        Index for the layer
  515.  *  lcd_id                  [IN]        Lcd id
  516.  *  text_clip_left          [IN]        Text clipping region info
  517.  *  text_clip_top           [IN]        Text clipping region info
  518.  *  text_clip_right         [IN]        Text clipping region info
  519.  *  text_clip_bottom        [IN]        Text clipping region info
  520.  *  gfx_clip_left           [IN]        Clipping region info
  521.  *  gfx_clip_top            [IN]        Clipping region info
  522.  *  gfx_clip_right          [IN]        Clipping region info
  523.  *  gfx_clip_bottom         [IN]        Clipping region info
  524.  *  current_handle          [IN]        Current lcd handle
  525.  *  active_handle           [IN]        Active lcd handle
  526.  * RETURNS
  527.  *  void
  528.  *****************************************************************************/
  529. void win32_ui_set_layer_data(
  530.         U8 layer_index,
  531.         U8 lcd_id,
  532.         S32 text_clip_left,
  533.         S32 text_clip_top,
  534.         S32 text_clip_right,
  535.         S32 text_clip_bottom,
  536.         S32 gfx_clip_left,
  537.         S32 gfx_clip_top,
  538.         S32 gfx_clip_right,
  539.         S32 gfx_clip_bottom,
  540.         S32 current_handle,
  541.         S32 active_handle)
  542. {
  543.     /*----------------------------------------------------------------*/
  544.     /* Local Variables                                                */
  545.     /*----------------------------------------------------------------*/
  546.     /*----------------------------------------------------------------*/
  547.     /* Code Body                                                      */
  548.     /*----------------------------------------------------------------*/
  549.     if (lcd_id == MAIN_LCD)
  550.     {
  551.         /* UIL := UI Layer */
  552.         uil_ptr = MODIS_UI_layer_ptr[layer_index];
  553.         uil_ptr->text_clip_left = text_clip_left;
  554.         uil_ptr->text_clip_top = text_clip_top;
  555.         uil_ptr->text_clip_right = text_clip_right;
  556.         uil_ptr->text_clip_bottom = text_clip_bottom;
  557.         uil_ptr->gfx_clip_left = gfx_clip_left;
  558.         uil_ptr->gfx_clip_top = gfx_clip_top;
  559.         uil_ptr->gfx_clip_right = gfx_clip_right;
  560.         uil_ptr->gfx_clip_bottom = gfx_clip_bottom;
  561.         if (current_handle == active_handle)
  562.         {
  563.             active_layer = layer_index;
  564.         }
  565.     }
  566. }   /* end of win32_ui_set_layer_data */
  567. /*****************************************************************************
  568.  * FUNCTION
  569.  *  lcd_fb_update
  570.  * DESCRIPTION
  571.  *  void
  572.  * PARAMETERS
  573.  *  lcd_para        [IN]        Lcd_frame_update_struct
  574.  * RETURNS
  575.  *  void
  576.  *****************************************************************************/
  577. void lcd_fb_update(lcd_frame_update_struct *lcd_para)
  578. {
  579.     /*----------------------------------------------------------------*/
  580.     /* Local Variables                                                */
  581.     /*----------------------------------------------------------------*/
  582.     U16 x, y;
  583.     U16 x_layer, y_layer;
  584.     U16 origin_pixel;
  585.     U16 layer_pixel;
  586.     U16 layer_pixel_index;  /* used for LUT */
  587.     U8 *index_ptr;          /* used for LUT, get index value */
  588.     U16 *buffer_ptr;
  589.     U16 *shadow_ptr;
  590.     BOOL source_enable;
  591.     BOOL opacity_enable;
  592.     BOOL LUT_enable;
  593.     U32 r, g, b;
  594.     U8 op_value;            /* opacity value */
  595.     U8 op_value_c;          /* opacity value complement */
  596.     U32 layer_flag_table[4];
  597.     U8 layer_id;
  598.     U8 skip;
  599.     U32 i, j;
  600.     color c;
  601.     U16 y1, y2, x1, x2;
  602.     S32 roi_width;
  603.     S32 roi_height;
  604.     U8 lcd_id;
  605.     U16 start_x;
  606.     U16 start_y;
  607.     U16 end_x;
  608.     U16 end_y;
  609.     U16 roi_offset_x;
  610.     U16 roi_offset_y;
  611.     DWORD update_layer;
  612.     U8 is_first_layer;
  613.     lcd_layer_struct *layer_ptr;    /* use this ptr to make code shorter */
  614.     /*----------------------------------------------------------------*/
  615.     /* Code Body                                                      */
  616.     /*----------------------------------------------------------------*/
  617.     if (IsLcdFirstInit != FALSE)
  618.     {
  619.         /* lcd_screen_init(hWnd, 0); */
  620.         IsLcdFirstInit = FALSE;
  621.     }
  622.     lcd_id = lcd_para->lcd_id;
  623.     start_x = lcd_para->lcm_start_x;
  624.     start_y = lcd_para->lcm_start_y;
  625.     end_x = lcd_para->lcm_end_x;
  626.     end_y = lcd_para->lcm_end_y;
  627.     roi_offset_x = lcd_para->roi_offset_x;
  628.     roi_offset_y = lcd_para->roi_offset_y;
  629.     update_layer = lcd_para->update_layer;
  630.     if (lcd_id == MAIN_LCD)
  631.     {
  632.         shadow_ptr = (U16*) simulator_shadow_buffer;
  633.     }
  634. #ifdef __MMI_SUBLCD__
  635.     else if (lcd_id == SUB_LCD)
  636.     {
  637.         shadow_ptr = (U16*) simulator_sub_shadow_buffer;
  638.     }
  639. #endif /* __MMI_SUBLCD__ */ 
  640.     /* create this table, so we can use for loop to prcess each layer */
  641.     layer_flag_table[0] = LCD_LAYER0_ENABLE;
  642.     layer_flag_table[1] = LCD_LAYER1_ENABLE;
  643.     layer_flag_table[2] = LCD_LAYER2_ENABLE;
  644.     layer_flag_table[3] = LCD_LAYER3_ENABLE;
  645.     roi_width = end_x - start_x;
  646.     roi_height = end_y - start_y;
  647.     /* copy base layer to shadow buffer directly for faster speed */
  648.     /* lcd_layer_data[0].offset_x */
  649.     /* 
  650.      * buffer_ptr = (U16 *)lcd_layer_data[0].frame_buffer_address;
  651.      * memcpy(shadow_ptr, buffer_ptr, LCD_WIDTH * LCD_HEIGHT * 2);
  652.      */
  653.     is_first_layer = 1;
  654.     for (layer_id = 0; layer_id < SIMULATOR_LAYER_COUNT; layer_id++)
  655.     {
  656.         /* set necessary data for MODIS UI displaying */
  657.         /* UIL := UI Layer */
  658.         if (lcd_id == MAIN_LCD)
  659.         {
  660.             uil_ptr = MODIS_UI_layer_ptr[layer_id];
  661.             uil_ptr->layer_x_offset = lcd_layer_data[layer_id].x_offset;
  662.             uil_ptr->layer_y_offset = lcd_layer_data[layer_id].y_offset;
  663.             uil_ptr->layer_width = lcd_layer_data[layer_id].column_number;
  664.             uil_ptr->layer_height = lcd_layer_data[layer_id].row_number;
  665.             uil_ptr->roi_x_offset = roi_offset_x;
  666.             uil_ptr->roi_y_offset = roi_offset_y;
  667.             uil_ptr->roi_width = roi_width;
  668.             uil_ptr->roi_height = roi_height;
  669.             uil_ptr->source_key_enable = lcd_layer_data[layer_id].source_key_enable;
  670.             uil_ptr->opacity_enable = lcd_layer_data[layer_id].opacity_enable;
  671.             uil_ptr->source_key = lcd_layer_data[layer_id].source_key;
  672.             uil_ptr->opacity_value = lcd_layer_data[layer_id].opacity_value;
  673.             uil_ptr->layer_enable = (update_layer & layer_flag_table[layer_id]);
  674.             uil_ptr->frame_buffer_address = lcd_layer_data[layer_id].frame_buffer_address;
  675.             uil_ptr->active_layer = active_layer;
  676.         }
  677.         /* check if this layer need to merge or not */
  678.         if ((update_layer & layer_flag_table[layer_id]) != 0)
  679.         {
  680.             buffer_ptr = (U16*) lcd_layer_data[layer_id].frame_buffer_address;
  681.             index_ptr = (U8*) lcd_layer_data[layer_id].frame_buffer_address;
  682.             layer_ptr = &lcd_layer_data[layer_id];
  683.             source_enable = layer_ptr->source_key_enable;
  684.             opacity_enable = layer_ptr->opacity_enable;
  685.             LUT_enable = layer_ptr->color_palette_enable;
  686.             /* for each pixel within region */
  687.             for (y = roi_offset_y; y <= roi_offset_y + roi_height; y++)
  688.             {
  689.                 for (x = roi_offset_x; x <= roi_offset_x + roi_width; x++)
  690.                 {
  691.                     skip = FALSE;
  692.                /***********************************************************/
  693.                     /* test if within region */
  694.                     if ((x >= layer_ptr->x_offset) &&
  695.                         (y >= layer_ptr->y_offset) &&
  696.                         (x <= layer_ptr->x_offset + layer_ptr->column_number - 1) &&
  697.                         (y <= layer_ptr->y_offset + layer_ptr->row_number - 1))
  698.                     {
  699.                         /* transform to layer's local coordinate */
  700.                         x_layer = x - layer_ptr->x_offset;
  701.                         y_layer = y - layer_ptr->y_offset;
  702.                         /* GDI_ASSERT(x - layer_ptr->x_offset>=0); */
  703.                         /* get original's pixel color */
  704.                         if (is_first_layer)
  705.                         {
  706.                         #ifdef GDI_USING_LAYER_BACKGROUND
  707.                             if (lcd_para->roi_background_color == 0)
  708.                             {
  709.                                 origin_pixel = 0;
  710.                             }
  711.                             else
  712.                             {
  713.                                 origin_pixel = 0xffff;
  714.                             }
  715.                         #else /* GDI_USING_LAYER_BACKGROUND */ 
  716.                             origin_pixel = 0xffff;
  717.                         #endif /* GDI_USING_LAYER_BACKGROUND */ 
  718.                         }
  719.                         else
  720.                         {
  721.                             if (lcd_id == MAIN_LCD)
  722.                             {
  723.                                 origin_pixel = BUF_PIXEL_DATA(
  724.                                                 shadow_ptr,
  725.                                                 x - roi_offset_x + start_x,
  726.                                                 y - roi_offset_y + start_y,
  727.                                                 LCD_WIDTH);
  728.                             }
  729.                         #ifdef __MMI_SUBLCD__
  730.                             else
  731.                             {
  732.                                 origin_pixel = BUF_PIXEL_DATA(
  733.                                                 shadow_ptr,
  734.                                                 x - roi_offset_x + start_x,
  735.                                                 y - roi_offset_y + start_y,
  736.                                                 SUBLCD_WIDTH);
  737.                             }
  738.                         #endif /* __MMI_SUBLCD__ */ 
  739.                         }
  740.                         /* get layer's pixel color, check if it use LUT */
  741.                         if (layer_ptr->color_palette_enable == KAL_TRUE)
  742.                         {
  743.                             /* get index, (U8) */
  744.                             layer_pixel_index = BUF_PIXEL_DATA(index_ptr, x_layer, y_layer, layer_ptr->column_number);
  745.                             /* ingore this error currently. just set index = 0 */
  746.                             if ((layer_pixel_index < 0) || (layer_pixel_index > 255))
  747.                             {
  748.                                 layer_pixel_index = 0;
  749.                             }
  750.                             /* this might contain error. but ignore. palette must be 0 or 1 */
  751.                             if (layer_ptr->color_palette_select == 0)
  752.                             {
  753.                                 layer_pixel = layer_sim_LUT0[layer_pixel_index];
  754.                             }
  755.                             else
  756.                             {
  757.                                 layer_pixel = layer_sim_LUT1[layer_pixel_index];
  758.                             }
  759.                         }
  760.                         else
  761.                         {
  762.                             U8 *b1 = GDI_LAYER.act_buf_ptr;
  763.                             S32 b2 = GDI_LAYER.act_pitch;
  764.                             GDI_LAYER.act_buf_ptr = (U8*) layer_ptr->frame_buffer_address;
  765.                             GDI_LAYER.act_pitch = layer_ptr->column_number;
  766.                             if (lcd_id == MAIN_LCD)
  767.                             {
  768.                                 DRV_MAINLCD_GET_BUFFER_PIXEL(x_layer, y_layer, layer_pixel);
  769.                             }
  770.                         #ifdef __MMI_SUBLCD__
  771.                             else
  772.                             {
  773.                                 DRV_SUBLCD_GET_BUFFER_PIXEL(x_layer, y_layer, layer_pixel);
  774.                             }
  775.                         #endif /* __MMI_SUBLCD__ */ 
  776.                             GDI_LAYER.act_buf_ptr = b1;
  777.                             GDI_LAYER.act_pitch = b2;
  778.                         }
  779.                         /* source key check - tansparency */
  780.                         if (source_enable == KAL_TRUE)
  781.                         {
  782.                             if (layer_ptr->source_key == layer_pixel)
  783.                             {
  784.                                 skip = KAL_TRUE;
  785.                             }
  786.                         }
  787.                         /* opacity check */
  788.                         if (skip == FALSE)
  789.                         {
  790.                             if (opacity_enable == KAL_TRUE)
  791.                             {
  792.                                 /* calc opacity ratio */
  793.                             #ifdef LCD_MAX_OPACITY
  794.                                 op_value = layer_ptr->opacity_value * 255 / LCD_MAX_OPACITY;
  795.                             #else 
  796.                                 op_value = layer_ptr->opacity_value << 3;
  797.                             #endif 
  798.                                 op_value_c = ~op_value;
  799.                                 if (op_value != 0)
  800.                                 {
  801.                                     if (lcd_id == MAIN_LCD)
  802.                                     {
  803.                                         r = HW_TO_RGB_R(origin_pixel) * op_value_c +
  804.                                             DRV_HW_TO_RGB_R(layer_pixel) * op_value;
  805.                                         g = HW_TO_RGB_G(origin_pixel) * op_value_c +
  806.                                             DRV_HW_TO_RGB_G(layer_pixel) * op_value;
  807.                                         b = HW_TO_RGB_B(origin_pixel) * op_value_c +
  808.                                             DRV_HW_TO_RGB_B(layer_pixel) * op_value;
  809.                                     }
  810.                                 #ifdef __MMI_SUBLCD__
  811.                                     else
  812.                                     {
  813.                                         r = HW_TO_RGB_R(origin_pixel) * op_value_c +
  814.                                             HW_FORMAT_TO_SUBMMI_R(layer_pixel) * op_value;
  815.                                         g = HW_TO_RGB_G(origin_pixel) * op_value_c +
  816.                                             HW_FORMAT_TO_SUBMMI_G(layer_pixel) * op_value;
  817.                                         b = HW_TO_RGB_B(origin_pixel) * op_value_c +
  818.                                             HW_FORMAT_TO_SUBMMI_B(layer_pixel) * op_value;
  819.                                     }
  820.                                 #endif /* __MMI_SUBLCD__ */ 
  821.                                     r >>= 8;
  822.                                     g >>= 8;
  823.                                     b >>= 8;
  824.                                     origin_pixel = (U16) RGB_TO_HW(r, g, b);
  825.                                 }
  826.                             }
  827.                             else
  828.                             {
  829.                                 if (lcd_id == MAIN_LCD)
  830.                                 {
  831.                                     r = DRV_HW_TO_RGB_R(layer_pixel);
  832.                                     g = DRV_HW_TO_RGB_G(layer_pixel);
  833.                                     b = DRV_HW_TO_RGB_B(layer_pixel);
  834.                                 }
  835.                             #ifdef __MMI_SUBLCD__
  836.                                 else
  837.                                 {
  838.                                     r = HW_FORMAT_TO_SUBMMI_R(layer_pixel);
  839.                                     g = HW_FORMAT_TO_SUBMMI_G(layer_pixel);
  840.                                     b = HW_FORMAT_TO_SUBMMI_B(layer_pixel);
  841.                                 }
  842.                             #endif /* __MMI_SUBLCD__ */ 
  843.                                 origin_pixel = (U16) RGB_TO_HW(r, g, b);
  844.                             }
  845.                         }
  846.                         /* write back to shadow buffer */
  847.                         if (lcd_id == MAIN_LCD)
  848.                         {
  849.                             BUF_PIXEL_DATA(shadow_ptr, x - roi_offset_x + start_x, y - roi_offset_y + start_y, LCD_WIDTH) = origin_pixel;       /* 040105 JF modified */
  850.                         }
  851.                     #ifdef __MMI_SUBLCD__
  852.                         else
  853.                         {
  854.                             BUF_PIXEL_DATA(shadow_ptr, x - roi_offset_x + start_x, y - roi_offset_y + start_y, SUBLCD_WIDTH) = origin_pixel;    /* 040105 JF modified */
  855.                         }
  856.                     #endif /* __MMI_SUBLCD__ */ 
  857.                   /***********************************************************/
  858.                     }   /* if within region */
  859.                 }       /* for loop  x */
  860.             }           /* for loop - y */
  861.             is_first_layer = 0;
  862.         }               /* if flag */
  863.     }                   /* for each layer */
  864.     /* send the main-lcd information to MODIS_UI for displaying */
  865.     if (lcd_id == MAIN_LCD)
  866.     {
  867.         set_MODIS_UI_layer_data(
  868.             MODIS_UI_layer_ptr,
  869.             LCD_WIDTH,
  870.             LCD_HEIGHT,
  871.             SIMULATOR_LAYER_COUNT,
  872.             &new_application_flag);
  873.     }
  874.     /* draw to dc */
  875.     if (lcd_id == MAIN_LCD)
  876.     {
  877.         /* draw to simulator's main LCD region */
  878.         hdc = GetDC(hWnd);
  879.         hdcMem = CreateCompatibleDC(hdc);
  880.         hbmp = CreateCompatibleBitmap(hdc, LCD_WIDTH, LCD_HEIGHT);
  881.         SelectObject(hdcMem, hbmp);
  882.         y1 = 0;
  883.         y2 = LCD_WIDTH - 1;
  884.         x1 = 0;
  885.         x2 = LCD_HEIGHT - 1;
  886.         for (i = 0; i < LCD_HEIGHT; i++)
  887.         {
  888.             for (j = 0; j < LCD_WIDTH; j++)
  889.             {
  890.                 c.r = HW_TO_RGB_R(simulator_shadow_buffer[i * LCD_WIDTH + j]);
  891.                 c.g = HW_TO_RGB_G(simulator_shadow_buffer[i * LCD_WIDTH + j]);
  892.                 c.b = HW_TO_RGB_B(simulator_shadow_buffer[i * LCD_WIDTH + j]);
  893.                 c.alpha = 100;
  894.                 /* SetPixel(hdcMem, j, i ,RGB(c.r, c.g, c.b)); */
  895.                 BUF_PIXEL_DATA(simulator_frame_buffer, j, LCD_HEIGHT - 1 - i, LCD_WIDTH) = RGB(c.b, c.g, c.r);
  896.             }
  897.         }
  898.         SetDIBits(NULL, hbmp, 0, LCD_HEIGHT, simulator_frame_buffer, &bitmap_info, DIB_RGB_COLORS);
  899.         BitBlt(
  900.             hdc,
  901.             SIMULATOR_SKIN_LCD_X,
  902.             SIMULATOR_SKIN_LCD_Y,
  903.             SIMULATOR_SKIN_LCD_X + LCD_WIDTH,
  904.             SIMULATOR_SKIN_LCD_Y + LCD_HEIGHT,
  905.             hdcMem,
  906.             0,
  907.             0,
  908.             SRCCOPY);
  909.         ReleaseDC(hWnd, hdc);
  910.         DeleteDC(hdcMem);
  911.         DeleteObject(hbmp);
  912.     }
  913. #ifdef __MMI_SUBLCD__
  914.     else if (lcd_id == SUB_LCD)
  915.     {
  916.         /* draw to simulator's sub LCD region */
  917.         hdc = GetDC(hWnd);
  918.         sub_hdcMem = CreateCompatibleDC(hdc);
  919.         sub_hbmp = CreateCompatibleBitmap(hdc, SUBLCD_WIDTH, SUBLCD_HEIGHT);
  920.         SelectObject(sub_hdcMem, sub_hbmp);
  921.         y1 = 0;
  922.         y2 = SUBLCD_WIDTH - 1;
  923.         x1 = 0;
  924.         x2 = SUBLCD_HEIGHT - 1;
  925.         for (i = 0; i < SUBLCD_HEIGHT; i++)
  926.         {
  927.             for (j = 0; j < SUBLCD_WIDTH; j++)
  928.             {
  929.                 c.r = HW_TO_RGB_R(simulator_sub_shadow_buffer[i * SUBLCD_WIDTH + j]);
  930.                 c.g = HW_TO_RGB_G(simulator_sub_shadow_buffer[i * SUBLCD_WIDTH + j]);
  931.                 c.b = HW_TO_RGB_B(simulator_sub_shadow_buffer[i * SUBLCD_WIDTH + j]);
  932.                 c.alpha = 100;
  933.                 /* SetPixel(sub_hdcMem, j, i ,RGB(c.r, c.g, c.b)); */
  934.                 BUF_PIXEL_DATA(sub_simulator_frame_buffer, j, SUBLCD_HEIGHT - 1 - i, SUBLCD_WIDTH) = RGB(c.b, c.g, c.r);
  935.             }
  936.         }
  937.         SetDIBits(NULL, sub_hbmp, 0, SUBLCD_HEIGHT, sub_simulator_frame_buffer, &sub_bitmap_info, DIB_RGB_COLORS);
  938.         BitBlt(
  939.             hdc,
  940.             SIMULATOR_SKIN_SUB_LCD_X,
  941.             SIMULATOR_SKIN_SUB_LCD_Y,
  942.             SIMULATOR_SKIN_SUB_LCD_X + SUBLCD_WIDTH,
  943.             SIMULATOR_SKIN_SUB_LCD_Y + SUBLCD_HEIGHT,
  944.             sub_hdcMem,
  945.             0,
  946.             0,
  947.             SRCCOPY);
  948.         ReleaseDC(hWnd, hdc);
  949.         DeleteDC(sub_hdcMem);
  950.         DeleteObject(sub_hbmp);
  951.     }
  952. #endif /* __MMI_SUBLCD__ */ 
  953. }   /* end of lcd_fb_update */
  954. /*****************************************************************************
  955.  * FUNCTION
  956.  *  config_lcd_roi_window
  957.  * DESCRIPTION
  958.  *  void
  959.  * PARAMETERS
  960.  *  roi_x_offset        [IN]        U16
  961.  *  roi_y_offset        [IN]        Kal_uint16
  962.  *  roi_column          [IN]        Kal_uint16
  963.  *  roi_row             [IN]        Kal_uint16
  964.  * RETURNS
  965.  * TRUE
  966.  *****************************************************************************/
  967. kal_bool config_lcd_roi_window(U16 roi_x_offset, kal_uint16 roi_y_offset, kal_uint16 roi_column, kal_uint16 roi_row)
  968. {
  969.     /*----------------------------------------------------------------*/
  970.     /* Local Variables                                                */
  971.     /*----------------------------------------------------------------*/
  972.     /*----------------------------------------------------------------*/
  973.     /* Code Body                                                      */
  974.     /*----------------------------------------------------------------*/
  975.     return KAL_TRUE;
  976. }   /* end of config_lcd_roi_window */
  977. /*****************************************************************************
  978.  * FUNCTION
  979.  *  lcd_init
  980.  * DESCRIPTION
  981.  *  void
  982.  * PARAMETERS
  983.  *  lcd_id                  [IN]        Kal_uint8
  984.  *  background_color        [IN]        Kal_uint16
  985.  * RETURNS
  986.  *  void
  987.  *****************************************************************************/
  988. void lcd_init(kal_uint8 lcd_id, kal_uint16 background_color)
  989. {
  990.     /*----------------------------------------------------------------*/
  991.     /* Local Variables                                                */
  992.     /*----------------------------------------------------------------*/
  993.     /*----------------------------------------------------------------*/
  994.     /* Code Body                                                      */
  995.     /*----------------------------------------------------------------*/
  996. }   /* end of lcd_init */
  997. /*****************************************************************************
  998.  * FUNCTION
  999.  *  lcd_sleep_in
  1000.  * DESCRIPTION
  1001.  *  void
  1002.  * PARAMETERS
  1003.  *  lcd_id      [IN]        Kal_uint8
  1004.  * RETURNS
  1005.  *  void
  1006.  *****************************************************************************/
  1007. void lcd_sleep_in(kal_uint8 lcd_id)
  1008. {
  1009.     /*----------------------------------------------------------------*/
  1010.     /* Local Variables                                                */
  1011.     /*----------------------------------------------------------------*/
  1012.     /*----------------------------------------------------------------*/
  1013.     /* Code Body                                                      */
  1014.     /*----------------------------------------------------------------*/
  1015. }   /* end of lcd_sleep_in */
  1016. /*****************************************************************************
  1017.  * FUNCTION
  1018.  *  lcd_sleep_out
  1019.  * DESCRIPTION
  1020.  *  void
  1021.  * PARAMETERS
  1022.  *  lcd_id      [IN]        Kal_uint8
  1023.  * RETURNS
  1024.  *  void
  1025.  *****************************************************************************/
  1026. void lcd_sleep_out(kal_uint8 lcd_id)
  1027. {
  1028.     /*----------------------------------------------------------------*/
  1029.     /* Local Variables                                                */
  1030.     /*----------------------------------------------------------------*/
  1031.     /*----------------------------------------------------------------*/
  1032.     /* Code Body                                                      */
  1033.     /*----------------------------------------------------------------*/
  1034. }   /* end of lcd_sleep_out */
  1035. /*****************************************************************************
  1036.  * FUNCTION
  1037.  *  lcd_partial_on
  1038.  * DESCRIPTION
  1039.  *  void
  1040.  * PARAMETERS
  1041.  *  lcd_id          [IN]        Kal_uint8
  1042.  *  start_line      [IN]        Kal_uint16
  1043.  *  end_line        [IN]        Kal_uint16
  1044.  * RETURNS
  1045.  *  void
  1046.  *****************************************************************************/
  1047. void lcd_partial_on(kal_uint8 lcd_id, kal_uint16 start_line, kal_uint16 end_line)
  1048. {
  1049.     /*----------------------------------------------------------------*/
  1050.     /* Local Variables                                                */
  1051.     /*----------------------------------------------------------------*/
  1052.     /*----------------------------------------------------------------*/
  1053.     /* Code Body                                                      */
  1054.     /*----------------------------------------------------------------*/
  1055. }   /* end of lcd_partial_on */
  1056. /*****************************************************************************
  1057.  * FUNCTION
  1058.  *  lcd_partial_off
  1059.  * DESCRIPTION
  1060.  *  void
  1061.  * PARAMETERS
  1062.  *  lcd_id      [IN]        Kal_uint8
  1063.  * RETURNS
  1064.  *  void
  1065.  *****************************************************************************/
  1066. void lcd_partial_off(kal_uint8 lcd_id)
  1067. {
  1068.     /*----------------------------------------------------------------*/
  1069.     /* Local Variables                                                */
  1070.     /*----------------------------------------------------------------*/
  1071.     /*----------------------------------------------------------------*/
  1072.     /* Code Body                                                      */
  1073.     /*----------------------------------------------------------------*/
  1074. }   /* end of lcd_partial_off */
  1075. /*****************************************************************************
  1076.  * FUNCTION
  1077.  *  lcd_bright_level
  1078.  * DESCRIPTION
  1079.  *  void
  1080.  * PARAMETERS
  1081.  *  lcd_id              [IN]        Kal_uint8
  1082.  *  bright_level        [IN]        Kal_uint8
  1083.  * RETURNS
  1084.  *  void
  1085.  *****************************************************************************/
  1086. void lcd_bright_level(kal_uint8 lcd_id, kal_uint8 bright_level)
  1087. {
  1088.     /*----------------------------------------------------------------*/
  1089.     /* Local Variables                                                */
  1090.     /*----------------------------------------------------------------*/
  1091.     /*----------------------------------------------------------------*/
  1092.     /* Code Body                                                      */
  1093.     /*----------------------------------------------------------------*/
  1094. }   /* end of lcd_bright_level */
  1095. /*****************************************************************************
  1096.  * FUNCTION
  1097.  *  lcd_power_on
  1098.  * DESCRIPTION
  1099.  *  void
  1100.  * PARAMETERS
  1101.  *  lcd_id      [IN]        Kal_uint8
  1102.  *  on          [IN]        Kal_bool
  1103.  * RETURNS
  1104.  *  void
  1105.  *****************************************************************************/
  1106. void lcd_power_on(kal_uint8 lcd_id, kal_bool on)
  1107. {
  1108.     /*----------------------------------------------------------------*/
  1109.     /* Local Variables                                                */
  1110.     /*----------------------------------------------------------------*/
  1111.     /*----------------------------------------------------------------*/
  1112.     /* Code Body                                                      */
  1113.     /*----------------------------------------------------------------*/
  1114. }   /* end of lcd_power_on */
  1115. /*****************************************************************************
  1116.  * FUNCTION
  1117.  *  lcd_screen_on
  1118.  * DESCRIPTION
  1119.  *  void
  1120.  * PARAMETERS
  1121.  *  lcd_id      [IN]        Kal_uint8
  1122.  *  on          [IN]        Kal_bool
  1123.  * RETURNS
  1124.  *  void
  1125.  *****************************************************************************/
  1126. void lcd_screen_on(kal_uint8 lcd_id, kal_bool on)
  1127. {
  1128.     /*----------------------------------------------------------------*/
  1129.     /* Local Variables                                                */
  1130.     /*----------------------------------------------------------------*/
  1131.     /*----------------------------------------------------------------*/
  1132.     /* Code Body                                                      */
  1133.     /*----------------------------------------------------------------*/
  1134. }   /* end of lcd_screen_on */
  1135. /*****************************************************************************
  1136.  * FUNCTION
  1137.  *  lcd_get_parameter
  1138.  * DESCRIPTION
  1139.  *  void
  1140.  * PARAMETERS
  1141.  *  lcd_id      [IN]        Kal_uint8
  1142.  *  type        [IN]        Lcd_func_type
  1143.  * RETURNS
  1144.  *  0
  1145.  *****************************************************************************/
  1146. kal_uint8 lcd_get_parameter(kal_uint8 lcd_id, lcd_func_type type)
  1147. {
  1148.     /*----------------------------------------------------------------*/
  1149.     /* Local Variables                                                */
  1150.     /*----------------------------------------------------------------*/
  1151.     /*----------------------------------------------------------------*/
  1152.     /* Code Body                                                      */
  1153.     /*----------------------------------------------------------------*/
  1154.     return 0;
  1155. }   /* end of lcd_get_parameter */
  1156. /*****************************************************************************
  1157.  * FUNCTION
  1158.  *  lcd_get_size
  1159.  * DESCRIPTION
  1160.  *  void
  1161.  * PARAMETERS
  1162.  *  lcd_id          [IN]        Kal_uint8
  1163.  *  lcd_width       [IN]        Kal_uint16 *
  1164.  *  lcd_height      [IN]        Kal_uint16 *
  1165.  * RETURNS
  1166.  *  void
  1167.  *****************************************************************************/
  1168. void lcd_get_size(kal_uint8 lcd_id, kal_uint16 *lcd_width, kal_uint16 *lcd_height)
  1169. {
  1170.     /*----------------------------------------------------------------*/
  1171.     /* Local Variables                                                */
  1172.     /*----------------------------------------------------------------*/
  1173.     /*----------------------------------------------------------------*/
  1174.     /* Code Body                                                      */
  1175.     /*----------------------------------------------------------------*/
  1176. }   /* end of lcd_get_size */
  1177. /*****************************************************************************
  1178.  * FUNCTION
  1179.  *  lcd_set_bias
  1180.  * DESCRIPTION
  1181.  *  void
  1182.  * PARAMETERS
  1183.  *  lcd_id      [IN]        Kal_uint8
  1184.  *  bias        [IN]        Kal_uint8 *
  1185.  * RETURNS
  1186.  *  void
  1187.  *****************************************************************************/
  1188. void lcd_set_bias(kal_uint8 lcd_id, kal_uint8 *bias)
  1189. {
  1190.     /*----------------------------------------------------------------*/
  1191.     /* Local Variables                                                */
  1192.     /*----------------------------------------------------------------*/
  1193.     /*----------------------------------------------------------------*/
  1194.     /* Code Body                                                      */
  1195.     /*----------------------------------------------------------------*/
  1196. }   /* end of lcd_set_bias */
  1197. /*****************************************************************************
  1198.  * FUNCTION
  1199.  *  lcd_set_contrast
  1200.  * DESCRIPTION
  1201.  *  void
  1202.  * PARAMETERS
  1203.  *  lcd_id          [IN]        Kal_uint8
  1204.  *  contrast        [IN]        Kal_uint8 *
  1205.  * RETURNS
  1206.  *  void
  1207.  *****************************************************************************/
  1208. void lcd_set_contrast(kal_uint8 lcd_id, kal_uint8 *contrast)
  1209. {
  1210.     /*----------------------------------------------------------------*/
  1211.     /* Local Variables                                                */
  1212.     /*----------------------------------------------------------------*/
  1213.     /*----------------------------------------------------------------*/
  1214.     /* Code Body                                                      */
  1215.     /*----------------------------------------------------------------*/
  1216. }   /* end of lcd_set_contrast */
  1217. /*****************************************************************************
  1218.  * FUNCTION
  1219.  *  lcd_set_linerate
  1220.  * DESCRIPTION
  1221.  *  void
  1222.  * PARAMETERS
  1223.  *  lcd_id          [IN]        Kal_uint8
  1224.  *  linereate       [IN]        Kal_uint8 *
  1225.  * RETURNS
  1226.  *  void
  1227.  *****************************************************************************/
  1228. void lcd_set_linerate(kal_uint8 lcd_id, kal_uint8 *linereate)
  1229. {
  1230.     /*----------------------------------------------------------------*/
  1231.     /* Local Variables                                                */
  1232.     /*----------------------------------------------------------------*/
  1233.     /*----------------------------------------------------------------*/
  1234.     /* Code Body                                                      */
  1235.     /*----------------------------------------------------------------*/
  1236. }   /* end of lcd_set_linerate */
  1237. /*****************************************************************************
  1238.  * FUNCTION
  1239.  *  lcd_set_temp_compensate
  1240.  * DESCRIPTION
  1241.  *  void
  1242.  * PARAMETERS
  1243.  *  lcd_id          [IN]        Kal_uint8
  1244.  *  compensate      [IN]        Kal_uint8 *
  1245.  * RETURNS
  1246.  *  void
  1247.  *****************************************************************************/
  1248. void lcd_set_temp_compensate(kal_uint8 lcd_id, kal_uint8 *compensate)
  1249. {
  1250.     /*----------------------------------------------------------------*/
  1251.     /* Local Variables                                                */
  1252.     /*----------------------------------------------------------------*/
  1253.     /*----------------------------------------------------------------*/
  1254.     /* Code Body                                                      */
  1255.     /*----------------------------------------------------------------*/
  1256. }   /* end of lcd_set_temp_compensate */
  1257. /*****************************************************************************
  1258.  * FUNCTION
  1259.  *  lcd_cmd_update
  1260.  * DESCRIPTION
  1261.  *  void
  1262.  * PARAMETERS
  1263.  *  lcd_id              [IN]        Kal_uint8
  1264.  *  start_x             [IN]        Kal_uint16
  1265.  *  start_y             [IN]        Kal_uint16
  1266.  *  end_x               [IN]        Kal_uint16
  1267.  *  end_y               [IN]        Kal_uint16
  1268.  *  roi_offset_x        [IN]        Kal_uint16
  1269.  *  roi_offset_y        [IN]        Kal_uint16
  1270.  *  update_layer        [IN]        Kal_uint32
  1271.  * RETURNS
  1272.  *  void
  1273.  *****************************************************************************/
  1274. void lcd_cmd_update(
  1275.         kal_uint8 lcd_id,
  1276.         kal_uint16 start_x,
  1277.         kal_uint16 start_y,
  1278.         kal_uint16 end_x,
  1279.         kal_uint16 end_y,
  1280.         kal_uint16 roi_offset_x,
  1281.         kal_uint16 roi_offset_y,
  1282.         kal_uint32 update_layer)
  1283. {
  1284.     /*----------------------------------------------------------------*/
  1285.     /* Local Variables                                                */
  1286.     /*----------------------------------------------------------------*/
  1287.     /*----------------------------------------------------------------*/
  1288.     /* Code Body                                                      */
  1289.     /*----------------------------------------------------------------*/
  1290. }   /* end of lcd_cmd_update */
  1291. /*****************************************************************************
  1292.  * FUNCTION
  1293.  *  win32_ui_set_new_application_flag
  1294.  * DESCRIPTION
  1295.  *  set the flag to indicate that a new application starts
  1296.  * PARAMETERS
  1297.  *  void
  1298.  * RETURNS
  1299.  *  void
  1300.  *****************************************************************************/
  1301. void win32_ui_set_new_application_flag()
  1302. {
  1303.     /*----------------------------------------------------------------*/
  1304.     /* Local Variables                                                */
  1305.     /*----------------------------------------------------------------*/
  1306.     /*----------------------------------------------------------------*/
  1307.     /* Code Body                                                      */
  1308.     /*----------------------------------------------------------------*/
  1309.     new_application_flag = 1;
  1310. }   /* end of win32_ui_set_new_application_flag */
  1311. /*****************************************************************************
  1312.  * FUNCTION
  1313.  *  set_lcd_color_palette
  1314.  * DESCRIPTION
  1315.  *  
  1316.  * PARAMETERS
  1317.  *  color_palette_select        [IN]        
  1318.  *  color_palette_addr_ptr      [?]         
  1319.  *  start_index                 [IN]        
  1320.  *  number_of_color             [IN]        
  1321.  * RETURNS
  1322.  *  void
  1323.  *****************************************************************************/
  1324. void set_lcd_color_palette(
  1325.         kal_uint8 color_palette_select,
  1326.         kal_uint32 *color_palette_addr_ptr,
  1327.         kal_uint8 start_index,
  1328.         kal_uint8 number_of_color)
  1329. {
  1330.     /*----------------------------------------------------------------*/
  1331.     /* Local Variables                                                */
  1332.     /*----------------------------------------------------------------*/
  1333.     /*----------------------------------------------------------------*/
  1334.     /* Code Body                                                      */
  1335.     /*----------------------------------------------------------------*/
  1336. }
  1337. /*****************************************************************************
  1338.  * FUNCTION
  1339.  *  config_lcd_output
  1340.  * DESCRIPTION
  1341.  *  
  1342.  * PARAMETERS
  1343.  *  lcd_output      [IN]        
  1344.  * RETURNS
  1345.  *  void
  1346.  *****************************************************************************/
  1347. void config_lcd_output(kal_bool lcd_output)
  1348. {
  1349.     /*----------------------------------------------------------------*/
  1350.     /* Local Variables                                                */
  1351.     /*----------------------------------------------------------------*/
  1352.     /*----------------------------------------------------------------*/
  1353.     /* Code Body                                                      */
  1354.     /*----------------------------------------------------------------*/
  1355. }
  1356. #endif /* _MAINLCD_C */