1 /******************************************************************************
5 ** Copyright: 2003 Spreatrum, Incoporated. All Rights Reserved. *
7 ******************************************************************************
9 ******************************************************************************
11 ** ------------------------------------------------------------------------- *
12 ** DATE NAME DESCRIPTION *
13 ** 08/21/2003 Jim zhang Create. *
14 ******************************************************************************/
20 /**---------------------------------------------------------------------------*
22 **---------------------------------------------------------------------------*/
24 #include "sci_types.h"
25 #include "com_drvapi.h"
28 #if defined(PLATFORM_SC6800H) || defined(PLATFORM_SC8800G)|| defined(CONFIG_SC8810)
29 #include "lcdc_types.h"
31 /**---------------------------------------------------------------------------*
33 **---------------------------------------------------------------------------*/
45 LCD_ROT_MODE_LCD = 0x00,
55 ERR_LCD_NONE = 0, // Success,no error
56 ERR_LCD_FUNC_NOT_SUPPORT, // LCD not support this function
57 ERR_LCD_PARAMETER_WRONG, // Parameter is wrong
58 ERR_LCD_POINTER_NULL, // Input pointer is PNULL
59 ERR_LCD_OPERATE_FAIL, // Operate fail
60 ERR_LCD_NOT_FOUND, // LCD not found
61 ERR_LCD_SELPIN_WRONG, // LCD SELPIN WRONG
62 ERR_LCD_SPEC_WRONG // LCD SPEC WRONG
67 CMD_LEVEL = 0, //command:0, data:1. nomal
68 DATA_LEVEL = 1 //command:1, data:0.
96 LCD_CTRL_MODULE_LCDC = 0 , //LCDC
97 LCD_CTRL_MODULE_LCM , //LCM
98 LCD_CTRL_MODULE_LCDC_LCM0, //LCDC+LCM0
113 LCD_DIRECT_NORMAL = 0x00,
114 LCD_DIRECT_ROT_90, // Rotation 90
115 LCD_DIRECT_ROT_180, // Rotation 180
116 LCD_DIRECT_ROT_270, // Rotation 270
117 LCD_DIRECT_MIR_H, // Mirror horizontal
118 LCD_DIRECT_MIR_V, // Mirror vertical
119 LCD_DIRECT_MIR_HV, // Mirror horizontal and vertical
135 TV_ID , //be used for TVOUT
136 MAX_LCD_ID //Reserved, can not be used by user.
139 /**---------------------------------------------------------------------------*
141 **---------------------------------------------------------------------------*/
144 // lcd information struct, which will be useful for upper layer.
145 typedef union _LCD_TIMING_U
147 struct RGB_LCD_TIMING_tag
149 uint16 bfw; //Beginning-of-Frame Horizontal Sync Clock Wait Count-1
150 uint16 efw; //End-of-Frame Horizontal Sync Clock Wait Count-1
151 uint16 vsw; //Vertical Sync Pulse Width - 1
152 uint16 blw; //Beginning-of-Line Pixel Clock Wait Count -1
153 uint16 elw; //End-of-Line Pixel Clock Wait Count -1
154 uint16 hsw; //Horizontal Sync Pulse Width - 1
156 struct MCU_LCD_TIMING_tag
158 uint16 rcss;// CS setup time for LCM read (optional)
159 uint16 rlpw;// low pulse width for LCM read (according spec)
160 uint16 rhpw;// high pulse width for LCM read (according spec)
161 uint16 wcss;// CS setup time for LCM write (optional)
162 uint16 wlpw;// low pulse width for LCM write (according spec)
163 uint16 whpw;// high pulse width for LCM write (according spec)
169 typedef struct lcd_operations_tag
171 ERR_LCD_E (*lcd_Init) (void);
172 ERR_LCD_E (*lcd_EnterSleep) (BOOLEAN is_sleep);
173 ERR_LCD_E (*lcd_SetContrast) (uint16 contrast);
174 ERR_LCD_E (*lcd_SetBrightness) (uint16 brightness);
175 ERR_LCD_E (*lcd_SetDisplayWindow) (uint16 left, uint16 top, uint16 right, uint16 bottom);
176 ERR_LCD_E (*lcd_InvalidateRect) (uint16 left, uint16 top, uint16 right, uint16 bottom);
177 ERR_LCD_E (*lcd_Invalidate) (void);
178 void (*lcd_Close) (void);
179 ERR_LCD_E (*lcd_RotationInvalidateRect) (uint16 left, uint16 top, uint16 right, uint16 bottom, LCD_ANGLE_E angle);
180 ERR_LCD_E (*lcd_SetBrushDirection) (LCD_DIRECT_E direct_type);
181 void (*lcd_Rst) (void);
184 typedef struct lcd_spec_tag
188 LCD_MODE_T mode; // rgb or mcu
189 LCD_BUS_MODE_T bus_mode;
190 LCD_BUS_WIDTH_T bus_width;
191 LCD_TIMING_U *timing; // lcd read/write timing parameter
192 LCD_OPERATIONS_T *operation;
193 } LCD_SPEC_T, *LCD_SPEC_T_PTR;
197 uint16 cs_pin; // cs pin connected with LCM
198 uint16 cd_pin; // cd pin connected with LCM
199 LCD_CTRL_MODULE_E controller;
200 LCD_SPEC_T_PTR spec_ptr;
201 } LCD_SPEC_INFO_T,*LCD_SPEC_INFO_T_PTR;
203 typedef struct _lcd_simple_init_param_tag
207 uint32 interface_type; // 0: 8080;1: 6800
209 uint32 lcd_bits;//0£º16bit ;1£º18bit;2: 8bit;3: 9bit
211 LCD_CTRL_MODULE_E controller;
212 } LCD_SIMPLE_INIT_PARAM_T;
213 /**---------------------------------------------------------------------------*
214 ** Function Prototypes
215 **---------------------------------------------------------------------------*/
217 /******************************************************************************/
218 // Description: return the lcd driver funtion pointer
219 // Global resource dependence:
222 /******************************************************************************/
223 PUBLIC LCD_OPERATIONS_T **LCD_GetOperations (void);
225 /******************************************************************************/
226 // Description: return the sub lcd buffer pointer
227 // Global resource dependence:
230 /******************************************************************************/
231 PUBLIC void *LCD_GetSubLCDBuffer (void);
233 /******************************************************************************/
234 // Description: return the main lcd buffer pointer
235 // Global resource dependence:
238 /******************************************************************************/
239 PUBLIC void *LCD_GetLCDBuffer (void);
241 /******************************************************************************/
242 // Description: let the main lcd display on to display assert information
243 // Global resource dependence:
246 /******************************************************************************/
247 PUBLIC void LCD_DisplayOn (void);
249 /*****************************************************************************/
250 // Description: Get LCD number int the system.
251 // Global resource dependence:
252 // Author: Younger.Yang
254 /*****************************************************************************/
255 PUBLIC uint32 LCD_GetUsedNum (void);
257 /*******************************************************************************/
259 // Global resource dependence:
260 // Author: Younger.yang
262 /********************************************************************************/
263 PUBLIC uint32 LCD_GetBusRatio (void);
264 /*******************************************************************************/
266 // Global resource dependence:
267 // Author: Ming.zhang & Younger.yang
269 /********************************************************************************/
271 PUBLIC void LCD_Wait (uint32 ms);
273 /*********************************************************************/
274 // Description: Read LCD ID
275 // Global resource dependence:
276 // Author: Younger.Yang
277 // Note: You may read LCD ID before lcd init,otherwise
278 // the read data may be incorrect.
279 /*********************************************************************/
280 PUBLIC uint32 LCD_Read_ID (uint32 lcd_cs, uint32 lcd_cd);
283 /*****************************************************************************/
284 // Description: LCD Reg Info
285 // Global resource dependence:
286 // Author: Younger.Yang
288 /*****************************************************************************/
290 PUBLIC void LCD_RegInfo (LCD_ID_E lcd_id, LCD_SPEC_INFO_T_PTR lcd_spec_ptr);
292 /*****************************************************************************/
293 // Description: clear the whole lcd to one color.
294 // Global resource dependence:
297 /*****************************************************************************/
298 PUBLIC void LCD_Clear (
299 LCD_ID_E lcd_id, //id of lcd to operate.
300 uint32 color //color to fill the whole lcd.
303 /**********************************************************************************************************/
304 // Description: send command to lcd
305 // Global resource dependence: g_lcdc_mode
306 // Author: Jianping.wang
308 // lcd_id parameter is used when lcdc mcu mode
315 /**********************************************************************************************************/
316 PUBLIC int32 LCD_SendCmd (uint32 cmd,uint32 lcd_id);
318 /**********************************************************************************************************/
319 // Description: send display data to LCD
320 // Global resource dependence: g_lcdc_mode
321 // Author: Jianping.wang
323 // this interface is used in lcdc mcu mode
325 // lcd_data - display data
330 /**********************************************************************************************************/
331 PUBLIC int32 LCD_SendData (uint32 lcd_data,uint32 lcd_id);
333 /**********************************************************************************************************/
334 // Description: send the command and data to LCD
335 // Global resource dependence: g_lcdc_mode
336 // Author: Jianping.wang
340 // lcd_data - lcd command data
341 // lcd_id - only is used for lcdc mcu mode
345 /**********************************************************************************************************/
346 PUBLIC int32 LCD_SendCmdData (uint32 cmd,uint32 lcd_data,uint32 lcd_id);
348 /**********************************************************************************************************/
349 // Description:Read data from lcm
350 // Global resource dependence: NONE
351 // Author: Younger.yang
353 // this interface is read data from lcm
355 // index_value - cd value
356 // lcd_id-MAIN_LCD_ID/SUB_LCD_ID
360 /**********************************************************************************************************/
361 PUBLIC uint32 LCD_ReadRegVal (uint32 lcd_id,uint32 reg_addr);
364 /*****************************************************************************/
365 // Description: Set LCD invalidate direction
370 // Note: Application should correct invalidate direction right after current
372 // Author: Younger.Yang
374 /*****************************************************************************/
376 PUBLIC ERR_LCD_E LCD_SetDirection (
377 LCD_ID_E lcd_id,//ID of lcd to operate
378 LCD_DIRECT_E direct_type
381 /*****************************************************************************/
382 // Description: LCD delay
383 // Global resource dependence:
386 /*****************************************************************************/
387 PUBLIC void LCD_Delayms (uint32 ms);
390 PUBLIC ERR_LCD_E LCD_Init (void);
391 /**********************************************************************************************************/
392 // Description:Read data from lcm
393 // Global resource dependence: NONE
394 // Author: Jianping.Wang
396 // this interface is read data from lcm
398 // param_ptr - parameter pointer
400 // ERR_LCD_NONE,if success
402 /**********************************************************************************************************/
403 PUBLIC ERR_LCD_E LCD_SimpleInit (LCD_SIMPLE_INIT_PARAM_T *param_ptr);
404 #if defined(PLATFORM_SC6800H) || defined(PLATFORM_SC8800G)|| defined(CONFIG_SC8810)
405 /*****************************************************************************/
406 // Description: config lcd block of 6800h
407 // Global resource dependence:
410 /*****************************************************************************/
411 PUBLIC ERR_LCD_E LCD_ConfigBlockEx (LCD_ID_E lcd_id, LCD_LAYER_ID_E layer_id,
412 void *blk_param_ptr);
415 /*****************************************************************************/
416 // Description: config capture parameters of 6800h
417 // Global resource dependence:
418 // Author: Jianping.wang
420 /*****************************************************************************/
421 //PUBLIC ERR_LCD_E LCD_ConfigCapture(LCD_ID_E lcd_id, LCD_CAP_PARAM_T *param_ptr);
424 /**---------------------------------------------------------------------------*
426 **---------------------------------------------------------------------------*/