FreeCalypso > hg > tcs211-c139
comparison chipsetsw/drivers/drv_app/r2d/lcds/E_Sample/lcd_if.h @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /****************************************************************************** | |
2 * WIRELESS COMMUNICATION SYSTEM DEVELOPMENT | |
3 * | |
4 * (C) 2002 Texas Instruments France. All rights reserved | |
5 * | |
6 * Author : Philippe MARTINEZ | |
7 * | |
8 * | |
9 * Important Note | |
10 * -------------- | |
11 * | |
12 * This S/W is a preliminary version. It contains information on a product | |
13 * under development and is issued for evaluation purposes only. Features | |
14 * characteristics, data and other information are subject to change. | |
15 * | |
16 * The S/W is furnished under Non Disclosure Agreement and may be used or | |
17 * copied only in accordance with the terms of the agreement. It is an offence | |
18 * to copy the software in any way except as specifically set out in the | |
19 * agreement. No part of this document may be reproduced or transmitted in any | |
20 * form or by any means, electronic or mechanical, including photocopying and | |
21 * recording, for any purpose without the express written permission of Texas | |
22 * Instruments Inc. | |
23 * | |
24 ****************************************************************************** | |
25 * | |
26 * FILE NAME: lcd_if.h | |
27 * | |
28 * | |
29 * PURPOSE: Header file for the LCD Interface Driver. | |
30 * | |
31 * | |
32 * FILE REFERENCES: | |
33 * | |
34 * Name IO Description | |
35 * ------------- -- --------------------------------------------- | |
36 * | |
37 * | |
38 * | |
39 * EXTERNAL VARIABLES: | |
40 * | |
41 * Source: | |
42 * | |
43 * Name Type IO Description | |
44 * ------------- --------------- -- ------------------------------ | |
45 * | |
46 * | |
47 * | |
48 * EXTERNAL REFERENCES: | |
49 * | |
50 * Name Description | |
51 * ------------------ ------------------------------------------------------- | |
52 * | |
53 * | |
54 * | |
55 * ABNORMAL TERMINATION CONDITIONS, ERROR AND WARNING MESSAGES: | |
56 * | |
57 * | |
58 * | |
59 * ASSUMPTION, CONSTRAINTS, RESTRICTIONS: | |
60 * | |
61 * | |
62 * | |
63 * NOTES: | |
64 * | |
65 * | |
66 * | |
67 * REQUIREMENTS/FUNCTIONAL SPECIFICATION REFERENCES: | |
68 * | |
69 * | |
70 * | |
71 * | |
72 * DEVELOPMENT HISTORY: | |
73 * | |
74 * Date Name(s) Version Description | |
75 * ----------- -------------- ------- ------------------------------------- | |
76 * 30-Oct-2002 Philippe MARINTEZ 0.0.1 First implementation | |
77 * | |
78 * ALGORITHM: | |
79 * | |
80 * | |
81 *****************************************************************************/ | |
82 | |
83 #include <stdlib.h> | |
84 | |
85 #include "main/sys_types.h" | |
86 | |
87 | |
88 /**************************************************************************** | |
89 * GENERAL CONSTANTS | |
90 ***************************************************************************/ | |
91 #ifndef C_MAP_LCD_IF_BASE | |
92 #define C_MAP_LCD_IF_BASE 0xFFFFA000L // LCD registers | |
93 #endif | |
94 | |
95 /* driver version */ | |
96 | |
97 #define C_LCD_IF_DRIVER_VERSION ( 0x0001 ) | |
98 | |
99 /* LCD Interface Tx FIFO size */ | |
100 | |
101 #define C_LCD_IF_TX_FIFO_SIZE ( 128 ) | |
102 | |
103 /* infinite while loop constant */ | |
104 | |
105 #define C_LCD_IF_INFINITE_LOOP ( 1 ) | |
106 | |
107 /**************************************************************************** | |
108 * Definition of the LCD Interface registers | |
109 ***************************************************************************/ | |
110 | |
111 /* LCD IF CNTL_REG */ | |
112 | |
113 #define C_LCD_IF_CNTL_REG ( C_MAP_LCD_IF_BASE ) | |
114 | |
115 #define C_LCD_IF_CNTL_REG_SOFT_NRST_POS ( 0 ) | |
116 #define C_LCD_IF_CNTL_REG_SOFT_NRST_MASK ( 0x0001 ) | |
117 #define C_LCD_IF_CNTL_REG_SOFT_NRST_INIT ( 0x1 ) | |
118 | |
119 #define C_LCD_IF_CNTL_REG_CLOCK13_EN_POS ( 1 ) | |
120 #define C_LCD_IF_CNTL_REG_CLOCK13_EN_MASK ( 0x0002 ) | |
121 #define C_LCD_IF_CNTL_REG_CLOCK13_EN_INIT ( 0x1 ) | |
122 | |
123 #define C_LCD_IF_CNTL_REG_TX_CLOCK_DIV_POS ( 2 ) | |
124 #define C_LCD_IF_CNTL_REG_TX_CLOCK_DIV_MASK ( 0x000C ) | |
125 #define C_LCD_IF_CNTL_REG_TX_CLOCK_DIV_INIT ( 0x0 ) | |
126 | |
127 #define C_LCD_IF_CNTL_REG_RX_CLOCK_DIV_POS ( 4 ) | |
128 #define C_LCD_IF_CNTL_REG_RX_CLOCK_DIV_MASK ( 0x0030 ) | |
129 #define C_LCD_IF_CNTL_REG_RX_CLOCK_DIV_INIT ( 0x0 ) | |
130 | |
131 #define C_LCD_IF_CNTL_REG_FIFO_EMPTY_IT_EN_POS ( 6 ) | |
132 #define C_LCD_IF_CNTL_REG_FIFO_EMPTY_IT_EN_MASK ( 0x0040 ) | |
133 #define C_LCD_IF_CNTL_REG_FIFO_EMPTY_IT_EN_INIT ( 0x0 ) | |
134 | |
135 #define C_LCD_IF_CNTL_REG_LCD_READ_EVENT_IT_EN_POS ( 7 ) | |
136 #define C_LCD_IF_CNTL_REG_LCD_READ_EVENT_IT_EN_MASK ( 0x0080 ) | |
137 #define C_LCD_IF_CNTL_REG_LCD_READ_EVENT_IT_EN_INIT ( 0x0 ) | |
138 | |
139 #define C_LCD_IF_CNTL_REG_DMA_EN_POS ( 8 ) | |
140 #define C_LCD_IF_CNTL_REG_DMA_EN_MASK ( 0x0100 ) | |
141 #define C_LCD_IF_CNTL_REG_DMA_EN_INIT ( 0x0 ) | |
142 | |
143 #define C_LCD_IF_CNTL_REG_MODE_POS ( 9 ) | |
144 #define C_LCD_IF_CNTL_REG_MODE_MASK ( 0x0200 ) | |
145 #define C_LCD_IF_CNTL_REG_MODE_INIT ( 0x0 ) | |
146 | |
147 #define C_LCD_IF_CNTL_REG_FLIP_BYTES_POS ( 10 ) | |
148 #define C_LCD_IF_CNTL_REG_FLIP_BYTES_MASK ( 0x0400 ) | |
149 #define C_LCD_IF_CNTL_REG_FLIP_BYTES_INIT ( 0x0 ) | |
150 | |
151 #define C_LCD_IF_CNTL_REG_SUSPEND_EN_POS ( 11 ) | |
152 #define C_LCD_IF_CNTL_REG_SUSPEND_EN_MASK ( 0x0800 ) | |
153 #define C_LCD_IF_CNTL_REG_SUSPEND_EN_INIT ( 0x1 ) | |
154 | |
155 #define C_LCD_IF_CNTL_REG_MIN_FRAME_SIZE_POS ( 12 ) | |
156 #define C_LCD_IF_CNTL_REG_MIN_FRAME_SIZE_MASK ( 0x3000 ) | |
157 #define C_LCD_IF_CNTL_REG_MIN_FRAME_SIZE_INIT ( 0x3 ) | |
158 | |
159 #define C_LCD_IF_CNTL_REG_N_DUMMY_POS ( 14 ) | |
160 #define C_LCD_IF_CNTL_REG_N_DUMMY_MASK ( 0xC000 ) | |
161 #define C_LCD_IF_CNTL_REG_N_DUMMY_INIT ( 0x1 ) | |
162 | |
163 | |
164 /* LCD IF LCD_CNTL_REG */ | |
165 | |
166 #define C_LCD_IF_LCD_CNTL_REG ( C_MAP_LCD_IF_BASE + 0x02 ) | |
167 | |
168 #define C_LCD_IF_LCD_CNTL_REG_LCD_NCS0_POS ( 0 ) | |
169 #define C_LCD_IF_LCD_CNTL_REG_LCD_NCS0_MASK ( 0x0001 ) | |
170 #define C_LCD_IF_LCD_CNTL_REG_LCD_NCS0_INIT ( 0x1 ) | |
171 | |
172 #define C_LCD_IF_LCD_CNTL_REG_LCD_RS_POS ( 1 ) | |
173 #define C_LCD_IF_LCD_CNTL_REG_LCD_RS_MASK ( 0x0002 ) | |
174 #define C_LCD_IF_LCD_CNTL_REG_LCD_RS_INIT ( 0x0 ) | |
175 | |
176 #define C_LCD_IF_LCD_CNTL_REG_LCD_START_READ_POS ( 2 ) | |
177 #define C_LCD_IF_LCD_CNTL_REG_LCD_START_READ_MASK ( 0x0004 ) | |
178 #define C_LCD_IF_LCD_CNTL_REG_LCD_START_READ_INIT ( 0x0 ) | |
179 #define C_LCD_IF_LCD_CNTL_REG_LCD_START_READ_EN ( 0x1 ) | |
180 | |
181 #define C_LCD_IF_LCD_CNTL_REG_LCD_NRESET_POS ( 3 ) | |
182 #define C_LCD_IF_LCD_CNTL_REG_LCD_NRESET_MASK ( 0x0008 ) | |
183 #define C_LCD_IF_LCD_CNTL_REG_LCD_NRESET_INIT ( 0x0 ) | |
184 | |
185 #define C_LCD_IF_LCD_CNTL_REG_LCD_NCS1_POS ( 4 ) | |
186 #define C_LCD_IF_LCD_CNTL_REG_LCD_NCS1_MASK ( 0x0010 ) | |
187 #define C_LCD_IF_LCD_CNTL_REG_LCD_NCS1_INIT ( 0x1 ) | |
188 | |
189 /* LCD IF LCD_IF_STS_REG */ | |
190 | |
191 #define C_LCD_IF_STS_REG ( C_MAP_LCD_IF_BASE + 0x04 ) | |
192 | |
193 #define C_LCD_IF_STS_REG_FIFO_EMPTY_STATUS_POS ( 0 ) | |
194 #define C_LCD_IF_STS_REG_FIFO_EMPTY_STATUS_MASK ( 0x0001 ) | |
195 | |
196 #define C_LCD_IF_STS_REG_FIFO_FULL_STATUS_POS ( 1 ) | |
197 #define C_LCD_IF_STS_REG_FIFO_FULL_STATUS_MASK ( 0x0002 ) | |
198 | |
199 #define C_LCD_IF_STS_REG_LCD_READ_EVENT_STATUS_POS ( 2 ) | |
200 #define C_LCD_IF_STS_REG_LCD_READ_EVENT_STATUS_MASK ( 0x0004 ) | |
201 | |
202 /* LCD IF WR_FIFO */ | |
203 #define C_LCD_IF_WR_FIFO ( C_MAP_LCD_IF_BASE + 0x06 ) | |
204 | |
205 #define C_LCD_IF_WR_FIFO_DATA_TX_LSB_POS ( 0 ) | |
206 #define C_LCD_IF_WR_FIFO_DATA_TX_LSB_MASK ( 0x00FF ) | |
207 | |
208 #define C_LCD_IF_WR_FIFO_DATA_TX_MSB_POS ( 8 ) | |
209 #define C_LCD_IF_WR_FIFO_DATA_TX_MSB_MASK ( 0xFF00 ) | |
210 | |
211 /* LCD IF RD_REG */ | |
212 #define C_LCD_IF_RD_REG ( C_MAP_LCD_IF_BASE + 0x08 ) | |
213 | |
214 #define C_LCD_IF_RD_REG_DATA_RX_LSB_POS ( 0 ) | |
215 #define C_LCD_IF_RD_REG_DATA_RX_LSB_MASK ( 0x00FF ) | |
216 | |
217 #define C_LCD_IF_RD_REG_DATA_RX_MSB_POS ( 8 ) | |
218 #define C_LCD_IF_RD_REG_DATA_RX_MSB_MASK ( 0xFF00 ) | |
219 | |
220 /**************************************************************************** | |
221 * MACRO DEFINITION | |
222 ***************************************************************************/ | |
223 | |
224 /**************************************************************************** | |
225 * | |
226 * MACRO NAME: F_LCD_IF_WRITE_IN_FIFO | |
227 * Write d_data into WR_FIFO register. | |
228 * | |
229 * | |
230 * ARGUMENT LIST: | |
231 * | |
232 * Argument Description | |
233 * ------------ ---------------------------------------------------------- | |
234 * d_data 16 boits word data (SYS_UWORD16) | |
235 * | |
236 * RETURN VALUE: None | |
237 * | |
238 ***************************************************************************/ | |
239 | |
240 #define F_LCD_IF_WRITE_IN_FIFO( d_data ) *(volatile SYS_UWORD16* ) C_LCD_IF_WR_FIFO = d_data | |
241 | |
242 /**************************************************************************** | |
243 * | |
244 * MACRO NAME: F_LCD_IF_TX_FIFO_EMPTY_STATUS | |
245 * Return the LCD Interface TX FIFO Empty status. | |
246 * | |
247 * | |
248 * ARGUMENT LIST: | |
249 * | |
250 * Argument Description | |
251 * ------------ ---------------------------------------------------------- | |
252 * None. | |
253 * | |
254 * RETURN VALUE: SYS_UWORD8 : Tx FIFO empty status (0 or 1) | |
255 * | |
256 ***************************************************************************/ | |
257 | |
258 #define F_LCD_IF_TX_FIFO_EMPTY_STATUS \ | |
259 ( SYS_UWORD8 )((* (volatile SYS_UWORD16 *) C_LCD_IF_STS_REG) & C_LCD_IF_STS_REG_FIFO_EMPTY_STATUS_MASK) | |
260 | |
261 /**************************************************************************** | |
262 * TYPE AND STRUCTURE DEFINITION | |
263 ***************************************************************************/ | |
264 | |
265 /* type definition for LCD Clock divider */ | |
266 | |
267 typedef SYS_UWORD8 E_LCD_IF_CLOCK_DIVIDER; | |
268 | |
269 #define C_LCD_IF_DIV8 ( 0 ) | |
270 #define C_LCD_IF_DIV4 ( 1 ) | |
271 #define C_LCD_IF_DIV2 ( 2 ) | |
272 #define C_LCD_IF_DIV1 ( 3 ) | |
273 | |
274 /* type definition for LCD interface mode */ | |
275 | |
276 typedef SYS_UWORD8 E_LCD_IF_MODE; | |
277 | |
278 #define C_LCD_IF_68000_MODE ( 0 ) | |
279 #define C_LCD_IF_8086_MODE ( 1 ) | |
280 | |
281 /* type definition for LCD Interface flip bytes */ | |
282 | |
283 typedef SYS_UWORD8 E_LCD_IF_FLIP; | |
284 | |
285 #define C_LCD_IF_MSB_FIRST ( 0 ) | |
286 #define C_LCD_IF_LSB_FIRST ( 1 ) | |
287 | |
288 /* type definition for Instruction Selection line level */ | |
289 | |
290 typedef SYS_UWORD8 E_LCD_IF_ISLL; | |
291 | |
292 #define C_LCD_IF_LOW ( 0 ) | |
293 #define C_LCD_IF_HIGH ( 1 ) | |
294 | |
295 /* type definition for Minimum frame size */ | |
296 | |
297 typedef SYS_UWORD8 E_LCD_IF_FRAME_SZ; | |
298 | |
299 #define C_LCD_IF_16_WORDS ( 0 ) | |
300 #define C_LCD_IF_32_WORDS ( 1 ) | |
301 #define C_LCD_IF_64_WORDS ( 2 ) | |
302 #define C_LCD_IF_128_WORDS ( 3 ) | |
303 | |
304 /* type definition for Read dummy cycle */ | |
305 | |
306 typedef SYS_UWORD8 E_LCD_IF_DUMMY_CYCLE; | |
307 | |
308 #define C_LCD_IF_0_CYCLE ( 0 ) | |
309 #define C_LCD_IF_1_CYCLE ( 1 ) | |
310 #define C_LCD_IF_2_CYCLES ( 2 ) | |
311 | |
312 /* Initialization sub structure for Transmit */ | |
313 | |
314 typedef struct { | |
315 E_LCD_IF_CLOCK_DIVIDER d_clock_divider; | |
316 } T_LCD_IF_INIT_TX; | |
317 | |
318 /* Initialization sub structure for Receive */ | |
319 | |
320 typedef struct { | |
321 E_LCD_IF_CLOCK_DIVIDER d_clock_divider; | |
322 E_LCD_IF_DUMMY_CYCLE d_dummy_cycles; | |
323 } T_LCD_IF_INIT_RX; | |
324 | |
325 /* LCD Interface Driver Initialization structure */ | |
326 | |
327 typedef struct { | |
328 E_LCD_IF_MODE d_mode; | |
329 E_LCD_IF_FLIP b_flip_bytes; | |
330 E_LCD_IF_ISLL d_isll ; | |
331 T_LCD_IF_INIT_TX d_tx_init; | |
332 T_LCD_IF_INIT_RX d_rx_init; | |
333 } T_LCD_IF_INIT; | |
334 | |
335 /* type definition for the LCD Chip select */ | |
336 | |
337 typedef SYS_UWORD8 E_LCD_IF_CS; | |
338 | |
339 #define C_LCD_IF_CS0 ( 0 ) | |
340 #define C_LCD_IF_CS1 ( 1 ) | |
341 #define C_LCD_IF_CS_NOT_SELECTED ( 2 ) | |
342 | |
343 /* type definition for the LCD data type */ | |
344 | |
345 typedef SYS_UWORD8 E_LCD_IF_DATA_TYPE; | |
346 | |
347 #define C_LCD_IF_INSTRUCTION ( 0 ) | |
348 #define C_LCD_IF_DISPLAY ( 1 ) | |
349 | |
350 /* type definition for the current LCD driver internal state */ | |
351 | |
352 typedef SYS_UWORD8 E_LCD_IF_STATUS; | |
353 | |
354 #define C_LCD_IF_IDLE ( 0 ) | |
355 #define C_LCD_IF_RUNNING ( 1 ) | |
356 | |
357 /* type definition for the callback function return parameter */ | |
358 | |
359 typedef SYS_UWORD8 E_LCD_IF_CALLBACK_RET; | |
360 | |
361 #define C_LCD_IF_CALLBACK_OK ( 0 ) | |
362 #define C_LCD_IF_CALLBACK_DISABLE_IT ( 1 ) | |
363 | |
364 /* Type definition for the ON / OFF levels */ | |
365 | |
366 typedef SYS_UWORD8 E_LCD_IF_RESET; | |
367 | |
368 #define C_LCD_IF_ON ( 0 ) | |
369 #define C_LCD_IF_OFF ( 1 ) | |
370 | |
371 /* Type definition for the ON / OFF levels */ | |
372 | |
373 typedef SYS_UWORD8 E_LCD_IF_CLOCK; | |
374 | |
375 #define C_LCD_IF_CLOCK_ON ( 1 ) | |
376 #define C_LCD_IF_CLOCK_OFF ( 0 ) | |
377 | |
378 /* type definition for callback function */ | |
379 | |
380 typedef E_LCD_IF_CALLBACK_RET (*T_LCD_IF_CALLBACK)( void ); | |
381 | |
382 /* type definition for the LCD IF API function return parameter */ | |
383 | |
384 typedef SYS_UWORD8 E_LCD_IF_RET; | |
385 | |
386 #define C_LCD_IF_RET_OK ( 0 ) | |
387 #define C_LCD_IF_RET_ERR ( 1 ) | |
388 | |
389 /**************************************************************************** | |
390 * INTERANL MACRO DEFINITION | |
391 ***************************************************************************/ | |
392 | |
393 /**************************************************************************** | |
394 * | |
395 * MACRO NAME: F_LCD_IF_WAIT_LCD_IF_RESET | |
396 * Loop that wait for the read status. | |
397 * | |
398 * | |
399 * ARGUMENT LIST: | |
400 * | |
401 * Argument Description | |
402 * ------------ ---------------------------------------------------------- | |
403 * None | |
404 * | |
405 * RETURN VALUE: None | |
406 * | |
407 ***************************************************************************/ | |
408 | |
409 #define F_LCD_IF_WAIT_LCD_IF_RESET \ | |
410 while( ((*(volatile SYS_UWORD16*) C_LCD_IF_CNTL_REG) & C_LCD_IF_CNTL_REG_SOFT_NRST_MASK) \ | |
411 != C_LCD_IF_CNTL_REG_SOFT_NRST_MASK ) | |
412 | |
413 /**************************************************************************** | |
414 * | |
415 * MACRO NAME: F_LCD_IF_WAIT_TX_FIFO_EMPTY | |
416 * Loop that wait for the TX FIFO EMPTY status set to 1. | |
417 * | |
418 * | |
419 * ARGUMENT LIST: | |
420 * | |
421 * Argument Description | |
422 * ------------ ---------------------------------------------------------- | |
423 * None | |
424 * | |
425 * RETURN VALUE: None | |
426 * | |
427 ***************************************************************************/ | |
428 | |
429 #define F_LCD_IF_WAIT_TX_FIFO_EMPTY \ | |
430 while( ((*(volatile SYS_UWORD16*) C_LCD_IF_STS_REG) & C_LCD_IF_STS_REG_FIFO_EMPTY_STATUS_MASK) \ | |
431 != C_LCD_IF_STS_REG_FIFO_EMPTY_STATUS_MASK ) | |
432 | |
433 | |
434 /**************************************************************************** | |
435 * | |
436 * MACRO NAME: F_LCD_IF_WAIT_READ_STATUS | |
437 * Loop that wait for the Read status set to 1. | |
438 * | |
439 * | |
440 * ARGUMENT LIST: | |
441 * | |
442 * Argument Description | |
443 * ------------ ---------------------------------------------------------- | |
444 * None | |
445 * | |
446 * RETURN VALUE: None | |
447 * | |
448 ***************************************************************************/ | |
449 | |
450 #define F_LCD_IF_WAIT_READ_STATUS \ | |
451 while( ((*(volatile SYS_UWORD16*) C_LCD_IF_STS_REG) & C_LCD_IF_STS_REG_LCD_READ_EVENT_STATUS_MASK) \ | |
452 != C_LCD_IF_STS_REG_LCD_READ_EVENT_STATUS_MASK ) | |
453 | |
454 /**************************************************************************** | |
455 * | |
456 * MACRO NAME: F_LCD_IF_ENABLE_TX_FIFO_EMPTY_IT | |
457 * Enables the LCD Interface Tx FIFO Empty Interrupt. | |
458 * | |
459 * | |
460 * ARGUMENT LIST: | |
461 * | |
462 * Argument Description | |
463 * ------------ ---------------------------------------------------------- | |
464 * None | |
465 * | |
466 * RETURN VALUE: None | |
467 * | |
468 ***************************************************************************/ | |
469 | |
470 #define F_LCD_IF_ENABLE_TX_FIFO_EMPTY_IT \ | |
471 ((*(volatile SYS_UWORD16*) C_LCD_IF_CNTL_REG) |= C_LCD_IF_CNTL_REG_FIFO_EMPTY_IT_EN_MASK ) | |
472 | |
473 | |
474 /**************************************************************************** | |
475 * | |
476 * MACRO NAME: F_LCD_IF_DISABLE_TX_FIFO_EMPTY_IT | |
477 * Disables the LCD Interface Tx FIFO Empty Interrupt. | |
478 * | |
479 * | |
480 * ARGUMENT LIST: | |
481 * | |
482 * Argument Description | |
483 * ------------ ---------------------------------------------------------- | |
484 * None | |
485 * | |
486 * RETURN VALUE: None | |
487 * | |
488 ***************************************************************************/ | |
489 | |
490 #define F_LCD_IF_DISABLE_TX_FIFO_EMPTY_IT \ | |
491 ((*(volatile SYS_UWORD16*) C_LCD_IF_CNTL_REG) &= ~C_LCD_IF_CNTL_REG_FIFO_EMPTY_IT_EN_MASK ) | |
492 | |
493 /**************************************************************************** | |
494 * | |
495 * MACRO NAME: F_LCD_IF_ENABLE_DMA | |
496 * Enables the LCD Interface DMA capabilities. | |
497 * | |
498 * | |
499 * ARGUMENT LIST: | |
500 * | |
501 * Argument Description | |
502 * ------------ ---------------------------------------------------------- | |
503 * None | |
504 * | |
505 * RETURN VALUE: None | |
506 * | |
507 ***************************************************************************/ | |
508 | |
509 #define F_LCD_IF_ENABLE_DMA \ | |
510 ((*(volatile SYS_UWORD16*) C_LCD_IF_CNTL_REG) |= C_LCD_IF_CNTL_REG_DMA_EN_MASK ) | |
511 | |
512 /**************************************************************************** | |
513 * | |
514 * MACRO NAME: F_LCD_IF_DISABLE_DMA | |
515 * Disable the LCD Interface DMA capabilities. | |
516 * | |
517 * | |
518 * ARGUMENT LIST: | |
519 * | |
520 * Argument Description | |
521 * ------------ ---------------------------------------------------------- | |
522 * None | |
523 * | |
524 * RETURN VALUE: None | |
525 * | |
526 ***************************************************************************/ | |
527 | |
528 #define F_LCD_IF_DISABLE_DMA \ | |
529 ((*(volatile SYS_UWORD16*) C_LCD_IF_CNTL_REG) &= ~C_LCD_IF_CNTL_REG_DMA_EN_MASK ) | |
530 | |
531 | |
532 | |
533 /**************************************************************************** | |
534 * INTERNAL TYPE AND STRUCTURES | |
535 ***************************************************************************/ | |
536 | |
537 /* type definition for the Data Access */ | |
538 | |
539 typedef SYS_UWORD8 E_LCD_IF_DATA_ACCESS; | |
540 | |
541 #define C_LCD_IF_READ ( 1 ) | |
542 #define C_LCD_IF_WRITE ( 0 ) | |
543 | |
544 /* type definition for the current LCD driver internal state */ | |
545 | |
546 typedef SYS_UWORD8 E_LCD_IF_STATE; | |
547 | |
548 #define C_LCD_IF_IDLE ( 0 ) | |
549 #define C_LCD_IF_IT_CUST ( 1 ) | |
550 #define C_LCD_IF_IT_BUFF ( 2 ) | |
551 | |
552 /* type definition Transmit sub structure */ | |
553 | |
554 typedef struct { | |
555 E_LCD_IF_CLOCK_DIVIDER d_clock_divider; | |
556 T_LCD_IF_CALLBACK p_callback; | |
557 SYS_UWORD16 *p_buffer; | |
558 SYS_UWORD32 d_buffer_size; | |
559 } T_LCD_IF_TX; | |
560 | |
561 /* type definition Receive sub structure */ | |
562 | |
563 typedef struct { | |
564 E_LCD_IF_CLOCK_DIVIDER d_clock_divider; | |
565 E_LCD_IF_DUMMY_CYCLE d_dummy_cycles; | |
566 } T_LCD_IF_RX; | |
567 | |
568 /* type definition LCD Interface Driver Chip select structure */ | |
569 | |
570 typedef struct { | |
571 E_LCD_IF_MODE d_mode; | |
572 E_LCD_IF_FLIP b_flip_bytes; | |
573 E_LCD_IF_ISLL d_isll ; | |
574 T_LCD_IF_TX d_tx; | |
575 T_LCD_IF_RX d_rx; | |
576 SYS_UWORD16 d_cntl_reg; | |
577 SYS_UWORD16 d_lcd_cntl_reg; | |
578 } T_LCD_IF_CS_INIT; | |
579 | |
580 /* type definition LCD Interface Driver Internal structure */ | |
581 | |
582 #define C_LCD_IF_CS_NUMBER (2) | |
583 | |
584 typedef struct { | |
585 T_LCD_IF_CS_INIT d_cs_struct[C_LCD_IF_CS_NUMBER]; | |
586 E_LCD_IF_CS d_current_cs; | |
587 E_LCD_IF_STATE d_interrupt_state; | |
588 } T_LCD_IF_INTERNAL; | |
589 | |
590 /**************************************************************************** | |
591 * GLOBAL VARIABLES REFERENCE | |
592 ***************************************************************************/ | |
593 | |
594 | |
595 /**************************************************************************** | |
596 * PROTOTYPE DEFINITION | |
597 ***************************************************************************/ | |
598 | |
599 /* | |
600 * 16-BIS functions | |
601 */ | |
602 | |
603 extern void f_lcd_if_init( E_LCD_IF_CS d_cs, T_LCD_IF_INIT *p_init ); | |
604 | |
605 extern void f_lcd_if_reset( void ); | |
606 | |
607 extern void f_lcd_if_reset_lcd_controller( E_LCD_IF_CS d_cs, | |
608 E_LCD_IF_RESET d_reset ); | |
609 | |
610 extern void f_lcd_if_clock( E_LCD_IF_CLOCK d_clock_switch ); | |
611 | |
612 extern void f_lcd_if_poll_write( E_LCD_IF_CS d_cs, | |
613 SYS_UWORD16 *p_data, | |
614 SYS_UWORD32 d_size, | |
615 E_LCD_IF_DATA_TYPE d_type ); | |
616 | |
617 extern SYS_UWORD16 f_lcd_if_poll_read( E_LCD_IF_CS d_cs, | |
618 E_LCD_IF_DATA_TYPE d_type ); | |
619 | |
620 extern E_LCD_IF_RET f_lcd_if_it_write_cust( E_LCD_IF_CS d_cs, | |
621 E_LCD_IF_DATA_TYPE d_type, | |
622 T_LCD_IF_CALLBACK pf_callback_tx ); | |
623 | |
624 extern E_LCD_IF_RET f_lcd_if_it_write( E_LCD_IF_CS d_cs, | |
625 SYS_UWORD16 *p_buffer, | |
626 SYS_UWORD32 d_size, | |
627 E_LCD_IF_DATA_TYPE d_type, | |
628 T_LCD_IF_CALLBACK pf_callback_sts ); | |
629 | |
630 extern void f_lcd_if_dma_enable( E_LCD_IF_CS d_cs, | |
631 E_LCD_IF_FRAME_SZ d_min_frame_sz, | |
632 E_LCD_IF_DATA_TYPE d_type ); | |
633 | |
634 extern E_LCD_IF_RET f_lcd_if_dma_disable( E_LCD_IF_CS d_cs, | |
635 T_LCD_IF_CALLBACK pf_callback_sts ); | |
636 | |
637 extern SYS_UWORD16 f_lcd_if_get_version( void ); | |
638 | |
639 /* | |
640 * 32-BIS functions | |
641 */ | |
642 | |
643 extern void f_lcd_if_it_handler( void ); | |
644 | |
645 | |
646 extern void f_lcd_if_initialization( void ); |