1 /******************************************************************************
5 ** Copyright: 2003 Spreatrum, Incoporated. All Rights Reserved. *
7 ******************************************************************************
9 ******************************************************************************
11 ** ------------------------------------------------------------------------- *
12 ** DATE NAME DESCRIPTION *
13 ** 08/21/2003 Jim zhang Create. *
14 ******************************************************************************/
17 #ifndef _LCD_CONTROLLER_H_
18 #define _LCD_CONTROLLER_H_
20 /**---------------------------------------------------------------------------*
22 **---------------------------------------------------------------------------*/
23 #include "sci_types.h"
24 #include "lcdc_data_type.h"
28 /**---------------------------------------------------------------------------*
30 **---------------------------------------------------------------------------*/
36 /**---------------------------------------------------------------------------*
38 **---------------------------------------------------------------------------*/
43 TV_PAL_LINE_BY_LINE = 0 ,
44 TV_PAL_INTERLEAVING_LINE ,
45 TV_NTSC_LINE_BY_LINE ,
46 TV_NTSC_INTERLEAVING_LINE
51 * Funtion pointer struct
55 /**---------------------------------------------------------------------------*
57 **---------------------------------------------------------------------------*/
60 /**---------------------------------------------------------------------------*
61 ** Function Prototypes
62 **---------------------------------------------------------------------------*/
65 /******************************************************************************/
66 /* LCDC Controller Driver Interfaces */
67 /******************************************************************************/
68 /**********************************************************************************************************/
69 // Description: set LCDC work mode and lcd infomation
70 // Global resource dependence: g_lcdc_type
71 // Author: Jianping.wang
73 // p_lcdc - pointer to info structure
74 /**********************************************************************************************************/
75 PUBLIC void LCDC_SetLcdType (LCDC_TYPE_T *lcdc_ptr, uint32 lcd_cs);
76 /**********************************************************************************************************/
77 // Description: set lcd display block information
78 // Global resource dependence:
79 // Author: Jianping.wang
81 // operation successes,provided use correct access mask
83 // p_blk - pointer to display block information
84 // p_mask - pointer to block access mask
88 /**********************************************************************************************************/
89 PUBLIC int32 LCDC_SetLcdBlock (LCD_BLOCK_T *blk_ptr,uint32 *mask_ptr);
90 /**********************************************************************************************************/
91 // Description: initialize LCDC
92 // Global resource dependence: g_lcdc_mode
93 // Author: Jianping.wang
95 /**********************************************************************************************************/
96 PUBLIC int32 LCDC_Init (void);
97 /**********************************************************************************************************/
98 // Description: configure LCDC
99 // Global resource dependence: g_lcdc_mode
100 // Author: Jianping.wang
103 // spec_ptr - pointer to LCD information struction
107 /**********************************************************************************************************/
108 PUBLIC int32 LCDC_Configure (LCDC_SPEC_T *spec_ptr);
109 /**********************************************************************************************************/
110 // Description: get LCDC configure information that is related with LCD
111 // Global resource dependence: g_lcdc_mode
112 // Author: Jianping.wang
117 // p_spec - pointer to information structure
121 /**********************************************************************************************************/
122 PUBLIC int32 LCDC_GetInfo (LCDC_INFO_T *info_ptr);
123 /**********************************************************************************************************/
124 // Description: send the command and data to LCD
125 // Global resource dependence: g_lcdc_mode
126 // Author: Jianping.wang
130 // lcd_data - lcd command data
131 // lcd_id - only is used for lcdc mcu mode
135 /**********************************************************************************************************/
136 PUBLIC int32 LCDC_SendCmdData (uint32 cmd,uint32 lcd_data,uint32 lcd_id);
137 /**********************************************************************************************************/
138 // Description: send command to lcd
139 // Global resource dependence: g_lcdc_mode
140 // Author: Jianping.wang
142 // lcd_id parameter is used when lcdc mcu mode
149 /**********************************************************************************************************/
150 PUBLIC int32 LCDC_SendCmd (uint32 cmd,uint32 lcd_id);
151 /**********************************************************************************************************/
152 // Description: send display data to LCD
153 // Global resource dependence: g_lcdc_mode
154 // Author: Jianping.wang
156 // this interface is used in lcdc mcu mode
158 // lcd_data - display data
163 /**********************************************************************************************************/
164 PUBLIC int32 LCDC_SendData (uint32 lcd_data,uint32 lcd_id);
165 /**********************************************************************************************************/
166 // Description: get LCD index register value
167 // Global resource dependence: g_lcdc_mode
168 // Author: Jianping.wang
170 // lcd_id parameter is used when lcdc mcu mode
175 // data_ptr - pointer to data that is LCD index register value
179 /**********************************************************************************************************/
180 PUBLIC int32 LCDC_ReadLcdIndex (uint32 *data_ptr,uint32 cmd,uint32 lcd_id);
181 /**********************************************************************************************************/
182 // Description: start LCDC to write display data to LCD or TV
183 // Global resource dependence: g_lcdc_mode
186 // lcd_id parameter is used when lcdc mcu mode
188 // lcd_width - lcd width
189 // lcd_height - lcd height
194 /**********************************************************************************************************/
195 PUBLIC int32 LCDC_TransCmd (uint16 lcd_width,uint16 lcd_height,uint32 lcd_cs);
196 /**********************************************************************************************************/
198 // Global resource dependence:
199 // Author: Jianping.wang
201 /**********************************************************************************************************/
202 PUBLIC void LCDC_GetConfigInfo (LCDC_CONFIG_T *cfg_ptr);
203 /**********************************************************************************************************/
205 // Global resource dependence:
206 // Author: Jianping.wang
208 /**********************************************************************************************************/
209 PUBLIC void LCDC_SetConfig (LCDC_CONFIG_T *cfg_ptr);
210 /**********************************************************************************************************/
211 // Description: initialize LCDC TV mode
212 // Global resource dependence: g_lcd_background
213 // Author: Jianping.wang
215 // lcdc tv mode is prior to mcu mode and rgb mode
216 /**********************************************************************************************************/
217 PUBLIC int32 LCDC_StartTv (uint32 tv_mode);
218 /**********************************************************************************************************/
219 // Description: close LCDC TV mode,resume to LCDC rgb mode or mcu mode
220 // Global resource dependence: g_lcdc_mode
221 // Author: Jianping.wang
223 /**********************************************************************************************************/
224 PUBLIC void LCDC_CloseTv (void);
225 /**********************************************************************************************************/
226 // Description: reset LCD
227 // Global resource dependence: g_lcdc_mode
228 // Author: Jianping.wang
230 // delay_ms parameter is used in lcdc mcu mode
232 // delay_ms - delay time(ms)
236 /**********************************************************************************************************/
237 PUBLIC int32 LCDC_ResetLcd (uint32 delay_ms);
238 /**********************************************************************************************************/
239 // Description: select lcdc output data flow
240 // Global resource dependence:
241 // Author: Jianping.wang
243 // this function is used in lcdc rgb mode
244 // feed_back - 1:LCDC output data to ISP module
245 // 0:LCDC don't output data to ISP
246 // disable_lcdout - 1:disable lcdc output to lcd
247 // 0:enable lcdc output to lcd
248 /**********************************************************************************************************/
249 PUBLIC void LCDC_ConfigDataFlow (uint32 feed_back,uint32 disable_lcdout);
250 /**********************************************************************************************************/
251 // Description: adjust transfer timing
252 // Global resource dependence:
253 // Author: Jianping.wang
256 /**********************************************************************************************************/
257 PUBLIC int32 LCDC_ChangePulseWidth (LCD_MODE_T mode, uint32 cs_id, LCD_TIMING_U timing_para);
258 /**********************************************************************************************************/
259 // Description: close LCDC
260 // Global resource dependence:
261 // Author: jianping.wang
263 // flag - 1:disable lcdc;0:enable lcdc
264 //---------------------------------------------------------------------------------------------------------
265 PUBLIC void LCDC_Close (uint32 flag);
266 /**********************************************************************************************************/
267 // Description: set color correction matrix in rgb mode and mcu mode;
268 // or set rgb to yuv conversion matrix in tv mode
269 // Global resource dependence:
270 // Author: Jianping.wang
272 // matrix_ptr - pointer to the matrix that is color correct matrix,or rgb to yuv conversion matrix
273 /**********************************************************************************************************/
274 PUBLIC void LCDC_SetColorMatrix (COLORMATRIX_T *matrix_ptr);
275 /**********************************************************************************************************/
276 // Description: updata tv display
277 // Global resource dependence:
278 // Author: Jianping.wang
280 /**********************************************************************************************************/
281 PUBLIC void LCDC_RefreshTv (void);
282 /**********************************************************************************************************/
283 // Description: start LCDC,use background refresh LCD
284 // Global resource dependence:
285 // Author: Jianping.wang
287 /**********************************************************************************************************/
288 PUBLIC void LCDC_Start (void);
289 /**********************************************************************************************************/
290 // Description: Update LCDC Register setting
291 // Global resource dependence:
292 // Author: Jianping.wang
294 /**********************************************************************************************************/
295 PUBLIC void LCDC_UpdateRegisters (void);
296 /**********************************************************************************************************/
297 // Description: set LCD background color
298 // Global resource dependence:
299 // Author: Jianping.wang
301 /**********************************************************************************************************/
302 PUBLIC void LCDC_SetBackground (uint32 color);
303 /**********************************************************************************************************/
304 // Description: disable use display block
305 // Global resource dependence: g_lcd_blk
306 // Author: Jianping.wang
308 /**********************************************************************************************************/
309 PUBLIC void LCDC_DisableLcdBlock (void);
310 /**********************************************************************************************************/
311 // Description: software reset LCDC and TV Encoder
312 // Global resource dependence:
313 // Author: Jianping.wang
315 /**********************************************************************************************************/
316 PUBLIC void LCDC_Reset (void);
317 /**********************************************************************************************************/
318 // Description: Check if LCDC finish one brush LCD operation or not
319 // Global resource dependence:
320 // Author: Jianping.wang
324 // return - 1:finish brush operation
325 // 0:don't finish brush operation
326 /**********************************************************************************************************/
327 PUBLIC BOOLEAN LCDC_CheckBrushLcdStatue (void);
328 /**********************************************************************************************************/
330 // Global resource dependence:
331 // Author: Jianping.wang
333 /**********************************************************************************************************/
334 PUBLIC void LCDC_ClearStatus (void);
335 /**********************************************************************************************************/
337 // Global resource dependence:
338 // Author: Jianping.wang
341 // is_open_rst - 1:open rst pin of lcd
342 // 0:close rst pin of lcd
343 /**********************************************************************************************************/
344 PUBLIC void LCDC_SelectRstFuc (BOOLEAN is_open_rst);
345 /**********************************************************************************************************/
346 // Description: LCDC module handle interrupt
347 // Global resource dependence: g_lcdc_mode
348 // Author: Jianping.wang
350 /**********************************************************************************************************/
351 PUBLIC void LCDC_irq (uint32 param);
352 /**********************************************************************************************************/
353 // Description: register handle function
354 // Global resource dependence: g_lcdc_int_list
355 // Author: Jianping.wang
357 /**********************************************************************************************************/
358 PUBLIC BOOLEAN LCDC_RegisterInterrupt (uint32 int_num, lcdc_func_t func);
359 /**********************************************************************************************************/
360 // Description: provide lcdc interrupt
361 // Global resource dependence: g_lcdc_mode
362 // Author: Jianping.wang
365 // int_ptr - pointer to interrupt structure
369 /**********************************************************************************************************/
370 PUBLIC int32 LCDC_SpecialMode (LCD_INT_ENA_T *int_ptr);
371 /**********************************************************************************************************/
372 // Description: close LCDC TV DAC
373 // Global resource dependence:
374 // Author: Jianping.wang
376 /**********************************************************************************************************/
377 PUBLIC void LCDC_CloseTvDAC (void);
383 /**---------------------------------------------------------------------------*
385 **---------------------------------------------------------------------------*/