Showing
3 changed files
with
1424 additions
and
8 deletions
custom/drv/LCD/KEYTAK61D_GB_11C_LCM/combo_lcm.c
100644 → 100755
| ... | ... | @@ -127,7 +127,12 @@ void spi_ini(void) |
| 127 | 127 | case GC9304: |
| 128 | 128 | spi_ini_GC9304(); |
| 129 | 129 | break; |
| 130 | - #endif | |
| 130 | + #endif | |
| 131 | + #if defined(__TOPWELL_HW_LCD_IC_GC9305__) | |
| 132 | + case GC9305: | |
| 133 | + spi_ini_GC9305(); | |
| 134 | + break; | |
| 135 | + #endif | |
| 131 | 136 | #if defined(__TOPWELL_HW_LCD_IC_ILI9340L__) |
| 132 | 137 | case ILI9340L: |
| 133 | 138 | spi_ini_ILI9340L(); |
| ... | ... | @@ -261,6 +266,12 @@ void init_lcd_interface(void) |
| 261 | 266 | init_lcd_interface_GC9304(); |
| 262 | 267 | break; |
| 263 | 268 | #endif |
| 269 | + | |
| 270 | + #if defined(__TOPWELL_HW_LCD_IC_GC9305__) | |
| 271 | + case GC9305: | |
| 272 | + init_lcd_interface_GC9305(); | |
| 273 | + break; | |
| 274 | + #endif | |
| 264 | 275 | |
| 265 | 276 | #if defined(__TOPWELL_HW_LCD_IC_ILI9340L__) |
| 266 | 277 | case ILI9340L: |
| ... | ... | @@ -393,7 +404,14 @@ void LCD_FunConfig(void) |
| 393 | 404 | case GC9304: |
| 394 | 405 | LCD_FunConfig_GC9304(); |
| 395 | 406 | break; |
| 396 | - #endif | |
| 407 | + #endif | |
| 408 | + | |
| 409 | + #if defined(__TOPWELL_HW_LCD_IC_GC9305__) | |
| 410 | + case GC9305: | |
| 411 | + LCD_FunConfig_GC9305(); | |
| 412 | + break; | |
| 413 | + #endif | |
| 414 | + | |
| 397 | 415 | #if defined(__TOPWELL_HW_LCD_IC_ILI9340L__) |
| 398 | 416 | case ILI9340L: |
| 399 | 417 | LCD_FunConfig_ILI9340L(); |
| ... | ... | @@ -528,6 +546,12 @@ void LCD_gamma_test(kal_uint8 level, kal_uint8 color) |
| 528 | 546 | LCD_gamma_test_GC9304(level, color); |
| 529 | 547 | break; |
| 530 | 548 | #endif |
| 549 | + | |
| 550 | + #if defined(__TOPWELL_HW_LCD_IC_GC9305__) | |
| 551 | + case GC9305: | |
| 552 | + LCD_gamma_test_GC9305(level, color); | |
| 553 | + break; | |
| 554 | + #endif | |
| 531 | 555 | |
| 532 | 556 | #if defined(__TOPWELL_HW_LCD_IC_ILI9340L__) |
| 533 | 557 | case ILI9340L: |
| ... | ... | @@ -660,7 +684,13 @@ void LCD_flicker_test(kal_uint8 level) |
| 660 | 684 | case GC9304: |
| 661 | 685 | LCD_flicker_test_GC9304(level); |
| 662 | 686 | break; |
| 663 | - #endif | |
| 687 | + #endif | |
| 688 | + | |
| 689 | + #if defined(__TOPWELL_HW_LCD_IC_GC9305__) | |
| 690 | + case GC9305: | |
| 691 | + LCD_flicker_test_GC9305(level); | |
| 692 | + break; | |
| 693 | + #endif | |
| 664 | 694 | |
| 665 | 695 | #if defined(__TOPWELL_HW_LCD_IC_ILI9340L__) |
| 666 | 696 | case ILI9340L: |
| ... | ... | @@ -794,6 +824,11 @@ kal_bool LCM_ID_Validation(void) |
| 794 | 824 | return LCM_ID_check_GC9304(); |
| 795 | 825 | #endif |
| 796 | 826 | |
| 827 | + #if defined(__TOPWELL_HW_LCD_IC_GC9305__) | |
| 828 | + case GC9305: | |
| 829 | + return LCM_ID_check_GC9305(); | |
| 830 | + #endif | |
| 831 | + | |
| 797 | 832 | |
| 798 | 833 | #if defined(__TOPWELL_HW_LCD_IC_ILI9340L__) |
| 799 | 834 | case ILI9340L: |
| ... | ... | @@ -907,6 +942,9 @@ void Get_LCM_ALLID_String(U8 *get_buf) |
| 907 | 942 | #if defined(__TOPWELL_HW_LCD_IC_GC9304__) |
| 908 | 943 | mmi_ucs2cat((CHAR*) get_buf, (const CHAR*)L"GC9304\n"); |
| 909 | 944 | #endif |
| 945 | +#if defined(__TOPWELL_HW_LCD_IC_GC9305__) | |
| 946 | + mmi_ucs2cat((CHAR*) get_buf, (const CHAR*)L"GC9305\n"); | |
| 947 | +#endif | |
| 910 | 948 | #if defined(__TOPWELL_HW_LCD_IC_ILI9340L__) |
| 911 | 949 | mmi_ucs2cat((CHAR*) get_buf, (const CHAR*)L"ILI9340L\n"); |
| 912 | 950 | #endif |
| ... | ... | @@ -1008,6 +1046,11 @@ kal_uint8* Get_LCM_ID_String(void) |
| 1008 | 1046 | return "GC9304"; |
| 1009 | 1047 | #endif |
| 1010 | 1048 | |
| 1049 | + #if defined(__TOPWELL_HW_LCD_IC_GC9305__) | |
| 1050 | + case GC9305: | |
| 1051 | + return "GC9305"; | |
| 1052 | + #endif | |
| 1053 | + | |
| 1011 | 1054 | |
| 1012 | 1055 | #if defined(__TOPWELL_HW_LCD_IC_ILI9340L__) |
| 1013 | 1056 | case ILI9340L: | ... | ... |
| 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) 2001 | |
| 8 | +* | |
| 9 | +*****************************************************************************/ | |
| 10 | + | |
| 11 | +/***************************************************************************** | |
| 12 | + * | |
| 13 | + * Filename: | |
| 14 | + * --------- | |
| 15 | + * lcd.c | |
| 16 | + * | |
| 17 | + * Project: | |
| 18 | + * -------- | |
| 19 | + * Maui_Software | |
| 20 | + * | |
| 21 | + * Description: | |
| 22 | + * ------------ | |
| 23 | + * This Module defines the LCD driver. | |
| 24 | + * | |
| 25 | + * Author: | |
| 26 | + * ------- | |
| 27 | + * ------- | |
| 28 | + * | |
| 29 | + ****************************************************************************/ | |
| 30 | +#ifdef FPGA | |
| 31 | +#include "lcd_feature.h" | |
| 32 | +#include "typedefs.h" | |
| 33 | +#include "dma_maui_api.h" | |
| 34 | + | |
| 35 | +#include "hw_reg.h" | |
| 36 | +#include "lcm_if.h" | |
| 37 | +#include "lcd_if.h" | |
| 38 | +#include "lcd_sw_inc.h" | |
| 39 | +#include "lcd_sw.h" | |
| 40 | +#include "lcd_hw.h" | |
| 41 | +#pragma arm section code="SDRAMCODE" | |
| 42 | + | |
| 43 | +#else | |
| 44 | +#include "drv_comm.h" | |
| 45 | +#include "reg_base.h" | |
| 46 | +#include "lcd_sw_inc.h" | |
| 47 | +#include "lcd_sw.h" | |
| 48 | +#include "lcd_hw.h" | |
| 49 | +/*Serial interface*/ | |
| 50 | +#include "lcd_if_hw.h" | |
| 51 | +#include "lcm_if.h" | |
| 52 | +#include "lcd_if.h" | |
| 53 | +#include "eint.h" | |
| 54 | +#endif | |
| 55 | +#include "dcl.h" | |
| 56 | +#include "kal_release.h" | |
| 57 | +#include "drv_features_display.h" | |
| 58 | +#include "drv_sw_features_display.h" | |
| 59 | +#include "drv_comm.h" | |
| 60 | +#include "reg_base.h" | |
| 61 | +#include "lcd_sw.h" | |
| 62 | +#include "lcd_sw_inc.h" | |
| 63 | +#include "lcd_if_hw.h" | |
| 64 | +#include "lcd_if.h" | |
| 65 | +#include "lcd_if_manager.h" | |
| 66 | +#include "custom_EMI_release.h" | |
| 67 | +#include "nld_central_ctrl.h" | |
| 68 | + | |
| 69 | +#if defined(__TOPWELL_HW_LCD_240X320_T3212_GC9305_IVO__) | |
| 70 | + | |
| 71 | +#ifdef LCD_CMD_DMA_MODE | |
| 72 | + #define LCD_delay_GC9305() | |
| 73 | + | |
| 74 | + #if (defined(MAIN_LCD_8BIT_MODE)) | |
| 75 | + #define LCD_CtrlWrite_GC9305(_data) \ | |
| 76 | + {\ | |
| 77 | + SET_LCD_CMD_PARAMETER(0,LCD_CMD,(_data));\ | |
| 78 | + LCD_SEND_DMA_CMD(1);\ | |
| 79 | + }\ | |
| 80 | + | |
| 81 | + #define LCD_DataWrite_GC9305(_data) \ | |
| 82 | + {\ | |
| 83 | + SET_LCD_CMD_PARAMETER(0,LCD_DATA,(_data));\ | |
| 84 | + LCD_SEND_DMA_CMD(1);\ | |
| 85 | + } | |
| 86 | + #elif (defined(MAIN_LCD_9BIT_MODE)) | |
| 87 | + | |
| 88 | + #elif (defined(MAIN_LCD_16BIT_MODE)) | |
| 89 | + | |
| 90 | + #elif (defined(MAIN_LCD_18BIT_MODE)) | |
| 91 | + #define LCD_CtrlWrite_GC9305(_data) \ | |
| 92 | + {\ | |
| 93 | + SET_LCD_CMD_PARAMETER(0,LCD_CMD,(_data));\ | |
| 94 | + LCD_SEND_DMA_CMD(1);\ | |
| 95 | + }\ | |
| 96 | + | |
| 97 | + #define LCD_DataWrite_GC9305(_data) \ | |
| 98 | + {\ | |
| 99 | + SET_LCD_CMD_PARAMETER(0,LCD_DATA,(_data));\ | |
| 100 | + LCD_SEND_DMA_CMD(1);\ | |
| 101 | + } | |
| 102 | + #endif | |
| 103 | +#else /*LCD_CMD_DMA_MODE*/ | |
| 104 | +#if defined (__SERIAL_LCM__) | |
| 105 | + #define LCD_delay_GC9305() | |
| 106 | + #if (defined(MAIN_LCD_8BIT_MODE)||defined(MAIN_LCD_16BIT_MODE)) | |
| 107 | + | |
| 108 | + #define LCD_CtrlWrite_GC9305(_data) \ | |
| 109 | + {\ | |
| 110 | + SET_LCD_SERIAL0_IF_SIZE(LCD_SCNF_IF_WIDTH_8); \ | |
| 111 | + *(volatile kal_uint8 *) MAIN_LCD_CMD_ADDR= (_data);\ | |
| 112 | + LCD_delay_GC9305();\ | |
| 113 | + }\ | |
| 114 | + | |
| 115 | + #define LCD_DataWrite_GC9305(_data) \ | |
| 116 | + {\ | |
| 117 | + SET_LCD_SERIAL0_IF_SIZE(LCD_SCNF_IF_WIDTH_8); \ | |
| 118 | + *(volatile kal_uint8 *) MAIN_LCD_DATA_ADDR= (_data);\ | |
| 119 | + LCD_delay_GC9305();\ | |
| 120 | + } | |
| 121 | + | |
| 122 | + #endif | |
| 123 | + #else /*__SERIAL_LCM__*/ | |
| 124 | + #define LCD_delay_GC9305() | |
| 125 | + #if (defined(MAIN_LCD_8BIT_MODE)) | |
| 126 | + #define LCD_CtrlWrite_GC9305(_data) \ | |
| 127 | + {\ | |
| 128 | + *(volatile kal_uint8 *) MAIN_LCD_CMD_ADDR = (_data );\ | |
| 129 | + LCD_delay_GC9305();\ | |
| 130 | + LCD_delay_GC9305();\ | |
| 131 | + LCD_delay_GC9305();\ | |
| 132 | + LCD_delay_GC9305();\ | |
| 133 | + }\ | |
| 134 | + | |
| 135 | + | |
| 136 | + #define LCD_DataWrite_GC9305(_data) \ | |
| 137 | + {\ | |
| 138 | + *(volatile kal_uint8 *)MAIN_LCD_DATA_ADDR = (_data);\ | |
| 139 | + LCD_delay_GC9305();\ | |
| 140 | + LCD_delay_GC9305();\ | |
| 141 | + LCD_delay_GC9305();\ | |
| 142 | + LCD_delay_GC9305();\ | |
| 143 | + } | |
| 144 | + #endif | |
| 145 | +#endif /*__SERIAL_LCM__*/ | |
| 146 | + | |
| 147 | +#endif /* LCD_CMD_DMA_MODE */ | |
| 148 | + | |
| 149 | +#if (defined(MAIN_LCD_8BIT_MODE)||defined(MAIN_LCD_16BIT_MODE)) | |
| 150 | + #define LCD_DataRead_GC9305 (*(volatile kal_uint8 *)MAIN_LCD_DATA_ADDR); | |
| 151 | +#elif (defined(MAIN_LCD_18BIT_MODE)) | |
| 152 | + #define LCD_DataRead_GC9305 (*(volatile kal_uint32 *)MAIN_LCD_DATA_ADDR); | |
| 153 | +#endif | |
| 154 | + | |
| 155 | + | |
| 156 | +extern void LCD_BlockWrite_GC9305(kal_uint16 startx,kal_uint16 starty,kal_uint16 endx,kal_uint16 endy); | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | +/* Debug use only. */ | |
| 161 | +//#define __GC9305_DEBUG_TRACE__ | |
| 162 | + | |
| 163 | + | |
| 164 | +static void LCD_Delay(kal_uint32 delay_count) | |
| 165 | +{ | |
| 166 | + volatile kal_uint32 delay; | |
| 167 | + for (delay =0;delay <(delay_count*4);delay++) {} | |
| 168 | +} | |
| 169 | + | |
| 170 | +static void Delayms(kal_uint16 data) | |
| 171 | +{ | |
| 172 | +#if defined(__UBL__) | |
| 173 | + kal_uint32 time1=0, diff=0; | |
| 174 | + | |
| 175 | + time1=drv_get_current_time(); | |
| 176 | + | |
| 177 | + while(drv_get_duration_ms(time1) < data); | |
| 178 | +#else | |
| 179 | + kal_uint32 i; | |
| 180 | + while(data--) | |
| 181 | + { | |
| 182 | + for(i=0;i<220000;i++){}// 1ms=220000 TIMES | |
| 183 | + } | |
| 184 | +#endif | |
| 185 | +} | |
| 186 | +void LCD_set_reg_GC9305(kal_uint16 reg_index, kal_uint16 reg_data) | |
| 187 | +{ | |
| 188 | + | |
| 189 | + LCD_CtrlWrite_GC9305(reg_index); | |
| 190 | + if (reg_data==0xFFFF){ | |
| 191 | + //no register setting | |
| 192 | + }else{ | |
| 193 | + LCD_DataWrite_GC9305(reg_data); | |
| 194 | + } | |
| 195 | +} | |
| 196 | + | |
| 197 | +void spi_ini_GC9305(void) | |
| 198 | +{ | |
| 199 | + #if (defined(MT6218B) || defined(MT6219) || defined(MT6217)||defined(MT6226)||defined(MT6227)||defined(MT6228)||defined(MT6229)||defined(MT6230)||defined(MT6235)||defined(MT6238)||defined(MT6268)||defined(MT6236)||defined(MT6236B)) | |
| 200 | + REG_LCD_SERIAL_CONFIG = (LCD_SERIAL_CONFIG_CLOCK_PHASE_BIT | LCD_SERIAL_CONFIG_CLOCK_POLARITY_BIT); | |
| 201 | + #elif (defined(MT6225)||defined(MT6276)) | |
| 202 | + //format SET_LCD_SERIAL_IF_ATTRB(spo, sph, _3wire, csp0, csp1); | |
| 203 | + //SET_LCD_SERIAL_IF_ATTRB(1, 1, 1, 0, 0); | |
| 204 | + //format SET_LCD_SERIAL_IF_TIMING(if_num, clk, div, period); | |
| 205 | + //SET_LCD_SERIAL_IF_TIMING(0, LCD_SERIAL_CONFIG_104MHZ_CLK, 1, 0); | |
| 206 | + #endif /* MT6218B, MT6219 */ | |
| 207 | +} | |
| 208 | + | |
| 209 | +void init_lcd_interface_GC9305(void) | |
| 210 | +{ | |
| 211 | +#if !defined(WIN32) | |
| 212 | + dbg_print("init_lcd_interface_GC9305\r\n"); | |
| 213 | +#endif | |
| 214 | + | |
| 215 | + //Serial Clock: | |
| 216 | + SET_LCD_SERIAL_CLOCK(0, LCD_SERIAL_CLOCK_132MHZ); | |
| 217 | + //SET_LCD_SERIAL_CLOCK(0, LCD_SERIAL_CLOCK_26MHZ); | |
| 218 | + | |
| 219 | + #if defined(SERIAL_LCM_2_DATA_LINE_PROTOCOL) | |
| 220 | + ENABLE_LCD_SERIAL0_2PIN; | |
| 221 | + #if defined(MAIN_LCD_16BIT_MODE) | |
| 222 | + SET_LCD_SERIAL0_IF_2PIN_SIZE(LCD_SCNF_IF_2PIN_WIDTH_16); | |
| 223 | + #elif defined(MAIN_LCD_18BIT_MODE) | |
| 224 | + SET_LCD_SERIAL0_IF_2PIN_SIZE(LCD_SCNF_IF_2PIN_WIDTH_18); | |
| 225 | + #endif | |
| 226 | + #endif | |
| 227 | + | |
| 228 | + #if defined(SLCD_FEATURE_SINGLE_A0_MODE) | |
| 229 | + ENABLE_LCD_SERIAL0_SINGLE_A0; | |
| 230 | + #else | |
| 231 | + DISABLE_LCD_SERIAL0_SINGLE_A0; | |
| 232 | + #endif | |
| 233 | + | |
| 234 | + #if defined(SLCD_FEATURE_CS_STAY_LOW_MODE) | |
| 235 | + ENABLE_LCD_SERIAL0_CS_STAY_LOW; | |
| 236 | + #else | |
| 237 | + DISABLE_LCD_SERIAL0_CS_STAY_LOW; | |
| 238 | + #endif | |
| 239 | + | |
| 240 | + | |
| 241 | + //Define serial LCM work mode here | |
| 242 | + #if (defined(SERIAL_LCM_4WIRE_1_DATA_LANE)) | |
| 243 | + DISABLE_LCD_SERIAL0_3WIRE; | |
| 244 | + #elif (defined(SERIAL_LCM_3WIRE_1_DATA_LANE)||defined(SERIAL_LCM_3WIRE_2_DATA_LANE)) | |
| 245 | + ENABLE_LCD_SERIAL0_3WIRE; | |
| 246 | + DISABLE_LCD_SERIAL0_SDI; | |
| 247 | + #endif | |
| 248 | + | |
| 249 | + ENABLE_LCD_SERIAL_IF_HW_CS;//HW CS | |
| 250 | + | |
| 251 | + #if defined(MAIN_LCD_16BIT_MODE) | |
| 252 | + SET_LCD_SERIAL0_IF_SIZE(LCD_SCNF_IF_WIDTH_16); | |
| 253 | + #elif defined(MAIN_LCD_18BIT_MODE) | |
| 254 | + SET_LCD_SERIAL0_IF_SIZE(LCD_SCNF_IF_WIDTH_18); | |
| 255 | + #elif defined(MAIN_LCD_8BIT_MODE) | |
| 256 | + SET_LCD_SERIAL0_IF_SIZE(LCD_SCNF_IF_WIDTH_8); | |
| 257 | + #endif | |
| 258 | + | |
| 259 | + //Timing need tuning | |
| 260 | + SET_LCD_SERIAL_IF_CSS(0,1); // | |
| 261 | + SET_LCD_SERIAL_IF_CSH(0,1); | |
| 262 | + | |
| 263 | + SET_LCD_SERIAL_IF_WR_1ST(0,1);// | |
| 264 | + SET_LCD_SERIAL_IF_WR_2ND(0,1); | |
| 265 | + SET_LCD_SERIAL_IF_RD_1ST(0,0x0f);// | |
| 266 | + SET_LCD_SERIAL_IF_RD_2ND(0,0x0f); | |
| 267 | + SET_LCD_SERIAL0_IF_SIZE(LCD_SCNF_IF_WIDTH_8);//CMD use 8 bit width | |
| 268 | + | |
| 269 | + #if defined(MAIN_LCD_16BIT_MODE_RGB888) | |
| 270 | + SET_LCD_SEND_RES_MODE(1); | |
| 271 | + #endif | |
| 272 | + | |
| 273 | + //Set Driving current | |
| 274 | + set_lcd_driving_current_centralize(LCD_DRIVING_16MA); | |
| 275 | +} /* init_lcd_interface() */ | |
| 276 | + | |
| 277 | +void CABC_function_GC9305(kal_uint16 mode) | |
| 278 | +{ | |
| 279 | +return; | |
| 280 | + switch(mode){ | |
| 281 | + case 0: | |
| 282 | + //CABC Mode off Setting | |
| 283 | + LCD_CtrlWrite_GC9305(0x55); //Set CABC Mode off | |
| 284 | + LCD_DataWrite_GC9305(0x00); | |
| 285 | + break; | |
| 286 | + | |
| 287 | + case 1: | |
| 288 | + //CABC UI Mode Setting | |
| 289 | + LCD_CtrlWrite_GC9305(0x51); //DBV[7:0]=0xFF | |
| 290 | + LCD_DataWrite_GC9305(0xFF); | |
| 291 | + LCD_CtrlWrite_GC9305(0x53); //BCTRL=1, BL=1 | |
| 292 | + LCD_DataWrite_GC9305(0x24); | |
| 293 | + LCD_CtrlWrite_GC9305(0x55); //Set CABC UI Mode | |
| 294 | + LCD_DataWrite_GC9305(0x01); | |
| 295 | + break; | |
| 296 | + | |
| 297 | + case 2: | |
| 298 | + //CABC Still_mode Setting | |
| 299 | + LCD_CtrlWrite_GC9305(0x51); //DBV[7:0]=0xFF | |
| 300 | + LCD_DataWrite_GC9305(0xFF); | |
| 301 | + LCD_CtrlWrite_GC9305(0x53); //BCTRL=1, BL=1 | |
| 302 | + LCD_DataWrite_GC9305(0x24); | |
| 303 | + LCD_CtrlWrite_GC9305(0x55); //Set CABC Still Mode | |
| 304 | + LCD_DataWrite_GC9305(0x02); | |
| 305 | + break; | |
| 306 | + | |
| 307 | + case 3: | |
| 308 | + //CABC Moving_mode Setting | |
| 309 | + LCD_CtrlWrite_GC9305(0x51); //DBV[7:0]=0xFF | |
| 310 | + LCD_DataWrite_GC9305(0xFF); | |
| 311 | + LCD_CtrlWrite_GC9305(0x53); //BCTRL=1, BL=1 | |
| 312 | + LCD_DataWrite_GC9305(0x24); | |
| 313 | + LCD_CtrlWrite_GC9305(0x55); //Set CABC Moving Mode | |
| 314 | + LCD_DataWrite_GC9305(0x03); | |
| 315 | + break; | |
| 316 | + } | |
| 317 | + | |
| 318 | +} | |
| 319 | + | |
| 320 | + | |
| 321 | +void LCD_EnterSleep_GC9305(void) | |
| 322 | +{ | |
| 323 | + | |
| 324 | + LCD_CtrlWrite_GC9305(0xfe); | |
| 325 | + LCD_CtrlWrite_GC9305(0xef); | |
| 326 | + LCD_CtrlWrite_GC9305(0x28); | |
| 327 | + Delayms(120); | |
| 328 | + LCD_CtrlWrite_GC9305(0x10); | |
| 329 | + Delayms(150); | |
| 330 | + | |
| 331 | +} | |
| 332 | +//void LCD_Init_GC9305(kal_uint32 bkground, void **buf_addr); | |
| 333 | + | |
| 334 | +void LCD_ExitSleep_GC9305(void) | |
| 335 | +{ | |
| 336 | + | |
| 337 | + LCD_CtrlWrite_GC9305(0xfe); | |
| 338 | + LCD_CtrlWrite_GC9305(0xef); | |
| 339 | + LCD_CtrlWrite_GC9305(0x11); | |
| 340 | + Delayms(120) ; | |
| 341 | + LCD_CtrlWrite_GC9305(0x29); | |
| 342 | + // Init_LCD(); | |
| 343 | + | |
| 344 | + //LCD_Init_GC9305(0,0); | |
| 345 | +} | |
| 346 | + | |
| 347 | +void LCD_Partial_On_GC9305(kal_uint16 start_page,kal_uint16 end_page) | |
| 348 | +{ | |
| 349 | + | |
| 350 | +} | |
| 351 | + | |
| 352 | +void LCD_Partial_Off_GC9305(void) | |
| 353 | +{ | |
| 354 | + | |
| 355 | +} | |
| 356 | + | |
| 357 | +kal_uint8 LCD_Partial_line_GC9305(void) | |
| 358 | +{ | |
| 359 | + return 1; /* partial display in 1 line alignment */ | |
| 360 | +} | |
| 361 | + | |
| 362 | +void LCD_blockClear_GC9305(kal_uint16 x1,kal_uint16 y1,kal_uint16 x2,kal_uint16 y2,kal_uint16 data) | |
| 363 | +{ | |
| 364 | + kal_uint16 LCD_x; | |
| 365 | + kal_uint16 LCD_y; | |
| 366 | + kal_uint8 r_color,g_color,b_color; | |
| 367 | + | |
| 368 | + r_color=(data&0xF800)>>10; /* transfer to RGB666 */ | |
| 369 | + g_color=(data>>5)&0x3F; | |
| 370 | + b_color=((data)&0x1F)<<1; | |
| 371 | + | |
| 372 | + LCD_CtrlWrite_GC9305(0x002a); | |
| 373 | + LCD_DataWrite_GC9305((x1&0xff00)>>8);//start x | |
| 374 | + LCD_DataWrite_GC9305(x1&0x00ff); | |
| 375 | + | |
| 376 | + LCD_DataWrite_GC9305((x2&0xff00)>>8);//end x | |
| 377 | + LCD_DataWrite_GC9305(x2&0x00ff); | |
| 378 | + | |
| 379 | + LCD_CtrlWrite_GC9305(0x002b); | |
| 380 | + LCD_DataWrite_GC9305((y1&0xff00)>>8);//start x | |
| 381 | + LCD_DataWrite_GC9305(y1&0x00ff); | |
| 382 | + | |
| 383 | + LCD_DataWrite_GC9305((y2&0xff00)>>8);//end x | |
| 384 | + LCD_DataWrite_GC9305(y2&0x00ff); | |
| 385 | + | |
| 386 | + | |
| 387 | + LCD_CtrlWrite_GC9305(0x002c);//transfor begin | |
| 388 | + for(LCD_y=y1;LCD_y<=y2;LCD_y++) | |
| 389 | + { | |
| 390 | + for(LCD_x=x1;LCD_x<=x2;LCD_x++) | |
| 391 | + { | |
| 392 | + #if (defined(MAIN_LCD_8BIT_MODE)) | |
| 393 | + *((volatile unsigned char *) MAIN_LCD_DATA_ADDR)=(kal_uint8)((data&0xFF00)>>8); | |
| 394 | + *((volatile unsigned char *) MAIN_LCD_DATA_ADDR)=(kal_uint8)(data&0xFF); | |
| 395 | + #elif (defined(MAIN_LCD_9BIT_MODE)) | |
| 396 | + *((volatile unsigned short *) MAIN_LCD_DATA_ADDR)=((r_color<<6)|(g_color>>3)<<9); | |
| 397 | + *((volatile unsigned short *) MAIN_LCD_DATA_ADDR)=((((g_color&0x07)<<6)|b_color)<<9); | |
| 398 | + #elif (defined(MAIN_LCD_16BIT_MODE) || defined(MAIN_LCD_18BIT_MODE)) | |
| 399 | + *((volatile unsigned int *) MAIN_LCD_DATA_ADDR)=(r_color<<12)|(g_color<<6)|b_color; | |
| 400 | + #endif | |
| 401 | + } | |
| 402 | + } | |
| 403 | +} | |
| 404 | + | |
| 405 | +void LCD_ClearAll_GC9305(kal_uint16 data) | |
| 406 | +{ | |
| 407 | + LCD_blockClear_GC9305(0,0,LCD_WIDTH-1,LCD_HEIGHT-1,data); | |
| 408 | + //LCD_blockClear_GC9305(0,0,360-1,640-1,data); | |
| 409 | +} | |
| 410 | +//////////////haiyong add for lcd porting | |
| 411 | +void LCD_Read_GRAM_GC9305(kal_uint16 startx,kal_uint16 starty,kal_uint16 endx,kal_uint16 endy) | |
| 412 | +{ | |
| 413 | + kal_uint32 GC9305_GRAM_DATA; | |
| 414 | + kal_uint16 LCD_x,LCD_y; | |
| 415 | + | |
| 416 | + | |
| 417 | + LCD_CtrlWrite_GC9305(0x002a); | |
| 418 | + LCD_DataWrite_GC9305((startx&0xff00)>>8);//start x | |
| 419 | + LCD_DataWrite_GC9305(startx&0x00ff); | |
| 420 | + | |
| 421 | + LCD_DataWrite_GC9305((endx&0xff00)>>8);//end x | |
| 422 | + LCD_DataWrite_GC9305(endx&0x00ff); | |
| 423 | + | |
| 424 | + LCD_CtrlWrite_GC9305(0x002b); | |
| 425 | + LCD_DataWrite_GC9305((starty&0xff00)>>8);//start x | |
| 426 | + LCD_DataWrite_GC9305(starty&0x00ff); | |
| 427 | + | |
| 428 | + LCD_DataWrite_GC9305((endy&0xff00)>>8);//end x | |
| 429 | + LCD_DataWrite_GC9305(endy&0x00ff); | |
| 430 | + | |
| 431 | +#ifdef __GC9305_DEBUG_TRACE__ | |
| 432 | + kal_prompt_trace(MOD_ENG,"startx starty endx endy= %d, %d, %d, %d",startx,starty,endx,endy); | |
| 433 | +#endif | |
| 434 | + LCD_CtrlWrite_GC9305(0x002E); | |
| 435 | + GC9305_GRAM_DATA=LCD_DataRead_GC9305; | |
| 436 | + Delayms(20); | |
| 437 | + | |
| 438 | + for(LCD_y=starty;LCD_y<=endy;LCD_y++) | |
| 439 | + { | |
| 440 | + for(LCD_x=startx;LCD_x<=endx;LCD_x++) | |
| 441 | + { | |
| 442 | + GC9305_GRAM_DATA=LCD_DataRead_GC9305; | |
| 443 | +#ifdef __GC9305_DEBUG_TRACE__ | |
| 444 | + kal_prompt_trace(MOD_ENG,"GC9305_GRAM_DATA = %x",GC9305_GRAM_DATA); | |
| 445 | +#endif | |
| 446 | + } | |
| 447 | + } | |
| 448 | +} | |
| 449 | +void LCD_Read_ID_GC9305(void) | |
| 450 | +{ | |
| 451 | + kal_uint32 GC9305_ID2; | |
| 452 | + LCD_CtrlWrite_GC9305(0x00D3); | |
| 453 | + //LCD_DataWrite_GC9305(0x0000);//dummy data | |
| 454 | + //LCD_DataWrite_GC9305(0x0088);//read ID2 | |
| 455 | + GC9305_ID2=LCD_DataRead_GC9305; | |
| 456 | + GC9305_ID2=LCD_DataRead_GC9305; | |
| 457 | +#ifdef __GC9305_DEBUG_TRACE__ | |
| 458 | + kal_prompt_trace(MOD_ENG,"GC9305_ID2 = %d",GC9305_ID2); | |
| 459 | +#endif | |
| 460 | +} | |
| 461 | + | |
| 462 | +char temp_value=0x90;//0x95 | |
| 463 | +void LCD_Init_GC9305(kal_uint32 bkground, void **buf_addr) | |
| 464 | +{ | |
| 465 | + kal_uint16 i,j; | |
| 466 | + | |
| 467 | + SET_LCD_CTRL_RESET_PIN;//set reset pin high | |
| 468 | + Delayms(120); | |
| 469 | + CLEAR_LCD_CTRL_RESET_PIN;//set reset pin low | |
| 470 | + Delayms(50); | |
| 471 | + SET_LCD_CTRL_RESET_PIN;//set reset pin high | |
| 472 | + Delayms(150); | |
| 473 | + | |
| 474 | + //--------------------------------display control setting----------------------------------------// | |
| 475 | + LCD_CtrlWrite_GC9305(0xfe); | |
| 476 | + LCD_CtrlWrite_GC9305(0xef); | |
| 477 | + LCD_CtrlWrite_GC9305(0x36); | |
| 478 | + LCD_DataWrite_GC9305(0x48); | |
| 479 | + LCD_CtrlWrite_GC9305(0x3a); | |
| 480 | + LCD_DataWrite_GC9305(0x05); | |
| 481 | + LCD_CtrlWrite_GC9305(0x35); | |
| 482 | + LCD_DataWrite_GC9305(0x00); | |
| 483 | + LCD_CtrlWrite_GC9305(0x44); | |
| 484 | + LCD_DataWrite_GC9305(0x00); | |
| 485 | + LCD_DataWrite_GC9305(0x0a); | |
| 486 | + //---------------------------------end display control setting--------------------------------// | |
| 487 | + //------------------------------Power Control Registers Initial------------------------------// | |
| 488 | + LCD_CtrlWrite_GC9305(0xa4); | |
| 489 | + LCD_DataWrite_GC9305(0x44); | |
| 490 | + LCD_DataWrite_GC9305(0x44); | |
| 491 | + LCD_CtrlWrite_GC9305(0xa5); | |
| 492 | + LCD_DataWrite_GC9305(0x42); | |
| 493 | + LCD_DataWrite_GC9305(0x42); | |
| 494 | + LCD_CtrlWrite_GC9305(0xaa); | |
| 495 | + LCD_DataWrite_GC9305(0x88); | |
| 496 | + LCD_DataWrite_GC9305(0x88); | |
| 497 | + LCD_CtrlWrite_GC9305(0xe8); | |
| 498 | + LCD_DataWrite_GC9305(0x11); | |
| 499 | + LCD_DataWrite_GC9305(0x0b); | |
| 500 | + LCD_CtrlWrite_GC9305(0xe3); | |
| 501 | + LCD_DataWrite_GC9305(0x01); | |
| 502 | + LCD_DataWrite_GC9305(0x10); | |
| 503 | + LCD_CtrlWrite_GC9305(0xff); | |
| 504 | + LCD_DataWrite_GC9305(0x61); | |
| 505 | + LCD_CtrlWrite_GC9305(0xAC); | |
| 506 | + LCD_DataWrite_GC9305(0x00); | |
| 507 | + LCD_CtrlWrite_GC9305(0xAd); | |
| 508 | + LCD_DataWrite_GC9305(0x33); | |
| 509 | + LCD_CtrlWrite_GC9305(0xAe); | |
| 510 | + LCD_DataWrite_GC9305(0x2b); | |
| 511 | + LCD_CtrlWrite_GC9305(0xAf); | |
| 512 | + LCD_DataWrite_GC9305(0x55); | |
| 513 | + //LCD_CtrlWrite_GC9305(0xe1); | |
| 514 | + //LCD_DataWrite_GC9305(0x10); | |
| 515 | + //LCD_DataWrite_GC9305(0x0a); | |
| 516 | + //-------------------------------display window 240X320------------------------------------// | |
| 517 | + LCD_CtrlWrite_GC9305(0x2a); | |
| 518 | + LCD_DataWrite_GC9305(0x00); | |
| 519 | + LCD_DataWrite_GC9305(0x00); | |
| 520 | + LCD_DataWrite_GC9305(0x00); | |
| 521 | + LCD_DataWrite_GC9305(0xef); | |
| 522 | + LCD_CtrlWrite_GC9305(0x2b); | |
| 523 | + LCD_DataWrite_GC9305(0x00); | |
| 524 | + LCD_DataWrite_GC9305(0x00); | |
| 525 | + LCD_DataWrite_GC9305(0x01); | |
| 526 | + LCD_DataWrite_GC9305(0x3f); | |
| 527 | + LCD_CtrlWrite_GC9305(0x2c); | |
| 528 | + //----------------------------------end display window ----------------------------------------// | |
| 529 | + //--------------------------------------gamma setting-------------------------------------------// | |
| 530 | + LCD_CtrlWrite_GC9305(0xf0); | |
| 531 | + LCD_DataWrite_GC9305(0x02); | |
| 532 | + LCD_DataWrite_GC9305(0x00); | |
| 533 | + LCD_DataWrite_GC9305(0x00); | |
| 534 | + LCD_DataWrite_GC9305(0x05); | |
| 535 | + LCD_DataWrite_GC9305(0x09); | |
| 536 | + LCD_DataWrite_GC9305(0x0F); | |
| 537 | + LCD_CtrlWrite_GC9305(0xf1); | |
| 538 | + LCD_DataWrite_GC9305(0x01); | |
| 539 | + LCD_DataWrite_GC9305(0x02); | |
| 540 | + LCD_DataWrite_GC9305(0x00); | |
| 541 | + LCD_DataWrite_GC9305(0x20); | |
| 542 | + LCD_DataWrite_GC9305(0x32); | |
| 543 | + LCD_DataWrite_GC9305(0x12); | |
| 544 | + LCD_CtrlWrite_GC9305(0xf2); | |
| 545 | + LCD_DataWrite_GC9305(0x10); | |
| 546 | + LCD_DataWrite_GC9305(0x0b); | |
| 547 | + LCD_DataWrite_GC9305(0x2e); | |
| 548 | + LCD_DataWrite_GC9305(0x06); | |
| 549 | + LCD_DataWrite_GC9305(0x06); | |
| 550 | + LCD_DataWrite_GC9305(0x3d); | |
| 551 | + LCD_CtrlWrite_GC9305(0xf3); | |
| 552 | + LCD_DataWrite_GC9305(0x12); | |
| 553 | + LCD_DataWrite_GC9305(0x09); | |
| 554 | + LCD_DataWrite_GC9305(0x5a); | |
| 555 | + LCD_DataWrite_GC9305(0x01); | |
| 556 | + LCD_DataWrite_GC9305(0x01); | |
| 557 | + LCD_DataWrite_GC9305(0x66); | |
| 558 | + LCD_CtrlWrite_GC9305(0xf4); | |
| 559 | + LCD_DataWrite_GC9305(0x0f); | |
| 560 | + LCD_DataWrite_GC9305(0x1b); | |
| 561 | + LCD_DataWrite_GC9305(0x1a); | |
| 562 | + LCD_DataWrite_GC9305(0xf); | |
| 563 | + LCD_DataWrite_GC9305(0x11); | |
| 564 | + LCD_DataWrite_GC9305(0x0F); | |
| 565 | + LCD_CtrlWrite_GC9305(0xf5); | |
| 566 | + LCD_DataWrite_GC9305(0x04); | |
| 567 | + LCD_DataWrite_GC9305(0x10); | |
| 568 | + LCD_DataWrite_GC9305(0x10); | |
| 569 | + LCD_DataWrite_GC9305(0x32); | |
| 570 | + LCD_DataWrite_GC9305(0x31); | |
| 571 | + LCD_DataWrite_GC9305(0x0F); | |
| 572 | + //------------------------------------end gamma setting------------------------------------------// | |
| 573 | + LCD_CtrlWrite_GC9305(0x11); | |
| 574 | + Delayms(120); | |
| 575 | + LCD_CtrlWrite_GC9305(0x29); | |
| 576 | + LCD_CtrlWrite_GC9305(0x2c); | |
| 577 | + //e9开双通道 | |
| 578 | + LCD_CtrlWrite_GC9305(0xe9); | |
| 579 | + LCD_DataWrite_GC9305(0x08); | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | +} | |
| 584 | + | |
| 585 | + | |
| 586 | +void LCD_PWRON_GC9305(kal_bool on) | |
| 587 | +{ | |
| 588 | + if(on) | |
| 589 | + { | |
| 590 | + //kal_prompt_trace(MOD_ENG,"sleep out"); | |
| 591 | + LCD_ExitSleep_GC9305(); | |
| 592 | + } | |
| 593 | + else | |
| 594 | + { | |
| 595 | + //kal_prompt_trace(MOD_ENG,"sleep in"); | |
| 596 | + LCD_EnterSleep_GC9305(); | |
| 597 | + } | |
| 598 | +} | |
| 599 | + | |
| 600 | + | |
| 601 | +void LCD_SetContrast_GC9305(kal_uint8 level) | |
| 602 | +{ | |
| 603 | +} | |
| 604 | + | |
| 605 | +void LCD_ON_GC9305(kal_bool on) | |
| 606 | +{ | |
| 607 | + if (on) | |
| 608 | + { | |
| 609 | + //kal_prompt_trace(MOD_ENG,"screen on"); | |
| 610 | + LCD_ExitSleep_GC9305(); | |
| 611 | + } | |
| 612 | + else | |
| 613 | + { | |
| 614 | + //kal_prompt_trace(MOD_ENG,"screen off"); | |
| 615 | + LCD_EnterSleep_GC9305(); | |
| 616 | + } | |
| 617 | +} | |
| 618 | +void LCD_BlockWrite_GC9305(kal_uint16 startx,kal_uint16 starty,kal_uint16 endx,kal_uint16 endy) | |
| 619 | +{ | |
| 620 | + //startx = 2; | |
| 621 | + //starty = 2; | |
| 622 | + //endx = LCD_WIDTH+1; | |
| 623 | + //endy = LCD_HEIGHT+1; //in LQT mode and update permitted | |
| 624 | + | |
| 625 | +#ifdef __GC9305_DEBUG_TRACE__ | |
| 626 | + //kal_prompt_trace(MOD_ENG,"LCD block write"); | |
| 627 | +#endif | |
| 628 | + #if defined(__RF_DESENSE_TEST__) && defined(__FM_DESENSE_COPY_NO_LCM_UPDATE_) | |
| 629 | + // under this test, we will not write any command to LCM. | |
| 630 | + return; | |
| 631 | + #endif | |
| 632 | + ASSERT(lcd_assert_fail==KAL_FALSE); | |
| 633 | + lcd_assert_fail = KAL_TRUE; | |
| 634 | + #ifdef LQT_SUPPORT | |
| 635 | + if(!lcd_update_permission&&!(lcd_at_mode==LCD_AT_RELEASE_MODE)) | |
| 636 | + { | |
| 637 | + lcd_assert_fail = KAL_FALSE; | |
| 638 | + return;//in LQT mode but not update permitted | |
| 639 | + } | |
| 640 | + if(lcd_update_permission&&!(lcd_at_mode==LCD_AT_RELEASE_MODE)) | |
| 641 | + { | |
| 642 | + startx = 0; | |
| 643 | + starty = 0; | |
| 644 | + endx = LCD_WIDTH-1; | |
| 645 | + endy = LCD_HEIGHT-1 ; //in LQT mode and update permitted | |
| 646 | + } | |
| 647 | + #endif /*LQT_SUPPORT*/ | |
| 648 | + | |
| 649 | +#if (defined(LCD_CMD_DMA_MODE)) | |
| 650 | + | |
| 651 | + SET_LCD_CMD_PARAMETER(0,LCD_CMD,0x002A); //Set_column_address(2Ah) | |
| 652 | + SET_LCD_CMD_PARAMETER(1,LCD_DATA,(startx&0xFF00)>>8); | |
| 653 | + SET_LCD_CMD_PARAMETER(2,LCD_DATA,startx&0x00FF); | |
| 654 | + SET_LCD_CMD_PARAMETER(3,LCD_DATA,(endx&0xFF00)>>8); | |
| 655 | + SET_LCD_CMD_PARAMETER(4,LCD_DATA,endx&0x00FF); | |
| 656 | + | |
| 657 | + SET_LCD_CMD_PARAMETER(5,LCD_CMD,0x002B); //Set_page_address(2Bh) | |
| 658 | + SET_LCD_CMD_PARAMETER(6,LCD_DATA,(starty&0xFF00)>>8); | |
| 659 | + SET_LCD_CMD_PARAMETER(7,LCD_DATA,starty&0x00FF); | |
| 660 | + SET_LCD_CMD_PARAMETER(8,LCD_DATA,(endy&0xFF00)>>8); | |
| 661 | + SET_LCD_CMD_PARAMETER(9,LCD_DATA,endy&0x00FF); | |
| 662 | + | |
| 663 | + SET_LCD_CMD_PARAMETER(10,LCD_CMD,0x002C); //Write_memory_start(2Ch) | |
| 664 | + | |
| 665 | + //SET_LCD_PARALLEL_IF_TIMING(0,0,0,1,2,2,2,6,0); //don't care write cycle(write register) 100ns | |
| 666 | + //SET_LCD_CMD_PARAMETER(11,LCD_CMD,0x0029); //Write_memory_start(2Ch) | |
| 667 | + SET_LCD_ROI_CTRL_NUMBER_OF_CMD(11); | |
| 668 | + ENABLE_LCD_TRANSFER_COMPLETE_INT; | |
| 669 | + ENABLE_LCD_ROI_CTRL_CMD_FIRST;//ENABLE_LCD_ROI_CTRL_CMD_FIRST; | |
| 670 | + //while(LCD_IS_RUNNING); | |
| 671 | + START_LCD_TRANSFER; | |
| 672 | + | |
| 673 | +#else | |
| 674 | + //ENABLE_LCD_SERIAL0_CS; | |
| 675 | + LCD_CtrlWrite_GC9305(0x002a); | |
| 676 | + LCD_DataWrite_GC9305((startx&0xff00)>>8);//start x | |
| 677 | + LCD_DataWrite_GC9305(startx&0x00ff); | |
| 678 | + | |
| 679 | + LCD_DataWrite_GC9305((endx&0xff00)>>8);//end x | |
| 680 | + LCD_DataWrite_GC9305(endx&0x00ff); | |
| 681 | + | |
| 682 | + LCD_CtrlWrite_GC9305(0x002b); | |
| 683 | + LCD_DataWrite_GC9305((starty&0xff00)>>8);//start x | |
| 684 | + LCD_DataWrite_GC9305(starty&0x00ff); | |
| 685 | + | |
| 686 | + LCD_DataWrite_GC9305((endy&0xff00)>>8);//end x | |
| 687 | + LCD_DataWrite_GC9305(endy&0x00ff); | |
| 688 | + | |
| 689 | + LCD_CtrlWrite_GC9305(0x002c);//transfor begin | |
| 690 | + | |
| 691 | + ENABLE_LCD_TRANSFER_COMPLETE_INT; | |
| 692 | + DISABLE_LCD_ROI_CTRL_CMD_FIRST;//ENABLE_LCD_ROI_CTRL_CMD_FIRST; | |
| 693 | + START_LCD_TRANSFER; | |
| 694 | + // DISABLE_LCD_SERIAL0_CS; | |
| 695 | +#endif | |
| 696 | + | |
| 697 | + lcd_assert_fail = KAL_FALSE; | |
| 698 | + | |
| 699 | +} | |
| 700 | + | |
| 701 | +void LCD_Size_GC9305(kal_uint16 *out_LCD_width,kal_uint16 *out_LCD_height) | |
| 702 | +{ | |
| 703 | + *out_LCD_width = LCD_WIDTH; | |
| 704 | + *out_LCD_height = LCD_HEIGHT; | |
| 705 | +} | |
| 706 | + | |
| 707 | +/*Engineering mode*/ | |
| 708 | +kal_uint8 LCD_GetParm_GC9305(lcd_func_type type) | |
| 709 | +{ | |
| 710 | + switch(type) | |
| 711 | + { | |
| 712 | + case lcd_Bais_func: | |
| 713 | + return 1; | |
| 714 | + case lcd_Contrast_func: | |
| 715 | + return 1; | |
| 716 | + case lcd_LineRate_func: | |
| 717 | + return 1; | |
| 718 | + case lcd_Temperature_Compensation_func: | |
| 719 | + return 1; | |
| 720 | + default: | |
| 721 | + ASSERT(0); | |
| 722 | + return 100; | |
| 723 | + } | |
| 724 | +} | |
| 725 | + | |
| 726 | +void LCD_SetBias_GC9305(kal_uint8 *bias) | |
| 727 | +{ | |
| 728 | +} | |
| 729 | + | |
| 730 | +void LCD_Contrast_GC9305(kal_uint8 *contrast) | |
| 731 | +{ | |
| 732 | +} | |
| 733 | + | |
| 734 | +void LCD_LineRate_GC9305(kal_uint8 *linerate) | |
| 735 | +{ | |
| 736 | +} | |
| 737 | + | |
| 738 | +void LCD_Temp_Compensate_GC9305(kal_uint8 *compensate) | |
| 739 | +{ | |
| 740 | +} | |
| 741 | + | |
| 742 | +void LCD_Set_Scan_Direction_GC9305(kal_uint8 rotate_value) | |
| 743 | +{ | |
| 744 | + | |
| 745 | +} /* LCD_Set_Scan_Direction_TA7601() */ | |
| 746 | + | |
| 747 | + | |
| 748 | +#ifdef LQT_SUPPORT/*Please don't remove LQT code segments*/ | |
| 749 | +/************************************************************************* | |
| 750 | +* FUNCTION | |
| 751 | +* LCD_gamma_test() and LCD_flicker_test() | |
| 752 | +* | |
| 753 | +* DESCRIPTION | |
| 754 | +* Generating test pattern by AT commands. | |
| 755 | +* | |
| 756 | +* PARAMETERS | |
| 757 | +* level, color | |
| 758 | +* | |
| 759 | +* RETURNS | |
| 760 | +* None | |
| 761 | +* | |
| 762 | +* GLOBALS AFFECTED | |
| 763 | +* | |
| 764 | +*************************************************************************/ | |
| 765 | +void LCD_gamma_test_GC9305(kal_uint8 level, kal_uint8 color) | |
| 766 | +{ | |
| 767 | + kal_uint16 LCD_x; | |
| 768 | + kal_uint16 LCD_y; | |
| 769 | + kal_uint16 r_color,g_color,b_color,w_color; | |
| 770 | + kal_uint32 lcd_layer0_buffer; | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + lcd_layer0_buffer=REG_LCD_LAYER0_BUFF_ADDR; | |
| 775 | + r_color=(level>>1)<<11; /* transfer to RGB565 */ | |
| 776 | + g_color=level<<5; | |
| 777 | + b_color=level>>1; | |
| 778 | + w_color=(r_color|g_color|b_color); | |
| 779 | + for(LCD_y=0;LCD_y<LCD_HEIGHT;LCD_y++) | |
| 780 | + { | |
| 781 | + for(LCD_x=0;LCD_x<LCD_WIDTH/2;LCD_x++) | |
| 782 | + { | |
| 783 | + switch(color) | |
| 784 | + { | |
| 785 | + case 0: | |
| 786 | + *((kal_uint32 *)lcd_layer0_buffer+LCD_y*(LCD_WIDTH/2)+LCD_x)= ((w_color<<16)|w_color); | |
| 787 | + break; | |
| 788 | + case 1: | |
| 789 | + *((kal_uint32 *)lcd_layer0_buffer+LCD_y*(LCD_WIDTH/2)+LCD_x)= ((r_color<<16)|r_color); | |
| 790 | + break; | |
| 791 | + case 2: | |
| 792 | + *((kal_uint32 *)lcd_layer0_buffer+LCD_y*(LCD_WIDTH/2)+LCD_x)= ((g_color<<16)|g_color); | |
| 793 | + break; | |
| 794 | + case 3: | |
| 795 | + *((kal_uint32 *)lcd_layer0_buffer+LCD_y*(LCD_WIDTH/2)+LCD_x)= ((b_color<<16)|b_color); | |
| 796 | + break; | |
| 797 | + | |
| 798 | + default: | |
| 799 | + ASSERT(0); | |
| 800 | + } | |
| 801 | + } | |
| 802 | + } | |
| 803 | +} | |
| 804 | + | |
| 805 | +void LCD_flicker_test_GC9305(kal_uint8 level) | |
| 806 | +{ | |
| 807 | + kal_uint16 LCD_x,LCD_y; | |
| 808 | + | |
| 809 | + LCD_CtrlWrite_GC9305(0x002a); | |
| 810 | + LCD_DataWrite_GC9305((0&0xff00)>>8);//start x | |
| 811 | + LCD_DataWrite_GC9305(0&0x00ff); | |
| 812 | + LCD_DataWrite_GC9305(((480-1)&0xff00)>>8);//end x | |
| 813 | + LCD_DataWrite_GC9305((480-1)&0x00ff); | |
| 814 | + | |
| 815 | + LCD_CtrlWrite_GC9305(0x002b); | |
| 816 | + LCD_DataWrite_GC9305((0&0xff00)>>8);//start y | |
| 817 | + LCD_DataWrite_GC9305(0&0x00ff); | |
| 818 | + LCD_DataWrite_GC9305(((800-1)&0xff00)>>8);//end y | |
| 819 | + LCD_DataWrite_GC9305((800-1)&0x00ff); | |
| 820 | + | |
| 821 | + LCD_CtrlWrite_GC9305(0x002c);//transfor begin | |
| 822 | + | |
| 823 | + | |
| 824 | + for(LCD_y=0;LCD_y<=800-1;LCD_y++) | |
| 825 | + { | |
| 826 | + | |
| 827 | + if(LCD_y&0x2) | |
| 828 | + { | |
| 829 | + for(LCD_x=0;LCD_x<=480-1;LCD_x+=1) | |
| 830 | + { | |
| 831 | + *(volatile kal_uint32 *) MAIN_LCD_DATA_ADDR= (0x0003FFFF); | |
| 832 | + //Delayms(1); | |
| 833 | + } | |
| 834 | + } | |
| 835 | + else | |
| 836 | + { | |
| 837 | + for(LCD_x=0;LCD_x<=480-1;LCD_x+=1) | |
| 838 | + { | |
| 839 | + *(volatile kal_uint32 *) MAIN_LCD_DATA_ADDR= (0x00000000); | |
| 840 | + //Delayms(1); | |
| 841 | + } | |
| 842 | + } | |
| 843 | + } | |
| 844 | + //Delayms(5000); | |
| 845 | +} | |
| 846 | + | |
| 847 | +void LCD_Frame_Pixel_Test_GC9305(void) | |
| 848 | +{ | |
| 849 | + | |
| 850 | + kal_uint16 LCD_x,LCD_y; | |
| 851 | + | |
| 852 | + LCD_CtrlWrite_GC9305(0x002a); | |
| 853 | + LCD_DataWrite_GC9305((0&0xff00)>>8);//start x | |
| 854 | + LCD_DataWrite_GC9305(0&0x00ff); | |
| 855 | + LCD_DataWrite_GC9305(((480-1)&0xff00)>>8);//end x | |
| 856 | + LCD_DataWrite_GC9305((480-1)&0x00ff); | |
| 857 | + | |
| 858 | + LCD_CtrlWrite_GC9305(0x002b); | |
| 859 | + LCD_DataWrite_GC9305((0&0xff00)>>8);//start y | |
| 860 | + LCD_DataWrite_GC9305(0&0x00ff); | |
| 861 | + LCD_DataWrite_GC9305(((800-1)&0xff00)>>8);//end y | |
| 862 | + LCD_DataWrite_GC9305((800-1)&0x00ff); | |
| 863 | + | |
| 864 | + LCD_CtrlWrite_GC9305(0x002c);//transfor begin | |
| 865 | + | |
| 866 | +#if 0 | |
| 867 | +/* under construction !*/ | |
| 868 | +/* under construction !*/ | |
| 869 | +/* under construction !*/ | |
| 870 | +/* under construction !*/ | |
| 871 | +/* under construction !*/ | |
| 872 | +/* under construction !*/ | |
| 873 | +/* under construction !*/ | |
| 874 | +/* under construction !*/ | |
| 875 | +/* under construction !*/ | |
| 876 | +/* under construction !*/ | |
| 877 | +#else | |
| 878 | + | |
| 879 | + for(LCD_y=0;LCD_y<=800-1;LCD_y++) | |
| 880 | + { | |
| 881 | + for(LCD_x=0;LCD_x<=480-1;LCD_x+=1) | |
| 882 | + { | |
| 883 | + | |
| 884 | + if(0==LCD_y ||(800-1)==LCD_y) | |
| 885 | + { | |
| 886 | + *(volatile kal_uint32 *) MAIN_LCD_DATA_ADDR= (0x0003FFFF); | |
| 887 | + | |
| 888 | + } | |
| 889 | + else if(0== LCD_x) | |
| 890 | + { | |
| 891 | + *(volatile kal_uint32 *) MAIN_LCD_DATA_ADDR= (0x0003FFFF); | |
| 892 | + } | |
| 893 | + else if(480-2==LCD_x) | |
| 894 | + { | |
| 895 | + *(volatile kal_uint32 *) MAIN_LCD_DATA_ADDR= (0x0003FFFF); | |
| 896 | + } | |
| 897 | + else | |
| 898 | + { | |
| 899 | + *(volatile kal_uint32 *) MAIN_LCD_DATA_ADDR= (0x00000000); | |
| 900 | + } | |
| 901 | + } | |
| 902 | + } | |
| 903 | +#endif | |
| 904 | +} | |
| 905 | + | |
| 906 | +void LCD_CS_Test_GC9305(kal_uint16 cs,kal_uint16 bgr,kal_uint16 mx) | |
| 907 | +{ | |
| 908 | + | |
| 909 | +#ifdef __GC9305_DEBUG_TRACE__ | |
| 910 | + kal_prompt_trace(MOD_ENG,"LCD_CS_Test cs=%d,bgr=%d,mx=%d",cs,bgr,mx); | |
| 911 | +#endif | |
| 912 | + | |
| 913 | + if(0==cs) | |
| 914 | + { | |
| 915 | + if(0==bgr && 0==mx) | |
| 916 | + { | |
| 917 | + LCD_CtrlWrite_GC9305(0x0036); | |
| 918 | + LCD_DataWrite_GC9305(0x00); | |
| 919 | + } | |
| 920 | + else if(1==bgr && 0==mx) | |
| 921 | + { | |
| 922 | + LCD_CtrlWrite_GC9305(0x0036); | |
| 923 | + LCD_DataWrite_GC9305(0x08); | |
| 924 | + } | |
| 925 | + else if(1==bgr && 1==mx) | |
| 926 | + { | |
| 927 | + LCD_CtrlWrite_GC9305(0x0036); | |
| 928 | + LCD_DataWrite_GC9305(0x48); | |
| 929 | + } | |
| 930 | + } | |
| 931 | + else | |
| 932 | + { //cs1 | |
| 933 | + //re define | |
| 934 | + #define MAIN_LCD_CMD1_ADDR LCD_PARALLEL1_A0_LOW_ADDR | |
| 935 | + #define MAIN_LCD_DATA1_ADDR LCD_PARALLEL1_A0_HIGH_ADDR | |
| 936 | + | |
| 937 | + | |
| 938 | + #define LCD_CtrlWrite1_GC9305(_data) \ | |
| 939 | + {\ | |
| 940 | + *(volatile kal_uint16 *) MAIN_LCD_CMD1_ADDR= (_data);\ | |
| 941 | + }\ | |
| 942 | + | |
| 943 | + #define LCD_DataWrite1_GC9305(_data) \ | |
| 944 | + {\ | |
| 945 | + *(volatile kal_uint16 *) MAIN_LCD_DATA1_ADDR= (_data);\ | |
| 946 | + } | |
| 947 | + // code | |
| 948 | + if(0==bgr && 0==mx) | |
| 949 | + { | |
| 950 | + LCD_CtrlWrite1_GC9305(0x0036); | |
| 951 | + LCD_DataWrite1_GC9305(0x00); | |
| 952 | + } | |
| 953 | + else if(1==bgr && 1==mx) | |
| 954 | + { | |
| 955 | + LCD_CtrlWrite1_GC9305(0x0036); | |
| 956 | + LCD_DataWrite1_GC9305(0x48); | |
| 957 | + } | |
| 958 | + | |
| 959 | + } | |
| 960 | +} | |
| 961 | + | |
| 962 | + | |
| 963 | +static void display_RGBbar_GC9305(void) | |
| 964 | +{ | |
| 965 | + kal_uint16 LCD_x,LCD_y,n,r; | |
| 966 | +#ifdef __GC9305_DEBUG_TRACE__ | |
| 967 | + kal_prompt_trace(MOD_ENG,"GC9305 display_RGBbar"); | |
| 968 | +#endif | |
| 969 | + #define GC9305_LCD_HEIGHT 800 | |
| 970 | + #define GC9305_LCD_WIDTH 480 | |
| 971 | + | |
| 972 | + | |
| 973 | + LCD_CtrlWrite_GC9305(0x002a); | |
| 974 | + LCD_DataWrite_GC9305((0&0xff00)>>8);//start x | |
| 975 | + LCD_DataWrite_GC9305(0&0x00ff); | |
| 976 | + LCD_DataWrite_GC9305(((GC9305_LCD_WIDTH-1)&0xff00)>>8);//end x | |
| 977 | + LCD_DataWrite_GC9305((GC9305_LCD_WIDTH-1)&0x00ff); | |
| 978 | + | |
| 979 | + LCD_CtrlWrite_GC9305(0x002b); | |
| 980 | + LCD_DataWrite_GC9305((0&0xff00)>>8);//start y | |
| 981 | + LCD_DataWrite_GC9305(0&0x00ff); | |
| 982 | + LCD_DataWrite_GC9305(((GC9305_LCD_HEIGHT-1)&0xff00)>>8);//end y | |
| 983 | + LCD_DataWrite_GC9305((GC9305_LCD_HEIGHT-1)&0x00ff); | |
| 984 | + | |
| 985 | + LCD_CtrlWrite_GC9305(0x002c);//transfor begin | |
| 986 | + | |
| 987 | +#if 0 | |
| 988 | +/* under construction !*/ | |
| 989 | +/* under construction !*/ | |
| 990 | +/* under construction !*/ | |
| 991 | +/* under construction !*/ | |
| 992 | +/* under construction !*/ | |
| 993 | +/* under construction !*/ | |
| 994 | +/* under construction !*/ | |
| 995 | +/* under construction !*/ | |
| 996 | +/* under construction !*/ | |
| 997 | +/* under construction !*/ | |
| 998 | +/* under construction !*/ | |
| 999 | +/* under construction !*/ | |
| 1000 | +#endif | |
| 1001 | + for(LCD_y=0;LCD_y<=GC9305_LCD_HEIGHT-1;LCD_y++) | |
| 1002 | + { | |
| 1003 | + for(LCD_x=0;LCD_x<=GC9305_LCD_WIDTH-1;LCD_x+=1) | |
| 1004 | + { | |
| 1005 | + if(LCD_y<=((GC9305_LCD_HEIGHT-1)/3))//R | |
| 1006 | + { | |
| 1007 | + *(volatile kal_uint32 *) MAIN_LCD_DATA_ADDR= (0x0003F000); | |
| 1008 | + //Delayms(1); | |
| 1009 | + } | |
| 1010 | + else if(LCD_y>=((GC9305_LCD_HEIGHT-1)/3*2))//B | |
| 1011 | + { | |
| 1012 | + *(volatile kal_uint32 *) MAIN_LCD_DATA_ADDR= (0x0000003F) ; | |
| 1013 | + //Delayms(1); | |
| 1014 | + } | |
| 1015 | + else//G | |
| 1016 | + { | |
| 1017 | + *(volatile kal_uint32 *) MAIN_LCD_DATA_ADDR= (0x00000FC0); | |
| 1018 | + //Delayms(1); | |
| 1019 | + } | |
| 1020 | + } | |
| 1021 | + } | |
| 1022 | + //Delayms(500); | |
| 1023 | + | |
| 1024 | +} | |
| 1025 | + | |
| 1026 | +#endif/*LQT_SUPPORT*/ | |
| 1027 | +LCM_IOCTRL_STATUS_ENUM | |
| 1028 | +LCD_IOCTRL_GC9305(LCM_IOCTRL_ID_ENUM ID, void* Parameters) | |
| 1029 | +{ | |
| 1030 | + switch (ID) | |
| 1031 | + { | |
| 1032 | + case LCM_IOCTRL_QUERY__FRAME_RATE: | |
| 1033 | + *((unsigned int *)Parameters) = 66.38; | |
| 1034 | + return LCM_IOCTRL_OK; | |
| 1035 | + | |
| 1036 | + case LCM_IOCTRL_SET__FRAME_RATE: | |
| 1037 | + | |
| 1038 | + return LCM_IOCTRL_NOT_SUPPORT; | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + case LCM_IOCTRL_QUERY__FRAME_MARKER: | |
| 1042 | + | |
| 1043 | + return LCM_IOCTRL_NOT_SUPPORT; | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + case LCM_IOCTRL_SET__FRAME_MARKER: | |
| 1047 | + | |
| 1048 | + return LCM_IOCTRL_NOT_SUPPORT; | |
| 1049 | + | |
| 1050 | + //Fine Tue the FRM_Marker to meet all scenarios tearing free. MUST set command immediately | |
| 1051 | + //LCD_CtrlWrite_GC9305(0x0044);//frame rate control | |
| 1052 | + //LCD_DataWrite_GC9305(((*((unsigned int *)Parameters)+ back_potch)&0xFF00)>>8);//scanline high byte | |
| 1053 | + //LCD_DataWrite_GC9305((*((unsigned int *)Parameters)+ back_potch)&0xFF);//scanline low byte | |
| 1054 | + | |
| 1055 | + /* | |
| 1056 | + //make sure it is the same as LCD_Init_GC9305 | |
| 1057 | + LCD_CtrlWrite_GC9305(0x0044); //set_tear_scanline | |
| 1058 | + LCD_DataWrite_GC9305(((*((unsigned int *)Parameters)+ back_potch)&0xFF00)>>8);////TEP[8] | |
| 1059 | + LCD_DataWrite_GC9305((*((unsigned int *)Parameters)+ back_potch)&0xFF);//TEP[7:0] | |
| 1060 | + | |
| 1061 | + return LCM_IOCTRL_OK; | |
| 1062 | + */ | |
| 1063 | + | |
| 1064 | + break; | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + case LCM_IOCTRL_QUERY__SUPPORT_H_V_SIGNAL_FUNC: | |
| 1068 | + case LCM_IOCTRL_QUERY__SUPPORT_V_PULSE_WIDTH: | |
| 1069 | + case LCM_IOCTRL_QUERY__SUPPORT_H_PULSE_WIDTH: | |
| 1070 | + return LCM_IOCTRL_NOT_SUPPORT; | |
| 1071 | + | |
| 1072 | + case LCM_IOCTRL_QUERY__BACK_PORCH: | |
| 1073 | + *((unsigned int *)Parameters) = 4; | |
| 1074 | + return LCM_IOCTRL_OK; | |
| 1075 | + | |
| 1076 | + case LCM_IOCTRL_QUERY__FRONT_PORCH: | |
| 1077 | + *((unsigned int *)Parameters) = 4; | |
| 1078 | + return LCM_IOCTRL_OK; | |
| 1079 | + | |
| 1080 | + case LCM_IOCTRL_SET__BACK_PORCH: | |
| 1081 | + return LCM_IOCTRL_NOT_SUPPORT; | |
| 1082 | + | |
| 1083 | + case LCM_IOCTRL_SET__FRONT_PORCH: | |
| 1084 | + | |
| 1085 | + return LCM_IOCTRL_NOT_SUPPORT; | |
| 1086 | + | |
| 1087 | + case LCM_IOCTRL_QUERY__TE_EDGE_ATTRIB: | |
| 1088 | + //LCM_TE_ATTRIB_ENUM | |
| 1089 | + *((unsigned int *)Parameters) = LCM_TE_FAILING_EDGE; | |
| 1090 | + return LCM_IOCTRL_OK; | |
| 1091 | + | |
| 1092 | + case LCM_IOCTRL_QUERY__SUPPORT_READBACK_FUNC: | |
| 1093 | + return LCM_IOCTRL_NOT_SUPPORT; | |
| 1094 | + | |
| 1095 | + case LCM_IOCTRL_QUERY__SCANLINE_REG: | |
| 1096 | + return LCM_IOCTRL_NOT_SUPPORT; | |
| 1097 | + | |
| 1098 | + case LCM_IOCTRL_QUERY__IF_CS_NUMBER: | |
| 1099 | + //Return the LCM is ocupied which CS. | |
| 1100 | + *(kal_uint32*) (Parameters) = LCD_IF_PARALLEL_0; | |
| 1101 | + return LCM_IOCTRL_OK; | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + case LCM_IOCTRL_QUERY__SYNC_MODE: | |
| 1106 | + | |
| 1107 | + //Return correct value based on the mode you set in lcd_init_r61509u(~) | |
| 1108 | + | |
| 1109 | + //If you set TE to be VH-Sync mode in lcd_init_r61509u(~)<LCD_CtrlWrite_ILI9481(0x35); LCD_DataWrite_ILI9481(0x01);> | |
| 1110 | + //*(kal_uint32*) (Parameters) = LCM_TE_VHSYNC_MODE; | |
| 1111 | + //return LCM_IOCTRL_OK; | |
| 1112 | + | |
| 1113 | + //If you set TE to be V-Sync mode in lcd_init_r61509u(~)<LCD_CtrlWrite_ILI9481(0x35); LCD_DataWrite_ILI9481(0x00);> | |
| 1114 | + *(kal_uint32*) (Parameters) = LCM_TE_VSYNC_MODE; | |
| 1115 | + return LCM_IOCTRL_OK; | |
| 1116 | + | |
| 1117 | + case LCM_IOCTRL_QUERY__FLIP_MIRROR: | |
| 1118 | + return LCM_IOCTRL_NOT_SUPPORT; | |
| 1119 | + | |
| 1120 | + case LCM_IOCTRL_QUERY__ROTATION: | |
| 1121 | + return LCM_IOCTRL_OK; | |
| 1122 | + case LCM_IOCTRL_QUERY__LCM_WIDTH: | |
| 1123 | + *(kal_uint32*) (Parameters) = 320; | |
| 1124 | + return LCM_IOCTRL_OK; | |
| 1125 | + | |
| 1126 | + case LCM_IOCTRL_QUERY__LCM_HEIGHT: | |
| 1127 | + *(kal_uint32*) (Parameters) = 480; | |
| 1128 | + return LCM_IOCTRL_OK; | |
| 1129 | + | |
| 1130 | + case LCM_IOCTRL_QUERY__LCD_PPI: | |
| 1131 | + *((kal_uint32*)Parameters) = LCM_DPI; | |
| 1132 | + return LCM_IOCTRL_OK; | |
| 1133 | + | |
| 1134 | + default: | |
| 1135 | + return LCM_IOCTRL_NOT_SUPPORT; | |
| 1136 | + } | |
| 1137 | +} | |
| 1138 | + | |
| 1139 | +#ifdef COMBO_LCM_ID_AUTO_DETECT | |
| 1140 | +kal_bool LCM_ID_check_GC9305() | |
| 1141 | +{ | |
| 1142 | +#if 1 | |
| 1143 | + volatile kal_uint16 read_data1,read_data2; | |
| 1144 | + kal_uint16 CheckDrvId; | |
| 1145 | + | |
| 1146 | + DISABLE_LCD_SERIAL_IF_HW_CS;//disable hw cs function | |
| 1147 | + ENABLE_LCD_SERIAL0_CS;//cs low | |
| 1148 | + | |
| 1149 | + *(volatile kal_uint8 *) MAIN_LCD_CMD_ADDR = 0x04; | |
| 1150 | + | |
| 1151 | + SET_LCD_SERIAL0_IF_SIZE(LCD_SCNF_IF_WIDTH_9); | |
| 1152 | + Delayms(1); | |
| 1153 | + read_data1 = *(volatile kal_uint16 *)MAIN_LCD_DATA_ADDR; // | |
| 1154 | + Delayms(1); | |
| 1155 | + SET_LCD_SERIAL0_IF_SIZE(LCD_SCNF_IF_WIDTH_8); | |
| 1156 | + Delayms(1); | |
| 1157 | + read_data1 = *(volatile kal_uint8 *)MAIN_LCD_DATA_ADDR; // | |
| 1158 | + Delayms(1); | |
| 1159 | + read_data2 = *(volatile kal_uint8 *)MAIN_LCD_DATA_ADDR; // | |
| 1160 | + Delayms(1); | |
| 1161 | + | |
| 1162 | + DISABLE_LCD_SERIAL0_CS;//cs low | |
| 1163 | + ENABLE_LCD_SERIAL_IF_HW_CS;//disable hw cs function | |
| 1164 | + | |
| 1165 | + CheckDrvId = (read_data1 <<8)|read_data2; | |
| 1166 | + | |
| 1167 | + if (CheckDrvId == 0x9305) | |
| 1168 | + return KAL_TRUE; | |
| 1169 | + else | |
| 1170 | + return KAL_FALSE; | |
| 1171 | + | |
| 1172 | +#else | |
| 1173 | + volatile kal_uint8 read_data2,read_data3,read_data4,read_data5; | |
| 1174 | + volatile kal_uint16 read_data1; | |
| 1175 | + kal_uint16 CheckDrvId; | |
| 1176 | + kal_uint8 id_index = 0x04; | |
| 1177 | + DCL_HANDLE gpio_handle; | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | +#define SERIVEL_LCM_CS_GPIO 46 | |
| 1182 | + | |
| 1183 | + gpio_handle = DclGPIO_Open(DCL_GPIO, SERIVEL_LCM_CS_GPIO); | |
| 1184 | + DclGPIO_Control(gpio_handle, GPIO_CMD_SET_MODE_0, 0); | |
| 1185 | + DclGPIO_Close(gpio_handle); | |
| 1186 | + | |
| 1187 | + GPIO_ModeSetup(SERIVEL_LCM_CS_GPIO, 0); | |
| 1188 | + GPIO_InitIO(1, SERIVEL_LCM_CS_GPIO); | |
| 1189 | + GPIO_WriteIO(0, SERIVEL_LCM_CS_GPIO); | |
| 1190 | + /******此处为了手动将CS拉低,假设使用GPIO46作为CS线********/ | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + /******选择SDA的Input source********/ | |
| 1194 | + REG_LCD_SIF_PAD_SEL_REG = 0x00000000; //0x00020000 | |
| 1195 | + /******选择SDA的Input source********/ | |
| 1196 | + | |
| 1197 | + while (LCD_IS_RUNNING); | |
| 1198 | + *(volatile kal_uint8 *) MAIN_LCD_CMD_ADDR = 0x04;// id_index; | |
| 1199 | + /******因为ST7735S反馈第一个bit为dummy bit,因此切换interface的width为9,且定义read_data1为kal_uint16,将dummy bit读回来********/ | |
| 1200 | + SET_LCD_SERIAL0_IF_SIZE(LCD_SCNF_IF_WIDTH_9); | |
| 1201 | + Delayms(1); | |
| 1202 | + read_data1 = *(volatile kal_uint16 *)MAIN_LCD_DATA_ADDR; // | |
| 1203 | + Delayms(1); | |
| 1204 | + /******因为ST7735S反馈第一个bit为dummy bit,因此切换interface的width为9,且定义read_data1为kal_uint16,将dummy bit读回来********/ | |
| 1205 | + /******之后ST7735S反馈的ID都是8bit宽度的值,因此,再将interface的width切为8.********/ | |
| 1206 | + SET_LCD_SERIAL0_IF_SIZE(LCD_SCNF_IF_WIDTH_8); | |
| 1207 | + Delayms(1); | |
| 1208 | + read_data2 = *(volatile kal_uint8 *)MAIN_LCD_DATA_ADDR; | |
| 1209 | + Delayms(1); | |
| 1210 | + read_data3 = *(volatile kal_uint8 *)MAIN_LCD_DATA_ADDR; | |
| 1211 | + Delayms(1); | |
| 1212 | + read_data4 = *(volatile kal_uint8 *)MAIN_LCD_DATA_ADDR; | |
| 1213 | + | |
| 1214 | + CheckDrvId = (read_data2 <<8)|read_data3; | |
| 1215 | + //CheckDrvId = (kal_uint16)(tmp_data >> 8); | |
| 1216 | + while (LCD_IS_RUNNING); | |
| 1217 | + | |
| 1218 | + /******将CS模式切换为HW CS mode********/ | |
| 1219 | + //GPIO_ModeSetup(SERIVEL_LCM_CS_GPIO, 1); | |
| 1220 | + GPIO_ModeSetup(SERIVEL_LCM_CS_GPIO, 1); | |
| 1221 | + gpio_handle = DclGPIO_Open(DCL_GPIO, SERIVEL_LCM_CS_GPIO); | |
| 1222 | + DclGPIO_Control(gpio_handle, GPIO_CMD_SET_MODE_1, 0); | |
| 1223 | + DclGPIO_Close(gpio_handle); | |
| 1224 | + /******将CS模式切换为HW CS mode********/ | |
| 1225 | + if (CheckDrvId == 0x9305) | |
| 1226 | + return KAL_TRUE; | |
| 1227 | + else | |
| 1228 | + return KAL_FALSE; | |
| 1229 | +#endif | |
| 1230 | +} | |
| 1231 | +#endif | |
| 1232 | + | |
| 1233 | +LCD_Funcs LCD_func_GC9305 = { | |
| 1234 | + | |
| 1235 | + LCD_Init_GC9305, //lqw | |
| 1236 | + LCD_PWRON_GC9305, | |
| 1237 | + LCD_SetContrast_GC9305, | |
| 1238 | + LCD_ON_GC9305, | |
| 1239 | + LCD_BlockWrite_GC9305, | |
| 1240 | + LCD_Size_GC9305, | |
| 1241 | + LCD_EnterSleep_GC9305, | |
| 1242 | + LCD_ExitSleep_GC9305, | |
| 1243 | + LCD_Partial_On_GC9305, | |
| 1244 | + LCD_Partial_Off_GC9305, | |
| 1245 | + LCD_Partial_line_GC9305, | |
| 1246 | + /*Engineering mode*/ | |
| 1247 | + LCD_GetParm_GC9305, | |
| 1248 | + LCD_SetBias_GC9305, | |
| 1249 | + LCD_Contrast_GC9305, | |
| 1250 | + LCD_LineRate_GC9305, | |
| 1251 | + LCD_Temp_Compensate_GC9305 | |
| 1252 | +#ifdef LCM_ROTATE_SUPPORT | |
| 1253 | + ,LCD_Set_Scan_Direction_GC9305 | |
| 1254 | +#endif | |
| 1255 | +#ifdef LQT_SUPPORT/*Please don't remove LQT code segments*/ | |
| 1256 | + ,LCD_gamma_test_GC9305 | |
| 1257 | + ,LCD_flicker_test_GC9305 | |
| 1258 | +#endif | |
| 1259 | + ,0 // NULL function for SetFrmMarker Function. | |
| 1260 | + ,LCD_IOCTRL_GC9305 | |
| 1261 | +}; | |
| 1262 | + | |
| 1263 | +void LCD_FunConfig_GC9305(void) | |
| 1264 | +{ | |
| 1265 | + MainLCD = &LCD_func_GC9305; | |
| 1266 | +} | |
| 1267 | + | |
| 1268 | +#ifdef __LCM_AT_TEST__ // Add by hesong 0225 | |
| 1269 | +void at_command_test_lcm(kal_uint32 *d) | |
| 1270 | +{ | |
| 1271 | +#ifdef __GC9305_DEBUG_TRACE__ | |
| 1272 | + kal_prompt_trace(MOD_ENG,"at_command_test_lcm %d",d[1]); | |
| 1273 | +#endif | |
| 1274 | + switch(d[1]){ | |
| 1275 | + case 2: | |
| 1276 | + /*LCD-test-002 | |
| 1277 | + No fricker | |
| 1278 | + 确保开机过程和IDLE界面屏不会闪, 可尋求IC vendor協助或 | |
| 1279 | + 自行調整frame rate/COM_H and COM_L, 參考page "Flicker Test Code" | |
| 1280 | + */ | |
| 1281 | + LCD_flicker_test_GC9305(d[2]);//255/200/160 | |
| 1282 | + break; | |
| 1283 | + | |
| 1284 | + case 3: | |
| 1285 | + /*LCD-test-003 | |
| 1286 | + WR toggle with CS1(CS0不toggle) | |
| 1287 | + 在Init後,特意去用CS1 Port去更改LCD IC Register(例如Scan direction, Color format...), | |
| 1288 | + 確定對CS0上的LCM無影? | |
| 1289 | + */ | |
| 1290 | + LCD_CS_Test_GC9305(d[2],d[3],d[4]); | |
| 1291 | + | |
| 1292 | + break; | |
| 1293 | + case 4: | |
| 1294 | + /*LCD-test-004 | |
| 1295 | + LCD 1-pixel Frame test | |
| 1296 | + 最外圍1-pixel?度?的特殊檢?pattern, | |
| 1297 | + 檢查可能的IC起始pixel/line傳?方式錯誤, | |
| 1298 | + 檢查TFT上的layout?題,可參考page"LCD 1-pixel Frame test coding" | |
| 1299 | + */ | |
| 1300 | + LCD_Frame_Pixel_Test_GC9305(); | |
| 1301 | + break; | |
| 1302 | + | |
| 1303 | + case 7: | |
| 1304 | + /*LCD-test-007 | |
| 1305 | + sleep in status OK. | |
| 1306 | + 能正确进入sleep状态 | |
| 1307 | + (若有?流?的?,應?能確認?IC耗??流達到spec.需求) | |
| 1308 | + */ | |
| 1309 | + LCD_EnterSleep_GC9305(); | |
| 1310 | + break; | |
| 1311 | + case 8: | |
| 1312 | + /*LCD-test-008 | |
| 1313 | + Sleep-in with CS/WR toggle | |
| 1314 | + lcd 进入睡眠后,用AT Cmd给LCM发命令或数据(非睡眠序列), | |
| 1315 | + 不会导致LCM死机, ,某些LCD IC在进入Sleep-in时只是将Power关掉, | |
| 1316 | + 内部逻辑电压依旧可以起作用,所以在sleep-in時设置Mode Register | |
| 1317 | + 有可能有作用。因此這?測?可以敘述IC在Sleep-in時是否能接收Command | |
| 1318 | + */ | |
| 1319 | + display_RGBbar_GC9305(); | |
| 1320 | + break; | |
| 1321 | + case 9: | |
| 1322 | + /*LCD-test-009 | |
| 1323 | + sleep out success | |
| 1324 | + 能正确退出睡眠状态 | |
| 1325 | + */ | |
| 1326 | + LCD_ExitSleep_GC9305(); | |
| 1327 | + | |
| 1328 | + break; | |
| 1329 | + case 15: | |
| 1330 | + /*LCD-test-015 | |
| 1331 | + Read GRAM function OK | |
| 1332 | + 能正常用AT Command去读GRAM的数据 | |
| 1333 | + */ | |
| 1334 | + | |
| 1335 | + LCD_Read_GRAM_GC9305(d[2],d[3],d[4],d[5]); | |
| 1336 | + break; | |
| 1337 | + | |
| 1338 | + case 16: | |
| 1339 | + /*LCD-test-016 | |
| 1340 | + Read Register function OK | |
| 1341 | + 能讀回正常的Chip ID | |
| 1342 | + */ | |
| 1343 | + LCD_Read_ID_GC9305(); | |
| 1344 | + break; | |
| 1345 | + | |
| 1346 | + case 0xFE: | |
| 1347 | + LCD_CtrlWrite_GC9305(0x0028);//display off | |
| 1348 | +#ifdef __GC9305_DEBUG_TRACE__ | |
| 1349 | + kal_prompt_trace(MOD_ENG,"display off"); | |
| 1350 | +#endif | |
| 1351 | + break; | |
| 1352 | + case 0xFF: | |
| 1353 | + LCD_CtrlWrite_GC9305(0x0029);//display on | |
| 1354 | +#ifdef __GC9305_DEBUG_TRACE__ | |
| 1355 | + kal_prompt_trace(MOD_ENG,"display on"); | |
| 1356 | +#endif | |
| 1357 | + break; | |
| 1358 | + default: | |
| 1359 | +#ifdef __GC9305_DEBUG_TRACE__ | |
| 1360 | + kal_prompt_trace(MOD_ENG,"woo...default!"); | |
| 1361 | +#endif | |
| 1362 | + break; | |
| 1363 | + } | |
| 1364 | +} | |
| 1365 | +#endif | |
| 1366 | + | |
| 1367 | +#endif | ... | ... |
custom/drv/LCD/KEYTAK61D_GB_11C_LCM/lcd_sw.h
100644 → 100755
| ... | ... | @@ -158,7 +158,8 @@ extern kal_uint32 back_potch ; |
| 158 | 158 | //#define __TOPWELL_HW_LCD_240X320_T326_ST7789S_BASE__ |
| 159 | 159 | |
| 160 | 160 | #elif defined(__TOPWELL_T3212_B32_MBR__) |
| 161 | - #define __TOPWELL_HW_LCD_240X320_T3212_ILI9341V_BASE_CTC__ | |
| 161 | + //#define __TOPWELL_HW_LCD_240X320_T3212_ILI9341V_BASE_CTC__ | |
| 162 | + #define __TOPWELL_HW_LCD_240X320_T3212_GC9305_IVO__ | |
| 162 | 163 | |
| 163 | 164 | #elif defined(__TOPWELL_T3211_C8_TWL__) |
| 164 | 165 | #define __TOPWELL_HW_LCD_240X320_T303_GC9301_YC_CMO__ //temp use |
| ... | ... | @@ -270,8 +271,9 @@ extern kal_uint32 back_potch ; |
| 270 | 271 | #define __TOPWELL_HW_LCD_IC_ST7789S__ |
| 271 | 272 | #endif |
| 272 | 273 | |
| 273 | -#if defined(__TOPWELL_HW_LCD_240X320_T303_ILI9341_WT_CTC__)||defined(__TOPWELL_HW_LCD_240X320_T351_ILI9341_BASE__)||defined(__TOPWELL_HW_LCD_240X320_T326_ILI9341_ZJGD__)||defined(__TOPWELL_HW_LCD_240X320_T3211_ILI9341_JD__)||defined(__TOPWELL_HW_LCD_240X320_T3212_ILI9341V_BASE_CTC__) | |
| 274 | - #define __TOPWELL_HW_LCD_IC_ILI9341__ | |
| 274 | +#if defined(__TOPWELL_HW_LCD_240X320_T303_ILI9341_WT_CTC__)||defined(__TOPWELL_HW_LCD_240X320_T351_ILI9341_BASE__)||defined(__TOPWELL_HW_LCD_240X320_T326_ILI9341_ZJGD__)||defined(__TOPWELL_HW_LCD_240X320_T3211_ILI9341_JD__)||defined(__TOPWELL_HW_LCD_240X320_T3212_ILI9341V_BASE_CTC__)|| defined(__TOPWELL_HW_LCD_240X320_T3212_GC9305_IVO__) | |
| 275 | + //#define __TOPWELL_HW_LCD_IC_ILI9341__ | |
| 276 | + #define __TOPWELL_HW_LCD_IC_GC9305__ | |
| 275 | 277 | #endif |
| 276 | 278 | |
| 277 | 279 | #if defined(__TOPWELL_HW_LCD_240X320_T303_GC9301_YC_CMO__)||defined(__TOPWELL_HW_LCD_240X320_T351_GC9301_BASE__)||defined(__TOPWELL_HW_LCD_240X320_T326_GC9301_BASE__) |
| ... | ... | @@ -350,7 +352,10 @@ extern kal_uint32 back_potch ; |
| 350 | 352 | #endif |
| 351 | 353 | #if defined(__TOPWELL_HW_LCD_IC_GC9304__) |
| 352 | 354 | GC9304, |
| 353 | - #endif | |
| 355 | + #endif | |
| 356 | + #if defined(__TOPWELL_HW_LCD_IC_GC9305__) | |
| 357 | + GC9305, | |
| 358 | + #endif | |
| 354 | 359 | #if defined(__TOPWELL_HW_LCD_IC_ST7775R__) |
| 355 | 360 | ST7775R, |
| 356 | 361 | #endif |
| ... | ... | @@ -387,7 +392,8 @@ extern kal_uint32 back_potch ; |
| 387 | 392 | #define SERIAL_LCM_3WIRE_2_DATA_LANE |
| 388 | 393 | |
| 389 | 394 | #else |
| 390 | -#define SERIAL_LCM_4WIRE_1_DATA_LANE | |
| 395 | +//#define SERIAL_LCM_4WIRE_1_DATA_LANE | |
| 396 | +#define SERIAL_LCM_3WIRE_2_DATA_LANE | |
| 391 | 397 | |
| 392 | 398 | #endif |
| 393 | 399 | ... | ... |
Please
register
or
login
to post a comment