comparison src/cs/drivers/drv_app/r2d/lcd_messages.c @ 0:945cf7f506b2

src/cs: chipsetsw import from tcs211-fcmodem binary blobs and LCD demo files have been excluded, all line endings are LF only
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Sep 2016 22:50:11 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:945cf7f506b2
1 /********************************************************************************
2 * *
3 * lcd_messages.c : contains functions used by Upper layer to send messages *
4 * to LCD mailbox, and by LCD to send events to Upper layer *
5 * *
6 * Project : *
7 * *
8 * Author : Davide Carpegna *
9 * Version number : 1.0 *
10 * Date : 29 September 2000 *
11 * *
12 * (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved *
13 *********************************************************************************/
14
15 #include <string.h>
16
17 #include "r2d/lcd_messages.h"
18 #include "rvm/rvm_use_id_list.h"
19
20 /* Global variables */
21 typedef struct DRIVER_GBL_INFO
22 {
23 T_RVF_MB_ID prim_id;
24 T_RVF_ADDR_ID addr_id;
25 UINT8 rtc_mailbox;
26 } T_DRIVER_GBL_INFO;
27
28 T_DRIVER_GBL_INFO * DRIVER_GBL_INFO_PTR = NULL;
29
30 UINT8 DrvTaskReady = 0;
31
32
33 /********************************************************************************/
34 /* Function Name: LCD_Reset */
35 /* */
36 /* Purpose:called by Appli, sends lcd_reset message into lcd mailbox */
37 /* */
38 /* */
39 /* Input Parameters: None */
40 /* Output Parameters: */
41 /* T_RV_RET */
42 /********************************************************************************/
43
44
45 T_RV_RET lcd_reset(void)
46 {
47
48 /* check if the driver has been started */
49 if ( DRIVER_GBL_INFO_PTR == NULL)
50 return (RV_NOT_READY);
51
52 if (DrvTaskReady == 0)
53 return(RV_NOT_READY);
54
55 return (RV_OK);
56 }
57
58 /********************************************************************************/
59 /* Function Name: lcd_clear */
60 /* */
61 /* Purpose:called by Appli, sends lcd_clear message into lcd mailbox */
62 /* */
63 /* */
64 /* Input Parameters: None */
65 /* Output Parameters: */
66 /* T_RV_RET. */
67 /********************************************************************************/
68
69
70 T_RV_RET lcd_clear(void)
71 {
72
73 T_RVF_MB_STATUS mb_status;
74 T_LCD_CLEAR *msg_ptr;
75
76
77 /* check if the driver has been started */
78 if ( DRIVER_GBL_INFO_PTR == NULL)
79 return (RV_NOT_READY);
80
81 if (DrvTaskReady == 0)
82 return(RV_NOT_READY);
83
84
85 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_CLEAR ), (void **) &msg_ptr);
86
87 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
88 {
89
90 msg_ptr->os_hdr.msg_id = LCD_CLEAR_EVT;
91
92 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
93
94 return (RV_OK);
95 }
96 else
97 {
98 rvf_send_trace("LCD_Clear function FAILED ",26, NULL_PARAM,
99 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
100 return(RV_MEMORY_ERR);
101 }
102
103 }
104
105 /********************************************************************************/
106 /* Function Name: LCD_Init */
107 /* */
108 /* Purpose:called by Appli, sends lcd_init message into lcd mailbox */
109 /* */
110 /* */
111 /* Input Parameters: None */
112 /* Output Parameters: */
113 /* T_RV_RET */
114 /********************************************************************************/
115
116
117 T_RV_RET lcd_init(void)
118 {
119
120 T_RVF_MB_STATUS mb_status;
121 T_LCD_INIT *msg_ptr;
122
123 /* check if the driver has been started */
124 if ( DRIVER_GBL_INFO_PTR == NULL)
125 { LCD_Init_ll();
126 return (RV_NOT_READY);
127 }
128 if (DrvTaskReady == 0)
129 { LCD_Init_ll();
130 return(RV_NOT_READY);
131 }
132
133
134 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_INIT ), (void **) &msg_ptr);
135
136 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
137 {
138
139
140 msg_ptr->os_hdr.msg_id = LCD_INIT_EVT;
141
142 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
143
144 return (RV_OK);
145 }
146 else
147 { rvf_send_trace("LCD_Init function FAILED ",25, NULL_PARAM,
148 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
149 return(RV_MEMORY_ERR);
150 }
151 }
152
153 /********************************************************************************/
154 /* Function Name: LCD_WriteString */
155 /* */
156 /* Purpose:called by Appli, sends lcd_write_string message into lcd mailbox */
157 /* */
158 /* */
159 /* Input Parameters: row, column, string, mode */
160 /* Output Parameters: */
161 /* T_RV_RET */
162 /********************************************************************************/
163
164
165 T_RV_RET lcd_write_string(UINT8 row, UINT8 column, char *string, T_VIDEO_MODE mode)
166 {
167
168 UINT8 length;
169 T_RVF_MB_STATUS mb_status;
170 T_LCD_WRITE_STRING *msg_ptr;
171
172 /* check if the driver has been started */
173 if ( DRIVER_GBL_INFO_PTR == NULL)
174 {
175 return (RV_NOT_READY);
176 }
177 if (DrvTaskReady == 0)
178 {
179 return (RV_NOT_READY);
180 }
181
182 /* the string must fit into one row, so the maximum string length is 14 */
183 /* character starting from column 0 */
184 length = (UINT8) strlen (string);
185 if((length*6+column)>DISP_PIXELWIDTH)
186 {
187 rvf_send_trace("LCD_WriteString - too long string ",34, NULL_PARAM,RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
188 return (RV_INVALID_PARAMETER);
189 }
190
191 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_WRITE_STRING ) + length, (void **) &msg_ptr);
192
193 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
194 {
195 msg_ptr->row = row;
196 msg_ptr->column = column * 6;
197 msg_ptr->mode = mode;
198
199 /* the first byte indicates the string length ('\x00' excepted), while */
200 /* the message is included beyond this parameter */
201 msg_ptr->string = length;
202 memcpy (&(msg_ptr->string) + 1,
203 string,
204 length);
205
206 msg_ptr->os_hdr.msg_id = LCD_WRITE_STRING_EVT;
207
208 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
209
210 return (RV_OK);
211 }
212 else
213 {
214 rvf_send_trace("LCD_WriteString function FAILED ",32, NULL_PARAM,
215 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
216 return(RV_MEMORY_ERR);
217 }
218
219 }
220
221
222 /********************************************************************************/
223 /* Function Name: LCD_WriteCenter */
224 /* */
225 /* Purpose:called by Appli, sends lcd_write_center message into lcd mailbox */
226 /* */
227 /* */
228 /* Input Parameters: string */
229 /* Output Parameters: */
230 /* T_RV_RET */
231 /********************************************************************************/
232
233
234 T_RV_RET lcd_write_center( char *string)
235 {
236
237 UINT8 length;
238 T_RVF_MB_STATUS mb_status;
239 T_LCD_WRITE_CENTER *msg_ptr;
240
241 /* check if the driver has been started */
242 if ( DRIVER_GBL_INFO_PTR == NULL)
243 {
244 return (RV_NOT_READY);
245 }
246
247 if (DrvTaskReady == 0)
248 {
249 return(RV_NOT_READY);
250 }
251
252 /* the string must fit into one row, so the maximum string length is 14 */
253 /* character starting from column 0 */
254 length = (UINT8) strlen (string);
255 if((length*6+X_CENTER-(length/2)*DISP_PAGEHEIGHT)>DISP_PIXELWIDTH)
256 {
257 rvf_send_trace("LCD_WriteCenter - too long string ",34, NULL_PARAM,RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
258 return (RV_INVALID_PARAMETER);
259 }
260
261 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_WRITE_CENTER ) + length, (void **) &msg_ptr);
262
263 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
264 {
265
266 /* the first byte indicates the length ('\x00' excepted), while the */
267 /* message is included beyond this parameter */
268 msg_ptr->string = length;
269 memcpy (&(msg_ptr->string) + 1,
270 string,
271 length);
272
273 msg_ptr->os_hdr.msg_id = LCD_WRITE_CENTER_EVT;
274
275 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
276
277 return (RV_OK);
278 }
279 else
280 {
281 rvf_send_trace("LCD_WriteCenter function FAILED ",32, NULL_PARAM,
282 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
283 return(RV_MEMORY_ERR);
284 }
285 }
286
287 /********************************************************************************/
288 /* Function Name: LCD_ClearString */
289 /* */
290 /* Purpose:called by Appli, sends lcd_clear_strring message into lcd mailbox */
291 /* */
292 /* */
293 /* Input Parameters: row */
294 /* Output Parameters: */
295 /* T_RV_RET. */
296 /********************************************************************************/
297
298
299 T_RV_RET lcd_clear_string(UINT8 row)
300 {
301
302 T_RVF_MB_STATUS mb_status;
303 T_LCD_CLEAR_STRING *msg_ptr;
304
305 /* check if the driver has been started */
306 if ( DRIVER_GBL_INFO_PTR == NULL)
307 return (RV_NOT_READY);
308
309 if (DrvTaskReady == 0)
310 return(RV_NOT_READY);
311
312
313 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_CLEAR_STRING ), (void **) &msg_ptr);
314
315 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
316 {
317 msg_ptr->row = row;
318
319
320 msg_ptr->os_hdr.msg_id = LCD_CLEAR_STRING_EVT;
321
322 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
323
324 return (RV_OK);
325 }
326 else
327 {
328 rvf_send_trace("LCD_ClearString function FAILED ",32, NULL_PARAM,
329 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
330 return(RV_MEMORY_ERR);
331 }
332 }
333
334 /********************************************************************************/
335 /* Function Name: LCD_ClearWord */
336 /* */
337 /* Purpose:called by Appli, sends lcd_clear_word message into lcd mailbox */
338 /* */
339 /* */
340 /* Input Parameters: row, column, length */
341 /* Output Parameters: */
342 /* T_RV_RET */
343 /********************************************************************************/
344
345
346 T_RV_RET lcd_clear_word(UINT8 row, UINT8 column, UINT16 length)
347 {
348
349 T_RVF_MB_STATUS mb_status;
350 T_LCD_CLEAR_WORD *msg_ptr;
351
352 /* check if the driver has been started */
353 if ( DRIVER_GBL_INFO_PTR == NULL)
354 return (RV_NOT_READY);
355
356 if (DrvTaskReady == 0)
357 return(RV_NOT_READY);
358
359
360 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_CLEAR_WORD ), (void **) &msg_ptr);
361
362 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
363 {
364 msg_ptr->row = row;
365 msg_ptr->column = column * 6;
366 msg_ptr->length = length;
367
368 msg_ptr->os_hdr.msg_id = LCD_CLEAR_WORD_EVT;
369
370 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
371
372 return (RV_OK);
373 }
374 else
375 {
376 rvf_send_trace("LCD_ClearWord function FAILED ",31, NULL_PARAM,
377 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
378 return(RV_MEMORY_ERR);
379 }
380 }
381
382
383 /********************************************************************************/
384 /* Function Name: LCD_PutPixel */
385 /* */
386 /* Purpose:called by Appli, sends lcd_put_pixel message into lcd mailbox */
387 /* */
388 /* */
389 /* Input Parameters:x,y */
390 /* Output Parameters: */
391 /* T_RV_RET */
392 /********************************************************************************/
393
394
395 T_RV_RET lcd_put_pixel(UINT8 x, UINT8 y)
396 {
397
398 T_RVF_MB_STATUS mb_status;
399 T_LCD_PUT_PIXEL *msg_ptr;
400
401 /* check if the driver has been started */
402 if ( DRIVER_GBL_INFO_PTR == NULL)
403 return (RV_NOT_READY);
404
405 if (DrvTaskReady == 0)
406 return(RV_NOT_READY);
407
408 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_PUT_PIXEL ), (void **) &msg_ptr);
409
410 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
411 {
412 msg_ptr->x = x;
413 msg_ptr->y = y;
414
415 msg_ptr->os_hdr.msg_id = LCD_PUT_PIXEL_EVT;
416
417 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
418
419 return (RV_OK);
420 }
421 else
422 {
423 rvf_send_trace("LCD_PutPixel function FAILED ",29, NULL_PARAM,
424 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
425 return(RV_MEMORY_ERR);
426 }
427 }
428
429 /********************************************************************************/
430 /* Function Name: LCD_ClearPixel */
431 /* */
432 /* Purpose:called by Appli, sends lcd_clear_pixel message into lcd mailbox */
433 /* */
434 /* */
435 /* Input Parameters:x,y */
436 /* Output Parameters: */
437 /* T_RV_RET */
438 /********************************************************************************/
439
440
441 T_RV_RET lcd_clear_pixel(UINT8 x, UINT8 y)
442 {
443
444 T_RVF_MB_STATUS mb_status;
445 T_LCD_CLEAR_PIXEL *msg_ptr;
446
447 /* check if the driver has been started */
448 if ( DRIVER_GBL_INFO_PTR == NULL)
449 return (RV_NOT_READY);
450
451 if (DrvTaskReady == 0)
452 return(RV_NOT_READY);
453
454 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_CLEAR_PIXEL ), (void **) &msg_ptr);
455
456 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
457 {
458 msg_ptr->x = x;
459 msg_ptr->y = y;
460
461 msg_ptr->os_hdr.msg_id = LCD_CLEAR_PIXEL_EVT;
462
463 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
464
465 return (RV_OK);
466 }
467 else
468 {
469 rvf_send_trace("LCD_ClearPixel function FAILED ",31, NULL_PARAM,
470 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
471 return(RV_MEMORY_ERR);
472 }
473 }
474
475 /********************************************************************************/
476 /* Function Name: LCD_DrawLine */
477 /* */
478 /* Purpose:called by Appli, sends lcd_draw_line message into lcd mailbox */
479 /* */
480 /* */
481 /* Input Parameters:x1,y1, x2,y2 */
482 /* Output Parameters: */
483 /* T_RV_RET */
484 /********************************************************************************/
485
486
487 T_RV_RET lcd_draw_line(UINT8 x1, UINT8 y1, UINT8 x2, UINT8 y2)
488 {
489
490 T_RVF_MB_STATUS mb_status;
491 T_LCD_DRAW_LINE *msg_ptr;
492
493 /* check if the driver has been started */
494 if ( DRIVER_GBL_INFO_PTR == NULL)
495 return (RV_NOT_READY);
496
497 if (DrvTaskReady == 0)
498 return(RV_NOT_READY);
499
500 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_DRAW_LINE ), (void **) &msg_ptr);
501
502 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
503 {
504 msg_ptr->x1 = x1;
505 msg_ptr->y1 = y1;
506 msg_ptr->x2 = x2;
507 msg_ptr->y2 = y2;
508
509 msg_ptr->os_hdr.msg_id = LCD_DRAW_LINE_EVT;
510
511 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
512
513 return (RV_OK);
514 }
515 else
516 {
517 rvf_send_trace("LCD_DrawLine function FAILED ",29, NULL_PARAM,
518 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
519 return(RV_MEMORY_ERR);
520 }
521 }
522 /********************************************************************************/
523 /* Function Name: LCD_ClearLine */
524 /* */
525 /* Purpose:called by Appli, sends lcd_clear_line message into lcd mailbox */
526 /* */
527 /* */
528 /* Input Parameters:x1,y1, x2,y2 */
529 /* Output Parameters: */
530 /* T_RV_RET */
531 /********************************************************************************/
532
533
534 T_RV_RET lcd_clear_line(UINT8 x1, UINT8 y1, UINT8 x2, UINT8 y2)
535 {
536
537 T_RVF_MB_STATUS mb_status;
538 T_LCD_CLEAR_LINE *msg_ptr;
539
540 /* check if the driver has been started */
541 if ( DRIVER_GBL_INFO_PTR == NULL)
542 return (RV_NOT_READY);
543
544 if (DrvTaskReady == 0)
545 return(RV_NOT_READY);
546
547 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_CLEAR_LINE ), (void **) &msg_ptr);
548
549 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
550 {
551 msg_ptr->x1 = x1;
552 msg_ptr->y1 = y1;
553 msg_ptr->x2 = x2;
554 msg_ptr->y2 = y2;
555
556 msg_ptr->os_hdr.msg_id = LCD_CLEAR_LINE_EVT;
557
558 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
559
560 return (RV_OK);
561 }
562 else
563 {
564 rvf_send_trace("LCD_ClearLine function FAILED ",30, NULL_PARAM,
565 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
566 return(RV_MEMORY_ERR);
567 }
568 }
569
570 /********************************************************************************/
571 /* Function Name: LCD_DrawRectangle */
572 /* */
573 /* Purpose:called by Appli, sends lcd_draw_rectangle message into lcd mailbox*/
574 /* */
575 /* */
576 /* Input Parameters:x1,y1, x2,y2 */
577 /* Output Parameters: */
578 /* T_RV_RET */
579 /********************************************************************************/
580
581
582 T_RV_RET lcd_draw_rectangle(UINT8 x1, UINT8 y1, UINT8 x2, UINT8 y2)
583 {
584
585 T_RVF_MB_STATUS mb_status;
586 T_LCD_DRAW_RECTANGLE *msg_ptr;
587
588 /* check if the driver has been started */
589 if ( DRIVER_GBL_INFO_PTR == NULL)
590 return (RV_NOT_READY);
591
592 if (DrvTaskReady == 0)
593 return(RV_NOT_READY);
594
595 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_DRAW_RECTANGLE ), (void **) &msg_ptr);
596
597 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
598 {
599 msg_ptr->x1 = x1;
600 msg_ptr->y1 = y1;
601 msg_ptr->x2 = x2;
602 msg_ptr->y2 = y2;
603
604 msg_ptr->os_hdr.msg_id = LCD_DRAW_RECTANGLE_EVT;
605
606 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
607
608 return (RV_OK);
609 }
610 else
611 {
612 rvf_send_trace("LCD_DrawRectangle function FAILED ",34, NULL_PARAM,
613 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
614 return(RV_MEMORY_ERR);
615 }
616 }
617 /********************************************************************************/
618 /* Function Name: LCD_ClearRectangle */
619 /* */
620 /* Purpose:called by Appli, sends lcd_clear_rectangle message into lcd mailbox*/
621 /* */
622 /* */
623 /* Input Parameters:x1,y1, x2,y2 */
624 /* Output Parameters: */
625 /* T_RV_RET */
626 /********************************************************************************/
627
628
629 T_RV_RET lcd_clear_rectangle(UINT8 x1, UINT8 y1, UINT8 x2, UINT8 y2)
630 {
631
632 T_RVF_MB_STATUS mb_status;
633 T_LCD_CLEAR_RECTANGLE *msg_ptr;
634
635 /* check if the driver has been started */
636 if ( DRIVER_GBL_INFO_PTR == NULL)
637 return (RV_NOT_READY);
638
639 if (DrvTaskReady == 0)
640 return(RV_NOT_READY);
641
642 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_CLEAR_RECTANGLE ), (void **) &msg_ptr);
643
644 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
645 {
646 msg_ptr->x1 = x1;
647 msg_ptr->y1 = y1;
648 msg_ptr->x2 = x2;
649 msg_ptr->y2 = y2;
650
651 msg_ptr->os_hdr.msg_id = LCD_CLEAR_RECTANGLE_EVT;
652
653 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
654
655 return (RV_OK);
656 }
657 else
658 {
659 rvf_send_trace("LCD_ClearRectangle function FAILED ",35, NULL_PARAM,
660 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
661 return(RV_MEMORY_ERR);
662 }
663 }
664
665 /********************************************************************************/
666 /* Function Name: LCD_DrawIcon */
667 /* */
668 /* Purpose:called by Appli, sends lcd_display_icon message into lcd mailbox */
669 /* */
670 /* */
671 /* Input Parameters:x, y, icon_id */
672 /* Output Parameters: */
673 /* T_RV_RET */
674 /********************************************************************************/
675
676
677 T_RV_RET lcd_draw_icon(UINT8 x,UINT8 y,UINT8 icon_id)
678 {
679
680 T_RVF_MB_STATUS mb_status;
681 T_LCD_DRAW_ICON *msg_ptr;
682
683 if (DrvTaskReady == 0)
684 return(RV_NOT_READY);
685
686 /* check if the driver has been started */
687 if ( DRIVER_GBL_INFO_PTR == NULL)
688 {
689 return (RV_NOT_READY);
690 }
691
692 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_DRAW_ICON ), (void **) &msg_ptr);
693
694 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
695 {
696 msg_ptr->icon_id = icon_id;
697 msg_ptr->x = x;
698 msg_ptr->y = y;
699
700 msg_ptr->os_hdr.msg_id = LCD_DRAW_ICON_EVT;
701
702 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
703
704 return (RV_OK);
705 }
706 else
707 {
708 rvf_send_trace("LCD_DrawIcon function FAILED ",29, NULL_PARAM,
709 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
710 return(RV_MEMORY_ERR);
711 }
712 }
713
714 /********************************************************************************/
715 /* Function Name: LCD_RefreshBloc */
716 /* */
717 /* Purpose:called by Appli, sends lcd_draw_bloc message into lcd mailbox */
718 /* */
719 /* */
720 /* Input Parameters:table,x_dim,y_dim,x_pos,y_pos */
721 /* Output Parameters: */
722 /* T_RV_RET */
723 /********************************************************************************/
724
725
726 T_RV_RET lcd_refresh_bloc(char *table,UINT8 x_dim,UINT8 y_dim,UINT8 x_pos,UINT8 y_pos)
727 {
728
729 T_RVF_MB_STATUS mb_status;
730 T_LCD_REFRESH_BLOC *msg_ptr;
731
732
733 /* check if the driver has been started */
734 if ( DRIVER_GBL_INFO_PTR == NULL)
735 return (RV_NOT_READY);
736
737 if (DrvTaskReady == 0)
738 return(RV_NOT_READY);
739
740 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_REFRESH_BLOC), (void **) &msg_ptr);
741
742
743 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
744 {
745 msg_ptr->table = table;
746 msg_ptr->x_dim = x_dim;
747 msg_ptr->y_dim = y_dim;
748 msg_ptr->x_pos = x_pos;
749 msg_ptr->y_pos = y_pos;
750
751 msg_ptr->os_hdr.msg_id = LCD_REFRESH_BLOC_EVT;
752
753 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
754
755 return (RV_OK);
756 }
757 else
758 {
759 rvf_send_trace("LCD_RefreshBloc function FAILED ",32, NULL_PARAM,
760 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
761 return(RV_MEMORY_ERR);
762 }
763 }
764
765 /********************************************************************************/
766 /* Function Name: LCD_PixBlt */
767 /* */
768 /* Purpose:called by Appli, sends lcd_refresh_bloc message into lcd mailbox */
769 /* */
770 /* */
771 /* Input Parameters:table,x_dim,y_dim,x_pos,y_pos,table */
772 /* Output Parameters: */
773 /* T_RV_RET */
774 /********************************************************************************/
775
776
777 T_RV_RET lcd_pix_blt(int x_pos,int y_pos,int x_dim,int y_dim,char *table)
778 {
779 T_RVF_MB_STATUS mb_status1,mb_status2;
780 T_LCD_DRAW_BLOC *msg_ptr;
781 int i;
782 char *table_to_send; //pointer to the table created to copy the transmitted data
783
784
785 /* check if the driver has been started */
786 if ( DRIVER_GBL_INFO_PTR == NULL)
787 return (RV_NOT_READY);
788
789 if (DrvTaskReady == 0)
790 return(RV_NOT_READY);
791
792 if((x_pos>83)||(y_pos>48))
793 {
794 rvf_send_trace("LCD - image outside lcd",23, NULL_PARAM,RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
795 return(RV_OK);
796 }
797
798 mb_status1 = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_DRAW_BLOC), (void **) &msg_ptr);
799
800 if((mb_status1==RVF_RED))//memory allocation failed
801 {
802 rvf_send_trace("LCD_PixBlt function FAILED ",27, NULL_PARAM,
803 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
804 return(RV_MEMORY_ERR);
805 }
806
807 //dynamic allocation of the copy table
808 mb_status2 = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, (x_dim*y_dim)/8, (void **) &table_to_send);
809
810 if((mb_status2==RVF_RED))//memory allocation failed
811 {
812 rvf_free_buf(msg_ptr);
813 rvf_send_trace("LCD_PixBlt function FAILED ",27, NULL_PARAM,
814 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
815 return(RV_MEMORY_ERR);
816 }
817
818 else
819 {
820 for(i=0;i<((x_dim*y_dim/8)-1);i++)
821 table_to_send[i]=table[i];
822
823 msg_ptr->table = table_to_send;
824 msg_ptr->x_dim = x_dim;
825 msg_ptr->y_dim = y_dim;
826 msg_ptr->x_pos = x_pos;
827 msg_ptr->y_pos = y_pos;
828
829 msg_ptr->os_hdr.msg_id = LCD_DRAW_BLOC_EVT;
830
831 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
832
833 return (RV_OK);
834 }
835 }
836
837 /********************************************************************************/
838 /* Function Name: LCD_Enable */
839 /* */
840 /* Purpose:called by Appli, sends lcd_enable message into lcd mailbox */
841 /* */
842 /* */
843 /* Input Parameters: x */
844 /* Output Parameters: */
845 /* T_RV_RET */
846 /********************************************************************************/
847
848
849 T_RV_RET lcd_enable(UINT8 x)
850 {
851
852 /* check if the driver has been started */
853 if ( DRIVER_GBL_INFO_PTR == NULL)
854 return (RV_NOT_READY);
855
856 if (DrvTaskReady == 0)
857 return(RV_NOT_READY);
858
859 return (RV_OK);
860 }
861
862 /********************************************************************************/
863 /* Function Name: LCD_SetPower */
864 /* */
865 /* Purpose:called by Appli, sends lcd_set_power message into lcd mailbox */
866 /* */
867 /* */
868 /* Input Parameters: None */
869 /* Output Parameters: */
870 /* T_RV_RET */
871 /********************************************************************************/
872
873
874 T_RV_RET lcd_set_power()
875 {
876
877 T_RVF_MB_STATUS mb_status;
878 T_LCD_SET_POWER *msg_ptr;
879
880 /* check if the driver has been started */
881 if ( DRIVER_GBL_INFO_PTR == NULL)
882 { LCD_Init_ll();
883 return (RV_NOT_READY);
884 }
885 if (DrvTaskReady == 0)
886 {
887 LCD_Init_ll();
888 return (RV_NOT_READY);
889 }
890
891
892 mb_status = rvf_get_buf (DRIVER_GBL_INFO_PTR->prim_id, sizeof (T_LCD_SET_POWER), (void **) &msg_ptr);
893
894 if ((mb_status == RVF_GREEN) || (mb_status == RVF_YELLOW)) /* Memory allocation success */
895 {
896
897 msg_ptr->os_hdr.msg_id = LCD_SET_POWER_EVT;
898
899 rvf_send_msg (DRIVER_GBL_INFO_PTR->addr_id, msg_ptr);
900
901 return (RV_OK);
902 }
903 else
904 {
905 rvf_send_trace("LCD_SetPower function FAILED ",29, NULL_PARAM,
906 RV_TRACE_LEVEL_WARNING, R2D_USE_ID );
907 return(RV_MEMORY_ERR);
908 }
909 }
910
911 /********************************************************************************/
912 /* Function Name: LCD_Cursor */
913 /* */
914 /* Purpose:called by Appli, sends lcd_cursor message into lcd mailbox */
915 /* */
916 /* */
917 /* Input Parameters:x,y */
918 /* Output Parameters: */
919 /* T_RV_RET */
920 /********************************************************************************/
921
922
923 T_RV_RET lcd_cursor(UINT8 y,UINT8 x)
924 {
925
926 /* check if the driver has been started */
927 if ( DRIVER_GBL_INFO_PTR == NULL)
928 return (RV_NOT_READY);
929
930 if (DrvTaskReady == 0)
931 return(RV_NOT_READY);
932
933 return (RV_OK);
934 }
935
936
937