1 /*
2 * $Workfile: nsc_galfns.c $
3 * $Revision: 1.13 $
4 * $Author: dok $
5 *
6 * File Contents: This file contains the main functions of the Geode
7 * frame buffer device drivers GAL function definitions.
8 *
9 * Project: Geode Frame buffer device driver
10 *
11 */
12
13 /* NSC_LIC_ALTERNATIVE_PREAMBLE
14 *
15 * Revision 1.0
16 *
17 * National Semiconductor Alternative GPL-BSD License
18 *
19 * National Semiconductor Corporation licenses this software
20 * ("Software"):
21 *
22 * National Xfree frame buffer driver
23 *
24 * under one of the two following licenses, depending on how the
25 * Software is received by the Licensee.
26 *
27 * If this Software is received as part of the Linux Framebuffer or
28 * other GPL licensed software, then the GPL license designated
29 * NSC_LIC_GPL applies to this Software; in all other circumstances
30 * then the BSD-style license designated NSC_LIC_BSD shall apply.
31 *
32 * END_NSC_LIC_ALTERNATIVE_PREAMBLE */
33
34 /* NSC_LIC_BSD
35 *
36 * National Semiconductor Corporation Open Source License for
37 *
38 * National Xfree frame buffer driver
39 *
40 * (BSD License with Export Notice)
41 *
42 * Copyright (c) 1999-2001
43 * National Semiconductor Corporation.
44 * All rights reserved.
45 *
46 * Redistribution and use in source and binary forms, with or without
47 * modification, are permitted provided that the following conditions
48 * are met:
49 *
50 * * Redistributions of source code must retain the above copyright
51 * notice, this list of conditions and the following disclaimer.
52 *
53 * * Redistributions in binary form must reproduce the above
54 * copyright notice, this list of conditions and the following
55 * disclaimer in the documentation and/or other materials provided
56 * with the distribution.
57 *
58 * * Neither the name of the National Semiconductor Corporation nor
59 * the names of its contributors may be used to endorse or promote
60 * products derived from this software without specific prior
61 * written permission.
62 *
63 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
64 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
65 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
66 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
67 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
68 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
69 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
70 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
71 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
72 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
73 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
74 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
75 * OF SUCH DAMAGE.
76 *
77 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
78 * YOUR JURISDICTION. It is licensee's responsibility to comply with
79 * any export regulations applicable in licensee's jurisdiction. Under
80 * CURRENT (2001) U.S. export regulations this software
81 * is eligible for export from the U.S. and can be downloaded by or
82 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
83 * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
84 * Syria, Sudan, Afghanistan and any other country to which the U.S.
85 * has embargoed goods and services.
86 *
87 * END_NSC_LIC_BSD */
88
89 /* NSC_LIC_GPL
90 *
91 * National Semiconductor Corporation Gnu General Public License for
92 *
93 * National Xfree frame buffer driver
94 *
95 * (GPL License with Export Notice)
96 *
97 * Copyright (c) 1999-2001
98 * National Semiconductor Corporation.
99 * All rights reserved.
100 *
101 * Redistribution and use in source and binary forms, with or without
102 * modification, are permitted under the terms of the GNU General
103 * Public License as published by the Free Software Foundation; either
104 * version 2 of the License, or (at your option) any later version
105 *
106 * In addition to the terms of the GNU General Public License, neither
107 * the name of the National Semiconductor Corporation nor the names of
108 * its contributors may be used to endorse or promote products derived
109 * from this software without specific prior written permission.
110 *
111 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
112 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
113 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
114 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
115 * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY
116 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
117 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
118 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
119 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
120 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE,
121 * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY
122 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
123 * OF SUCH DAMAGE. See the GNU General Public License for more details.
124 *
125 * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
126 * YOUR JURISDICTION. It is licensee's responsibility to comply with
127 * any export regulations applicable in licensee's jurisdiction. Under
128 * CURRENT (2001) U.S. export regulations this software
129 * is eligible for export from the U.S. and can be downloaded by or
130 * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed
131 * destinations which include Cuba, Iraq, Libya, North Korea, Iran,
132 * Syria, Sudan, Afghanistan and any other country to which the U.S.
133 * has embargoed goods and services.
134 *
135 * You should have received a copy of the GNU General Public License
136 * along with this file; if not, write to the Free Software Foundation,
137 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
138 *
139 * END_NSC_LIC_GPL */
140
141 #include <config.h>
142
143 #ifndef XFree86LOADER
144 #include <stdio.h>
145 #include <stdarg.h>
146 #include <stdlib.h>
147 #include <unistd.h>
148 #include <string.h>
149 #include <sys/stat.h>
150 #include <sys/sysmacros.h>
151 #include <fcntl.h>
152 #include <errno.h>
153 #include <sys/ioctl.h>
154 #endif
155
156 #include <fbdev/fbdev.h> /* FIXME: Needs to be included before dfb_types.h to work around a type clash with asm/types.h */
157
158 #include <direct/memcpy.h>
159
160 static FBDev *dfb_fbdev = NULL;
161
162 #include "nsc_galproto.h"
163
164 /*
165 * Compile time constants
166 */
167 #define FBDEV_NAME "/dev/nscgal"
168
169 /*
170 * Cool Macros to access the structures
171 */
172 #define INIT_GAL(x) \
173 (x)->dwSignature = FBGAL_SIGNATURE;\
174 (x)->dwSize = sizeof(*x);\
175 (x)->dwVersion = FBGAL_VERSION;
176
177 #if 0
178 /*------------------------------------------------------------------------
179 * create_devicenode
180 *
181 * Description: This function creates nscgal device node in the device
182 * directory.
183 * parameters : none
184 *
185 * return: '0' was return on creating the galdevice node.
186 *----------------------------------------------------------------------*/
187 static int
188 create_devicenode(void)
189 {
190
191 #if 1
192 FILE *pfdevices;
193 char line[200], devname[200];
194 int majdev;
195
196 /* remove fails if device is open */
197 remove("/dev/nscgal");
198
199 if ((pfdevices = fopen("/proc/devices", "r"))) {
200 while (fgets(line, sizeof(line), pfdevices)) {
201 if (sscanf(line, "%d%*[ \t]%s", &majdev, devname) == 2) {
202 if (strstr(devname, "nscgal"))
203 mknod("/dev/nscgal", S_IFCHR | S_IRUSR | S_IWUSR,
204 makedev(majdev, 0));
205 }
206 }
207 fclose(pfdevices);
208 }
209 return 1;
210 #endif
211
212 }
213 #endif
214
215 /*------------------------------------------------------------------------
216 * Gal_initialize_interface
217 *
218 * Description: This function intializes the nscgal device .
219 * parameters : none
220 *
221 * return: '1' was returned on intialization of the galdevice
222 * otherwise '0' was returned on failure.
223 *----------------------------------------------------------------------*/
224 BOOLEAN
Gal_initialize_interface(void)225 Gal_initialize_interface(void)
226 {
227 /* create_devicenode(); */
228 dfb_fbdev = dfb_system_data();
229
230 return 1;
231 }
232
233 /*------------------------------------------------------------------------
234 * Gal_cleanup_interface
235 *
236 * Description: This function closes the nscgal device .
237 * parameters : none
238 *
239 * return: '1' was returned on closing the galdevice.
240 *----------------------------------------------------------------------*/
241 BOOLEAN
Gal_cleanup_interface(void)242 Gal_cleanup_interface(void)
243 {
244 return 1;
245 }
246
247 /*---------------------------------------------------------------------------
248 * Gal_write_register
249 *
250 * Description: This function writes the data to the hardware register
251 * of the nscgal device .
252 * parameters:
253 * type: It specifies the hardware access type.
254 * offset: It specifies the offset address the register to be accessed.
255 * value: It specifies the data value to be written into the register.
256 * size: It specifies the size of the data to be written.
257 *
258 * return: '1' was returned on success otherwise '0' was returned.
259 *-------------------------------------------------------------------------*/
260 BOOLEAN
Gal_write_register(int type,unsigned long offset,unsigned long value,int size)261 Gal_write_register(int type, unsigned long offset, unsigned long value,
262 int size)
263 {
264 GAL_HWACCESS hwAccess;
265
266 INIT_GAL(&hwAccess);
267 hwAccess.dwSubfunction = GALFN_WRITEREG;
268 hwAccess.dwType = type;
269 hwAccess.dwOffset = offset;
270 hwAccess.dwValue = value;
271 hwAccess.dwByteCount = size;
272 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &hwAccess))
273 return 0;
274 else {
275 return 1;
276 }
277 }
278
279 /*---------------------------------------------------------------------------
280 * Gal_read_register
281 *
282 * Description: This function reads the data from the hardware register
283 * of the nscgal device .
284 * parameters:
285 * type: It specifies the hardware access type.
286 * offset: It specifies the offset address of the register to be accessed.
287 * value: It specifies the pointer to hold the data to be read from
288 * the gal hardware register.
289 * size: It specifies the size of the data to be read
290 *
291 * return: '1' was returned on success otherwise '0' was returned.
292 *-------------------------------------------------------------------------*/
293 BOOLEAN
Gal_read_register(int type,unsigned long offset,unsigned long * value,int size)294 Gal_read_register(int type, unsigned long offset, unsigned long *value,
295 int size)
296 {
297 GAL_HWACCESS hwAccess;
298
299 INIT_GAL(&hwAccess);
300 hwAccess.dwSubfunction = GALFN_READREG;
301 hwAccess.dwType = type;
302 hwAccess.dwOffset = offset;
303 hwAccess.dwByteCount = size;
304
305 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &hwAccess))
306 return 0;
307 else {
308 *value = hwAccess.dwValue;
309 return 1;
310 }
311 }
312
313 /*---------------------------------------------------------------------------
314 * Gal_get_adapter_info
315 *
316 * Description: This function gets the adapter information of the
317 * nscgal device .
318 * parameters:
319 *pAdapterInfo: It specifies the adapter information structure.
320 *
321 * return: '1' was returned on success otherwise '0' was returned.
322 *-------------------------------------------------------------------------*/
323 BOOLEAN
Gal_get_adapter_info(PGAL_ADAPTERINFO pAdapterInfo)324 Gal_get_adapter_info(PGAL_ADAPTERINFO pAdapterInfo)
325 {
326 INIT_GAL(pAdapterInfo);
327
328 pAdapterInfo->dwSubfunction = GALFN_GETADAPTERINFO;
329
330 if (!dfb_fbdev || ioctl(dfb_fbdev->fd, FBIOGAL_API, pAdapterInfo))
331 return 0;
332 else {
333 return 1;
334 }
335 }
336
337 /*---------------------------------------------------------------------------
338 * Gal_set_softvga_state
339 *
340 * Description: This function sets the softvga state of the platform device .
341 * parameters:
342 * bEnable: It specifies the softvga state enable state.
343 * return: '1' was returned on success otherwise '0' was returned.
344 *-------------------------------------------------------------------------*/
345 BOOLEAN
Gal_set_softvga_state(BOOLEAN bEnable)346 Gal_set_softvga_state(BOOLEAN bEnable)
347 {
348 GAL_SOFTVGASTATE sSoftVgaState;
349
350 INIT_GAL(&sSoftVgaState);
351 sSoftVgaState.dwSubfunction = GALFN_SETSOFTVGASTATE;
352 sSoftVgaState.bSoftVgaEnable = bEnable;
353 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSoftVgaState))
354 return 0;
355 else
356 return 1;
357 }
358
359 /*---------------------------------------------------------------------------
360 * Gal_get_softvga_state
361 *
362 * Description: This function gets the softvga state of the platform device .
363 * parameters:
364 * bEnable: get the softvga state.
365 * return: '1' was returned on success otherwise '0' was returned.
366 *-------------------------------------------------------------------------*/
367 BOOLEAN
Gal_get_softvga_state(int * bState)368 Gal_get_softvga_state(int *bState)
369 {
370 GAL_SOFTVGASTATE sSoftVgaState;
371
372 INIT_GAL(&sSoftVgaState);
373 sSoftVgaState.dwSubfunction = GALFN_GETSOFTVGASTATE;
374 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSoftVgaState))
375 return 0;
376 else {
377 *bState = sSoftVgaState.bSoftVgaEnable;
378 return 1;
379 }
380 }
381
382 /*---------------------------------------------------------------------------
383 * Gal_vga_test_pci
384 *
385 * Description: This function tests the vga pci.
386 * parameters:
387 * softvga: It is pointer to the softvga state.
388 * return: '1' was returned on success otherwise '0' was returned.
389 *-------------------------------------------------------------------------*/
390 BOOLEAN
Gal_vga_test_pci(int * softvga)391 Gal_vga_test_pci(int *softvga)
392 {
393 GAL_VGATESTPCI sVgatestpci;
394
395 INIT_GAL(&sVgatestpci);
396 sVgatestpci.dwSubfunction = GALFN_GETSOFTVGASTATE;
397 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgatestpci))
398 return 0;
399 else {
400 *softvga = sVgatestpci.softvga;
401 return 1;
402 }
403 }
404
405 /*---------------------------------------------------------------------------
406 * Gal_vga_get_pci_command
407 *
408 * Description: This function gets the vga pci command.
409 * parameters:
410 * value: It is pointer to pci command value.
411 * return: '1' was returned on success otherwise '0' was returned.
412 *-------------------------------------------------------------------------*/
413 BOOLEAN
Gal_vga_get_pci_command(unsigned char * value)414 Gal_vga_get_pci_command(unsigned char *value)
415 {
416 GAL_VGAGETPCICOMMAND sVgagetpcicommand;
417
418 INIT_GAL(&sVgagetpcicommand);
419 sVgagetpcicommand.dwSubfunction = GALFN_VGAGETPCICOMMAND;
420 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgagetpcicommand))
421 return 0;
422 else {
423 *value = sVgagetpcicommand.value;
424 return 1;
425 }
426 }
427
428 /*---------------------------------------------------------------------------
429 * Gal_vga_seq_reset
430 *
431 * Description: This function resets the vga seq.
432 * parameters:
433 * reset: It gives the reset value.
434 * return: '1' was returned on success otherwise '0' was returned.
435 *-------------------------------------------------------------------------*/
436 BOOLEAN
Gal_vga_seq_reset(int reset)437 Gal_vga_seq_reset(int reset)
438 {
439 GAL_VGASEQRESET sVgaseqreset;
440
441 INIT_GAL(&sVgaseqreset);
442 sVgaseqreset.dwSubfunction = GALFN_VGASEQRESET;
443 sVgaseqreset.reset = reset;
444
445 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgaseqreset))
446 return 0;
447 else {
448 return 1;
449 }
450 }
451
452 /*---------------------------------------------------------------------------
453 * Gal_vga_set_graphics_bits
454 *
455 * Description: This function resets the vga seq.
456 * parameters: None.
457 *
458 * return: '1' was returned on success otherwise '0' was returned.
459 *-------------------------------------------------------------------------*/
460 BOOLEAN
Gal_vga_set_graphics_bits(void)461 Gal_vga_set_graphics_bits(void)
462 {
463 GAL_VGASETGRAPHICSBITS sVgasetgraphics;
464
465 INIT_GAL(&sVgasetgraphics);
466 sVgasetgraphics.dwSubfunction = GALFN_VGASETGRAPHICSBITS;
467
468 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgasetgraphics))
469 return 0;
470 else {
471 return 1;
472 }
473 }
474
475 /*---------------------------------------------------------------------------
476 * Gal_set_crt_enable
477 *
478 * Description: This function sets the crt state of the device .
479 * parameters:
480 * crtState: It specifies the crt state of the galdevice.
481 * return: '1' was returned on success otherwise '0' was returned.
482 *-------------------------------------------------------------------------*/
483 BOOLEAN
Gal_set_crt_enable(int crtEnable)484 Gal_set_crt_enable(int crtEnable)
485 {
486 GAL_CRTENABLE sCrtEnable;
487
488 INIT_GAL(&sCrtEnable);
489 sCrtEnable.dwSubfunction = GALFN_SETCRTENABLE;
490 sCrtEnable.wCrtEnable = crtEnable;
491 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCrtEnable))
492 return 0;
493 else
494 return 1;
495 }
496
497 /*---------------------------------------------------------------------------
498 * Gal_is_display_mode_supported
499 *
500 * Description: This function checks the display mode is supported or not.
501 * parameters:
502 * xres: It specifies x co-ordinate resolution.
503 * Yres: It specifies y co-ordinate resolution.
504 * bpp: It specifies the bits per pixel (8/16 bits).
505 * hz: It specifies the frequency of the display mode.
506 * return: '1' was returned on success otherwise '0' was returned.
507 *-------------------------------------------------------------------------*/
508 BOOLEAN
Gal_is_display_mode_supported(int xres,int yres,int bpp,int hz,int * supported)509 Gal_is_display_mode_supported(int xres, int yres, int bpp, int hz,
510 int *supported)
511 {
512 GAL_DISPLAYMODE sDisplayMode;
513
514 *supported = 0;
515 INIT_GAL(&sDisplayMode);
516 sDisplayMode.dwSubfunction = GALFN_ISDISPLAYMODESUPPORTED;
517 sDisplayMode.wXres = xres;
518 sDisplayMode.wYres = yres;
519 sDisplayMode.wBpp = bpp;
520 sDisplayMode.wRefresh = hz;
521
522 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayMode))
523 return 0;
524 else {
525 *supported = sDisplayMode.dwSupported;
526 return 1;
527 }
528 }
529
530 /*---------------------------------------------------------------------------
531 * Gal_set_display_mode
532 *
533 * Description: This function sets the display mode of the galdevice.
534 * parameters:
535 * xres: It specifies x co-ordinate resolution.
536 * Yres: It specifies y co-ordinate resolution.
537 * bpp: It specifies the bits per pixel (8/16 bits).
538 * hz: It specifies the frequency of the display mode.
539 * return: '1' was returned on success otherwise '0' was returned.
540 *-------------------------------------------------------------------------*/
541 BOOLEAN
Gal_set_display_mode(int xres,int yres,int bpp,int hz)542 Gal_set_display_mode(int xres, int yres, int bpp, int hz)
543 {
544 GAL_DISPLAYMODE sDisplayMode;
545
546 INIT_GAL(&sDisplayMode);
547 sDisplayMode.dwSubfunction = GALFN_SETDISPLAYMODE;
548 sDisplayMode.wXres = xres;
549 sDisplayMode.wYres = yres;
550 sDisplayMode.wBpp = bpp;
551 sDisplayMode.wRefresh = hz;
552
553 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayMode))
554 return 0;
555 else
556 return 1;
557 }
558
559 /*---------------------------------------------------------------------------
560 * Gal_get_display_mode
561 *
562 * Description: This function gets the display mode of the galdevice.
563 * parameters:
564 * xres: It specifies x co-ordinate resolution.
565 * Yres: It specifies y co-ordinate resolution.
566 * bpp: It specifies the bits per pixel (8/16 bits).
567 * hz: It specifies the frequency of the display mode.
568 * return: '1' was returned on success otherwise '0' was returned.
569 *-------------------------------------------------------------------------*/
570 BOOLEAN
Gal_get_display_mode(int * xres,int * yres,int * bpp,int * hz)571 Gal_get_display_mode(int *xres, int *yres, int *bpp, int *hz)
572 {
573 GAL_DISPLAYMODE sDisplayMode;
574
575 INIT_GAL(&sDisplayMode);
576 sDisplayMode.dwSubfunction = GALFN_GETDISPLAYMODE;
577 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayMode))
578 return 0;
579 else {
580 *xres = sDisplayMode.wXres;
581 *yres = sDisplayMode.wYres;
582 *bpp = sDisplayMode.wBpp;
583 *hz = sDisplayMode.wRefresh;
584 return 1;
585 }
586 }
587
588 /*---------------------------------------------------------------------------
589 * Gal_set_display_bpp
590 *
591 * Description: This function sets the number bits per pixel in the display
592 * mode of the galdevice.
593 * parameters:
594 * bpp: It specifies the bits per pixel (8/16 bits).
595 * return: '1' was returned on success otherwise '0' was returned.
596 *-------------------------------------------------------------------------*/
597 BOOLEAN
Gal_set_display_bpp(unsigned short bpp)598 Gal_set_display_bpp(unsigned short bpp)
599 {
600 GAL_DISPLAYPARAMS sDisplayParams;
601
602 INIT_GAL(&sDisplayParams);
603 sDisplayParams.dwSubfunction = GALFN_SETDISPLAYBPP;
604 sDisplayParams.wBpp = bpp;
605
606 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
607 return 0;
608 else
609 return 1;
610 }
611
612 /*---------------------------------------------------------------------------
613 * Gal_set_bpp
614 *
615 * Description: This function sets the number bits per pixel in the display
616 * mode of the galdevice.
617 * parameters:
618 * bpp: It specifies the bits per pixel (8/16 bits).
619 * return: '1' was returned on success otherwise '0' was returned.
620 *-------------------------------------------------------------------------*/
621 BOOLEAN
Gal_set_bpp(unsigned short bpp)622 Gal_set_bpp(unsigned short bpp)
623 {
624 GAL_DISPLAYPARAMS sDisplayParams;
625
626 INIT_GAL(&sDisplayParams);
627 sDisplayParams.dwSubfunction = GALFN_SETBPP;
628 sDisplayParams.wBpp = bpp;
629
630 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
631 return 0;
632 else
633 return 1;
634 }
635
636 /*---------------------------------------------------------------------------
637 * Gal_get_display_bpp
638 *
639 * Description: This function gets the number bits per pixel in the display
640 * mode of the galdevice.
641 * parameters:
642 * bpp: It specifies the bits per pixel (8/16 bits).
643 * return: '1' was returned on success otherwise '0' was returned.
644 *-------------------------------------------------------------------------*/
645 BOOLEAN
Gal_get_display_bpp(unsigned short * bpp)646 Gal_get_display_bpp(unsigned short *bpp)
647 {
648 GAL_DISPLAYPARAMS sDisplayParams;
649
650 INIT_GAL(&sDisplayParams);
651 sDisplayParams.dwSubfunction = GALFN_GETDISPLAYBPP;
652
653 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
654 return 0;
655 else {
656 *bpp = sDisplayParams.wBpp;
657 return 1;
658 }
659 }
660
661 /*---------------------------------------------------------------------------
662 * Gal_set_display_pitch
663 *
664 * Description: This function sets the display pitch of the galdevice.
665 * parameters:
666 * pitch: It specifies pitch of the display mode.
667 * return: '1' was returned on success otherwise '0' was returned.
668 *-------------------------------------------------------------------------*/
669 BOOLEAN
Gal_set_display_pitch(unsigned short pitch)670 Gal_set_display_pitch(unsigned short pitch)
671 {
672 GAL_DISPLAYPARAMS sDisplayParams;
673
674 INIT_GAL(&sDisplayParams);
675 sDisplayParams.dwSubfunction = GALFN_SETDISPLAYPITCH;
676 sDisplayParams.wPitch = pitch;
677 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
678 return 0;
679 else
680 return 1;
681 }
682
683 /*---------------------------------------------------------------------------
684 * Gal_get_display_pitch
685 *
686 * Description: This function gets the display pitch of the galdevice.
687 * parameters:
688 * pitch: It specifies pitch of the display mode.
689 * return: '1' was returned on success otherwise '0' was returned.
690 *-------------------------------------------------------------------------*/
691 BOOLEAN
Gal_get_display_pitch(unsigned short * pitch)692 Gal_get_display_pitch(unsigned short *pitch)
693 {
694 GAL_DISPLAYPARAMS sDisplayParams;
695
696 INIT_GAL(&sDisplayParams);
697 sDisplayParams.dwSubfunction = GALFN_GETDISPLAYPITCH;
698
699 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
700 return 0;
701 else {
702 *pitch = sDisplayParams.wPitch;
703 return 1;
704 }
705 }
706
707 /*---------------------------------------------------------------------------
708 * Gal_set_display_offset
709 *
710 * Description: This function sets the offset of display parameters.
711 * parameters:
712 * offset: It specifies the offset address of display parameters.
713 * return: '1' was returned on success otherwise '0' was returned.
714 *-------------------------------------------------------------------------*/
715 BOOLEAN
Gal_set_display_offset(unsigned long offset)716 Gal_set_display_offset(unsigned long offset)
717 {
718 GAL_DISPLAYPARAMS sDisplayParams;
719
720 INIT_GAL(&sDisplayParams);
721 sDisplayParams.dwSubfunction = GALFN_SETDISPLAYOFFSET;
722 sDisplayParams.dwOffset = offset;
723
724 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
725 return 0;
726 else
727 return 1;
728 }
729
730 /*---------------------------------------------------------------------------
731 * Gal_get_display_offset
732 *
733 * Description: This function gets the offset of display parameters.
734 * parameters:
735 * offset: It specifies the offset address of display parameters.
736 * return: '1' was returned on success otherwise '0' was returned.
737 *-------------------------------------------------------------------------*/
738 BOOLEAN
Gal_get_display_offset(unsigned long * offset)739 Gal_get_display_offset(unsigned long *offset)
740 {
741 GAL_DISPLAYPARAMS sDisplayParams;
742
743 INIT_GAL(&sDisplayParams);
744 sDisplayParams.dwSubfunction = GALFN_GETDISPLAYOFFSET;
745
746 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDisplayParams))
747 return 0;
748 else {
749 *offset = sDisplayParams.dwOffset;
750 return 1;
751 }
752 }
753
754 /*---------------------------------------------------------------------------
755 * Gal_get_refreshrate_from_dotclock
756 *
757 * Description: This function gets the refreshrate from dotclock.
758 * parameters:
759 * xres: It specifies x co-ordinate resolution.
760 * Yres: It specifies y co-ordinate resolution.
761 * bpp: It specifies the bits per pixel (8/16 bits).
762 * hz: It is a pointer which holds the refresh rate of the display.
763 * frequency: It spcifies the frequency of the dotclock.
764 * return: '1' was returned on success otherwise '0' was returned.
765 *-------------------------------------------------------------------------*/
766 BOOLEAN
Gal_get_refreshrate_from_dotclock(int xres,int yres,int bpp,int * hz,unsigned long frequency)767 Gal_get_refreshrate_from_dotclock(int xres, int yres, int bpp, int *hz,
768 unsigned long frequency)
769 {
770 GAL_DOTCLKTOREFRESH sDclkToRefresh;
771
772 INIT_GAL(&sDclkToRefresh);
773 sDclkToRefresh.dwSubfunction = GALFN_DOTCLKTOREFRESH;
774 sDclkToRefresh.wXres = xres;
775 sDclkToRefresh.wYres = yres;
776 sDclkToRefresh.wBpp = bpp;
777 sDclkToRefresh.dwDotClock = frequency;
778 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sDclkToRefresh))
779 return 0;
780 else {
781 *hz = sDclkToRefresh.wRefreshRate;
782 return 1;
783 }
784 }
785
786 /*---------------------------------------------------------------------------
787 * Gal_get_display_timing
788 *
789 * Description: This function gets the display timing from galdevice.
790 * parameters:
791 * pDisplayTiming: It specifies the display timing of the galdevice.
792 * return: '1' was returned on success otherwise '0' was returned.
793 *-------------------------------------------------------------------------*/
794 BOOLEAN
Gal_get_display_timing(PGAL_DISPLAYTIMING pDisplayTiming)795 Gal_get_display_timing(PGAL_DISPLAYTIMING pDisplayTiming)
796 {
797 INIT_GAL(pDisplayTiming);
798 pDisplayTiming->dwSubfunction = GALFN_GETDISPLAYTIMINGS;
799
800 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pDisplayTiming))
801 return 0;
802 else {
803 return 1;
804 }
805 }
806
807 /*---------------------------------------------------------------------------
808 * Gal_set_display_timing
809 *
810 * Description: This function sets the display timing of the galdevice.
811 * parameters:
812 * pDisplayTiming: It specifies the display timing of the galdevice.
813 * return: '1' was returned on success otherwise '0' was returned.
814 *-------------------------------------------------------------------------*/
815 BOOLEAN
Gal_set_display_timing(PGAL_DISPLAYTIMING pDisplayTiming)816 Gal_set_display_timing(PGAL_DISPLAYTIMING pDisplayTiming)
817 {
818 INIT_GAL(pDisplayTiming);
819 pDisplayTiming->dwSubfunction = GALFN_SETDISPLAYTIMINGS;
820
821 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pDisplayTiming))
822 return 0;
823 else
824 return 1;
825 }
826
827 /*---------------------------------------------------------------------------
828 * Gal_set_fixed_timings
829 *
830 * Description: This function sets the fixed display timings of the
831 * galdevice.
832 * parameters:
833 * pnlXres: It specifies the panel X resolution.
834 * pnlYres: It specifies the panel Y resolution.
835 * totXres: It specifies the total X resolution.
836 * totYres: It specifies the total Y resolution.
837 * bpp: It specifies the bits per pixel (8/16 bits).
838 * return: '1' was returned on success otherwise '0' was returned.
839 *-------------------------------------------------------------------------*/
840 BOOLEAN
Gal_set_fixed_timings(int pnlXres,int pnlYres,int totXres,int totYres,int bpp)841 Gal_set_fixed_timings(int pnlXres, int pnlYres, int totXres,
842 int totYres, int bpp)
843 {
844 GAL_DISPLAYTIMING DisplayTiming;
845
846 INIT_GAL(&DisplayTiming);
847 DisplayTiming.dwSubfunction = GALFN_SETFIXEDTIMINGS;
848 DisplayTiming.wHActive = pnlXres; /* panel Xres */
849 DisplayTiming.wVActive = pnlYres; /* panel Yres */
850 DisplayTiming.wHTotal = totXres; /* Total Xres */
851 DisplayTiming.wVTotal = totYres; /* Total Yres */
852 DisplayTiming.wBpp = bpp;
853
854 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &DisplayTiming))
855 return 0;
856 else
857 return 1;
858 }
859
860 /*---------------------------------------------------------------------------
861 * Gal_set_display_palette_entry
862 *
863 * Description: This function sets the display palette entry of the
864 * galdevice.
865 * parameters:
866 * index: It specifies the palette index,
867 * palette: It specifies the palette of the galdevice.
868 * return: '1' was returned on success otherwise '0' was returned.
869 *-------------------------------------------------------------------------*/
870 BOOLEAN
Gal_set_display_palette_entry(unsigned long index,unsigned long palette)871 Gal_set_display_palette_entry(unsigned long index, unsigned long palette)
872 {
873 GAL_PALETTE_ENTRY sPalette;
874
875 INIT_GAL(&sPalette);
876 sPalette.dwSubfunction = GALFN_SETPALETTE_ENTRY;
877 sPalette.dwIndex = index;
878 sPalette.dwPalette = palette;
879
880 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sPalette))
881 return 0;
882 else
883 return 1;
884 }
885
886 /*---------------------------------------------------------------------------
887 * Gal_get_display_palette_entry
888 *
889 * Description: This function gets the display palette entry of the
890 * galdevice.
891 * parameters:
892 * index: It specifies the palette index,
893 * palette: It is a pointer to the palette of the galdevice.
894 * return: '1' was returned on success otherwise '0' was returned.
895 *-------------------------------------------------------------------------*/
896 BOOLEAN
Gal_get_display_palette_entry(unsigned long index,unsigned long * palette)897 Gal_get_display_palette_entry(unsigned long index, unsigned long *palette)
898 {
899 GAL_PALETTE_ENTRY sPalette;
900
901 INIT_GAL(&sPalette);
902 sPalette.dwSubfunction = GALFN_GETPALETTE_ENTRY;
903 sPalette.dwIndex = index;
904
905 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sPalette))
906 return 0;
907 else {
908 *palette = sPalette.dwPalette;
909 return 1;
910 }
911 }
912
913 /*---------------------------------------------------------------------------
914 * Gal_set_display_palette_entry
915 *
916 * Description: This function sets the display palette entry of the
917 * galdevice.
918 * parameters:
919 * pPalette: It specifies the palette structure of the galdevice.
920 * return: '1' was returned on success otherwise '0' was returned.
921 *-------------------------------------------------------------------------*/
922 BOOLEAN
Gal_set_display_palette(PGAL_PALETTE pPalette)923 Gal_set_display_palette(PGAL_PALETTE pPalette)
924 {
925 INIT_GAL(pPalette);
926 pPalette->dwSubfunction = GALFN_SETPALETTE;
927
928 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pPalette))
929 return 0;
930 else
931 return 1;
932 }
933
934 /*---------------------------------------------------------------------------
935 * Gal_get_display_palette_entry
936 *
937 * Description: This function gets the display palette entry of the
938 * galdevice.
939 * parameters:
940 * pPalette: It specifies the palette structure of the galdevice.
941 * return: '1' was returned on success otherwise '0' was returned.
942 *-------------------------------------------------------------------------*/
943 BOOLEAN
Gal_get_display_palette(PGAL_PALETTE pPalette)944 Gal_get_display_palette(PGAL_PALETTE pPalette)
945 {
946 INIT_GAL(pPalette);
947 pPalette->dwSubfunction = GALFN_GETPALETTE;
948
949 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pPalette))
950 return 0;
951 else {
952 return 1;
953 }
954 }
955
956 /*---------------------------------------------------------------------------
957 * Gal_wait_until_idle
958 *
959 * Description: This function waits until the graphics engine is idle.
960 * parameters: none.
961 * return: '1' was returned on success otherwise '0' was returned.
962 *-------------------------------------------------------------------------*/
963 BOOLEAN
Gal_wait_until_idle(void)964 Gal_wait_until_idle(void)
965 {
966 GAL_WAITUNTILIDLE sWaitIdle;
967
968 INIT_GAL(&sWaitIdle);
969 sWaitIdle.dwSubfunction = GALFN_WAITUNTILIDLE;
970
971 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sWaitIdle))
972 return 0;
973 else
974 return 1;
975 }
976
977 /*---------------------------------------------------------------------------
978 * Gal_wait_vertical_blank
979 *
980 * Description: This function wait until start of vertical blank.
981 * parameters: none.
982 * return: '1' was returned on success otherwise '0' was returned.
983 *-------------------------------------------------------------------------*/
984 BOOLEAN
Gal_wait_vertical_blank(void)985 Gal_wait_vertical_blank(void)
986 {
987 GAL_WAITVERTICALBLANK sWaitVerticalBlank;
988
989 INIT_GAL(&sWaitVerticalBlank);
990 sWaitVerticalBlank.dwSubfunction = GALFN_WAITVERTICALBLANK;
991
992 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sWaitVerticalBlank))
993 return 0;
994 else
995 return 1;
996 }
997
998 /*--------------------------------------------------------------------------
999 * Gal_set_cursor_enable
1000 *
1001 * Description: This function enable or disable the hardware cursor.
1002 * parameters:
1003 * enable: This specifies the enable value of the cursor.
1004 * return: '1' was returned on success otherwise '0' was returned.
1005 *-------------------------------------------------------------------------*/
1006 BOOLEAN
Gal_set_cursor_enable(int enable)1007 Gal_set_cursor_enable(int enable)
1008 {
1009 GAL_CURSORENABLE sCursorEnable;
1010
1011 INIT_GAL(&sCursorEnable);
1012 sCursorEnable.dwSubfunction = GALFN_SETCURSORENABLE;
1013 sCursorEnable.bCursorEnable = enable ? 1 : 0;
1014 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorEnable))
1015 return 0;
1016 else
1017 return 1;
1018 }
1019
1020 /*--------------------------------------------------------------------------
1021 * Gal_set_cursor_position
1022 *
1023 * Description: This function sets the position of the cursor.
1024 * parameters:
1025 * memoffset: It specifies the memory offset of the cursor position.
1026 * xpos: It specifies the X co-ordinate position of the cursor.
1027 * ypos: It specifies the Y co-ordinate position of the cursor.
1028 * xhotspot: It specifies the X hotspot location for current cursor shape.
1029 * yhotspot: It specifies the Y hotspot location for current cursor shape.
1030 * return: '1' was returned on success otherwise '0' was returned.
1031 *-------------------------------------------------------------------------*/
1032 BOOLEAN
Gal_set_cursor_position(unsigned long memoffset,unsigned short xpos,unsigned short ypos,unsigned short xhotspot,unsigned short yhotspot)1033 Gal_set_cursor_position(unsigned long memoffset,
1034 unsigned short xpos, unsigned short ypos,
1035 unsigned short xhotspot, unsigned short yhotspot)
1036 {
1037 GAL_CURSORPOSITION sCursorPos;
1038
1039 INIT_GAL(&sCursorPos);
1040 sCursorPos.dwSubfunction = GALFN_SETCURSORPOSITION;
1041 sCursorPos.dwMemOffset = memoffset;
1042 sCursorPos.wXPos = xpos;
1043 sCursorPos.wYPos = ypos;
1044 sCursorPos.wXHot = xhotspot;
1045 sCursorPos.wYHot = yhotspot;
1046 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorPos))
1047 return 0;
1048 else
1049 return 1;
1050 }
1051
1052 /*--------------------------------------------------------------------------
1053 * Gal_get_cursor_position
1054 *
1055 * Description: This function gets the cursor position.
1056 * parameters:
1057 * memoffset: It points the memory offset of the cursor position.
1058 * xpos: It points the X co-ordinate position of the cursor.
1059 * ypos: It points the Y co-ordinate position of the cursor.
1060 * xhotspot: It points the X hotspot location for current cursor shape.
1061 * yhotspot: It points the Y hotspot location for current cursor shape.
1062 * return: '1' was returned on success otherwise '0' was returned.
1063 *-------------------------------------------------------------------------*/
1064 BOOLEAN
Gal_get_cursor_position(unsigned long * memoffset,unsigned short * xpos,unsigned short * ypos,unsigned short * xhotspot,unsigned short * yhotspot)1065 Gal_get_cursor_position(unsigned long *memoffset,
1066 unsigned short *xpos, unsigned short *ypos,
1067 unsigned short *xhotspot, unsigned short *yhotspot)
1068 {
1069 GAL_CURSORPOSITION sCursorPos;
1070
1071 INIT_GAL(&sCursorPos);
1072 sCursorPos.dwSubfunction = GALFN_GETCURSORPOSITION;
1073 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorPos))
1074 return 0;
1075 else {
1076 *memoffset = sCursorPos.dwMemOffset;
1077 *xpos = sCursorPos.wXPos;
1078 *ypos = sCursorPos.wYPos;
1079 *xhotspot = sCursorPos.wXHot;
1080 *yhotspot = sCursorPos.wYHot;
1081 return 1;
1082 }
1083 }
1084
1085 /*--------------------------------------------------------------------------
1086 * Gal_set_cursor_shape32
1087 *
1088 * Description: This function loads 32x32 cursor pattern.
1089 * parameters:
1090 * memoffset: It specifies the graphics memory offset for cursor shape.
1091 * andmask: It is a pointer to 32 DWORD of AND data.
1092 * xormask: It is a pointer to 32 DWORD of XOR data.
1093 * return: '1' was returned on success otherwise '0' was returned.
1094 *-------------------------------------------------------------------------*/
1095 BOOLEAN
Gal_set_cursor_shape32(unsigned long memoffset,unsigned long * andmask,unsigned long * xormask)1096 Gal_set_cursor_shape32(unsigned long memoffset,
1097 unsigned long *andmask, unsigned long *xormask)
1098 {
1099 GAL_SETCURSORSHAPE sCursorShape;
1100
1101 INIT_GAL(&sCursorShape);
1102 sCursorShape.dwSubfunction = GALFN_SETCURSORSHAPE;
1103 sCursorShape.dwMemOffset = memoffset;
1104
1105 direct_memcpy(sCursorShape.dwAndMask, andmask, sizeof(sCursorShape.dwAndMask));
1106
1107 direct_memcpy(sCursorShape.dwXorMask, xormask, sizeof(sCursorShape.dwXorMask));
1108
1109 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorShape))
1110 return 0;
1111 else
1112 return 1;
1113 }
1114
1115 /*--------------------------------------------------------------------------
1116 * Gal_set_cursor_shape64
1117 *
1118 * Description: This function loads 64x64 cursor pattern.
1119 * parameters:
1120 * memoffset: It specifies the graphics memory offset for cursor shape.
1121 * andmask: It is a pointer to 64 DWORD of AND data.
1122 * xormask: It is a pointer to 64 DWORD of XOR data.
1123 * return: '1' was returned on success otherwise '0' was returned.
1124 *-------------------------------------------------------------------------*/ BOOLEAN
Gal_set_cursor_shape64(unsigned long memoffset,unsigned long * andmask,unsigned long * xormask)1125 Gal_set_cursor_shape64(unsigned long memoffset,
1126 unsigned long *andmask, unsigned long *xormask)
1127 {
1128 GAL_SETCURSORSHAPE sCursorShape;
1129
1130 INIT_GAL(&sCursorShape);
1131 sCursorShape.dwSubfunction = GALFN_SETCURSORSHAPE_RCLD;
1132 sCursorShape.dwMemOffset = memoffset;
1133
1134 direct_memcpy(sCursorShape.dwAndMask, andmask, sizeof(sCursorShape.dwAndMask));
1135
1136 direct_memcpy(sCursorShape.dwXorMask, xormask, sizeof(sCursorShape.dwXorMask));
1137
1138 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorShape))
1139 return 0;
1140 else
1141 return 1;
1142 }
1143
1144 /*--------------------------------------------------------------------------
1145 * Gal_set_cursor_colors
1146 *
1147 * Description: This function sets the colors of the hardware cursor.
1148 * parameters:
1149 * bkcolor:It specifies the RGB value for the background color.
1150 * fgcolor:It specifies the RGB value for the foreground color.
1151 * return: '1' was returned on success otherwise '0' was returned.
1152 *-------------------------------------------------------------------------*/
1153 BOOLEAN
Gal_set_cursor_colors(unsigned long bkcolor,unsigned long fgcolor)1154 Gal_set_cursor_colors(unsigned long bkcolor, unsigned long fgcolor)
1155 {
1156 GAL_CURSORCOLORS sCursorColor;
1157
1158 INIT_GAL(&sCursorColor);
1159 sCursorColor.dwSubfunction = GALFN_SETCURSORCOLORS;
1160 sCursorColor.dwBgColor = bkcolor;
1161 sCursorColor.dwFgColor = fgcolor;
1162
1163 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorColor))
1164 return 0;
1165 else
1166 return 1;
1167 }
1168
1169 /*--------------------------------------------------------------------------
1170 * Gal_get_cursor_colors
1171 *
1172 * Description: This function gets the colors of the hardware cursor.
1173 * parameters:
1174 * bkcolor:It points the RGB value for the background color.
1175 * fgcolor:It points the RGB value for the foreground color.
1176 * return: '1' was returned on success otherwise '0' was returned.
1177 *-------------------------------------------------------------------------*/
1178 BOOLEAN
Gal_get_cursor_colors(unsigned long * bkcolor,unsigned long * fgcolor)1179 Gal_get_cursor_colors(unsigned long *bkcolor, unsigned long *fgcolor)
1180 {
1181 GAL_CURSORCOLORS sCursorColor;
1182
1183 INIT_GAL(&sCursorColor);
1184 sCursorColor.dwSubfunction = GALFN_GETCURSORCOLORS;
1185
1186 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCursorColor))
1187 return 0;
1188 else {
1189 *bkcolor = sCursorColor.dwBgColor;
1190 *fgcolor = sCursorColor.dwFgColor;
1191 return 1;
1192 }
1193 }
1194
1195 /*--------------------------------------------------------------------------
1196 * Gal_set_solid_pattern
1197 *
1198 * Description: This function sets a solid pattern color for future rendering.
1199 * parameters:
1200 * color: It specifies the pattern color in proper format for current
1201 * display mode.
1202 * return: '1' was returned on success otherwise '0' was returned.
1203 *-------------------------------------------------------------------------*/
1204 BOOLEAN
Gal_set_solid_pattern(unsigned long color)1205 Gal_set_solid_pattern(unsigned long color)
1206 {
1207 GAL_SETSOLIDPATTERN sSetSoildPat;
1208
1209 INIT_GAL(&sSetSoildPat);
1210 sSetSoildPat.dwSubfunction = GALFN_SETSOLIDPATTERN;
1211 sSetSoildPat.dwColor = color;
1212
1213 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetSoildPat))
1214 return 0;
1215 else
1216 return 1;
1217 }
1218
1219 /*--------------------------------------------------------------------------
1220 * Gal_set_solid_source
1221 *
1222 * Description: This function specifies a constant source data value for
1223 * raster operations that use both pattern
1224 * and source data.
1225 * parameters:
1226 * color: It specifies the source color.
1227 * return: '1' was returned on success otherwise '0' was returned.
1228 *-------------------------------------------------------------------------*/
1229 BOOLEAN
Gal_set_solid_source(unsigned long color)1230 Gal_set_solid_source(unsigned long color)
1231 {
1232 GAL_SETSOLIDSOURCE sSetSolidSrc;
1233
1234 INIT_GAL(&sSetSolidSrc);
1235 sSetSolidSrc.dwSubfunction = GALFN_SETSOLIDSOURCE;
1236 sSetSolidSrc.dwColor = color;
1237 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetSolidSrc))
1238 return 0;
1239 else
1240 return 1;
1241 }
1242
1243 /*--------------------------------------------------------------------------
1244 * Gal_set_mono_source
1245 *
1246 * Description:
1247 * parameters:
1248 * bkcolor: It specifies the background color.
1249 * fgcolor: It specifies the foreground color.
1250 *transparency: It specifies the transparency flag.
1251 * return: '1' was returned on success otherwise '0' was returned.
1252 *------------------------------------------------------------------------*/
1253 BOOLEAN
Gal_set_mono_source(unsigned long bgcolor,unsigned long fgcolor,unsigned char transparency)1254 Gal_set_mono_source(unsigned long bgcolor, unsigned long fgcolor,
1255 unsigned char transparency)
1256 {
1257 GAL_SETMONOSOURCE sSetMonoSrc;
1258
1259 INIT_GAL(&sSetMonoSrc);
1260 sSetMonoSrc.dwSubfunction = GALFN_SETMONOSOURCE;
1261 sSetMonoSrc.dwFgColor = fgcolor;
1262 sSetMonoSrc.dwBgColor = bgcolor;
1263 sSetMonoSrc.cTransparency = transparency;
1264 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetMonoSrc))
1265 return 0;
1266 else
1267 return 1;
1268 }
1269
1270 /*--------------------------------------------------------------------------
1271 * Gal_set_mono_pattern
1272 *
1273 * Description: This function specifies an 8x8 monochrome pattern
1274 * used in future rendering operations.
1275 * parameters:
1276 * bkcolor: It specifies the background color.
1277 * fgcolor: It specifies the foreground color.
1278 * data0: It specifies the bits of 8x8 monochrome pattern.
1279 * data1: It specifies the bits of 8x8 monochrome pattern.
1280 *transparency: It specifies the transparency flag.
1281 * return: '1' was returned on success otherwise '0' was returned.
1282 *------------------------------------------------------------------------*/
1283 BOOLEAN
Gal_set_mono_pattern(unsigned long bgcolor,unsigned long fgcolor,unsigned long data0,unsigned long data1,unsigned char transparency)1284 Gal_set_mono_pattern(unsigned long bgcolor, unsigned long fgcolor,
1285 unsigned long data0, unsigned long data1,
1286 unsigned char transparency)
1287 {
1288 GAL_SETMONOPATTERN sSetMonoPat;
1289
1290 INIT_GAL(&sSetMonoPat);
1291 sSetMonoPat.dwSubfunction = GALFN_SETMONOPATTERN;
1292 sSetMonoPat.dwFgColor = fgcolor;
1293 sSetMonoPat.dwBgColor = bgcolor;
1294 sSetMonoPat.dwData0 = data0;
1295 sSetMonoPat.dwData1 = data1;
1296 sSetMonoPat.cTransparency = transparency;
1297 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetMonoPat))
1298 return 0;
1299 else
1300 return 1;
1301 }
1302
1303 /*--------------------------------------------------------------------------
1304 * Gal_set_raster_operation
1305 *
1306 * Description: This function specifies the raster operation for
1307 * future rendering.
1308 * parameters:
1309 * rop: It specifies the ternary raster operation
1310 * (pattern/source/destination).
1311 * return: '1' was returned on success otherwise '0' was returned.
1312 *------------------------------------------------------------------------*/
1313 BOOLEAN
Gal_set_raster_operation(unsigned char rop)1314 Gal_set_raster_operation(unsigned char rop)
1315 {
1316 GAL_RASTEROPERATION sSetRop;
1317
1318 INIT_GAL(&sSetRop);
1319 sSetRop.dwSubfunction = GALFN_SETRASTEROPERATION;
1320 sSetRop.cRop = rop;
1321
1322 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetRop))
1323 return 0;
1324 else
1325 return 1;
1326 }
1327
1328 /*--------------------------------------------------------------------------
1329 * Gal_pattern_fill
1330 *
1331 * Description: This function renders pattern data to a rectangular
1332 * region.
1333 * parameters:
1334 * x: It specifies the screen X position, in pixels.
1335 * y: It specifies the screen Y position, in pixels.
1336 * width: It specifies the width of rectangle, in pixels.
1337 * height: It specifies the height of rectangle, in pixels.
1338 * return: '1' was returned on success otherwise '0' was returned.
1339 *------------------------------------------------------------------------*/
1340 BOOLEAN
Gal_pattern_fill(unsigned short x,unsigned short y,unsigned short width,unsigned short height)1341 Gal_pattern_fill(unsigned short x, unsigned short y,
1342 unsigned short width, unsigned short height)
1343 {
1344 GAL_PATTERNFILL sPatternFill;
1345
1346 INIT_GAL(&sPatternFill);
1347 sPatternFill.dwSubfunction = GALFN_PATTERNFILL;
1348 sPatternFill.wXPos = x;
1349 sPatternFill.wYPos = y;
1350 sPatternFill.wWidth = width;
1351 sPatternFill.wHeight = height;
1352
1353 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sPatternFill))
1354 return 0;
1355 else
1356 return 1;
1357 }
1358
1359 /*--------------------------------------------------------------------------
1360 * Gal_screen_to_screen_blt
1361 *
1362 * Description: This function is used to perform a screen to screen
1363 * BLT operation.
1364 * parameters:
1365 * srcx: It specifies the source X position.
1366 * srcy: It specifies the source Y position.
1367 * dstx: It specifies the destination X position.
1368 * dsty: It specifies the destination Y position.
1369 * width: It specifies the width of BLT, in pixels.
1370 * height: It specifies the height of BLT, in pixels.
1371 * return: '1' was returned on success otherwise '0' was returned.
1372 *------------------------------------------------------------------------*/
1373 BOOLEAN
Gal_screen_to_screen_blt(unsigned short srcx,unsigned short srcy,unsigned short dstx,unsigned short dsty,unsigned short width,unsigned short height)1374 Gal_screen_to_screen_blt(unsigned short srcx, unsigned short srcy,
1375 unsigned short dstx, unsigned short dsty,
1376 unsigned short width, unsigned short height)
1377 {
1378 GAL_SCREENTOSCREENBLT sScreenBlt;
1379
1380 INIT_GAL(&sScreenBlt);
1381 sScreenBlt.dwSubfunction = GALFN_SCREENTOSCREENBLT;
1382 sScreenBlt.wXStart = srcx;
1383 sScreenBlt.wYStart = srcy;
1384 sScreenBlt.wXEnd = dstx;
1385 sScreenBlt.wYEnd = dsty;
1386 sScreenBlt.wWidth = width;
1387 sScreenBlt.wHeight = height;
1388
1389 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sScreenBlt))
1390 return 0;
1391 else
1392 return 1;
1393 }
1394
1395 /*--------------------------------------------------------------------------
1396 * Gal_screen_to_screen_xblt
1397 *
1398 * Description: This function is used to perform a screen to screen
1399 * BLT operation using a transparency color.
1400 * parameters:
1401 * srcx: It specifies the source X position.
1402 * srcy: It specifies the source Y position.
1403 * dstx: It specifies the destination X position.
1404 * dsty: It specifies the destination Y position.
1405 * width: It specifies the width of BLT, in pixels.
1406 * height: It specifies the height of BLT, in pixels.
1407 * color: It specifies the transparency color.
1408 * return: '1' was returned on success otherwise '0' was returned.
1409 *------------------------------------------------------------------------*/
1410 BOOLEAN
Gal_screen_to_screen_xblt(unsigned short srcx,unsigned short srcy,unsigned short dstx,unsigned short dsty,unsigned short width,unsigned short height,unsigned long color)1411 Gal_screen_to_screen_xblt(unsigned short srcx, unsigned short srcy,
1412 unsigned short dstx, unsigned short dsty,
1413 unsigned short width, unsigned short height,
1414 unsigned long color)
1415 {
1416 GAL_SCREENTOSCREENXBLT sScreenXBlt;
1417
1418 INIT_GAL(&sScreenXBlt);
1419 sScreenXBlt.dwSubfunction = GALFN_SCREENTOSCREENXBLT;
1420 sScreenXBlt.wXStart = srcx;
1421 sScreenXBlt.wYStart = srcy;
1422 sScreenXBlt.wXEnd = dstx;
1423 sScreenXBlt.wYEnd = dsty;
1424 sScreenXBlt.wWidth = width;
1425 sScreenXBlt.wHeight = height;
1426 sScreenXBlt.dwColor = color;
1427
1428 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sScreenXBlt))
1429 return 0;
1430 else
1431 return 1;
1432 }
1433
1434 /*--------------------------------------------------------------------------
1435 * Gal_bresenham_line
1436 *
1437 * Description: This function is used to draw a single pixel line
1438 * using the specified Bresenham parameters.
1439 * parameters:
1440 * x: It specifies the starting X position.
1441 * y: It specifies the starting Y position.
1442 * length: It specifies the length of the vector, in pixels.
1443 * initerr: It specifies the Bresenham initial error term.
1444 * axialerr: It specifies the Bresenham axial error term
1445 * (moving in major direction only).
1446 * diagerr: It specifies Bresenham diagonal error term
1447 * (moving in major and minor direction.
1448 * flags: It specifies the flag.
1449 * return: '1' was returned on success otherwise '0' was returned.
1450 *------------------------------------------------------------------------*/
1451 BOOLEAN
Gal_bresenham_line(unsigned short x,unsigned short y,unsigned short length,unsigned short initerr,unsigned short axialerr,unsigned short diagerr,unsigned short flags)1452 Gal_bresenham_line(unsigned short x, unsigned short y,
1453 unsigned short length, unsigned short initerr,
1454 unsigned short axialerr, unsigned short diagerr,
1455 unsigned short flags)
1456 {
1457 GAL_BRESENHAMLINE sBresenhamLine;
1458
1459 INIT_GAL(&sBresenhamLine);
1460 sBresenhamLine.dwSubfunction = GALFN_BRESENHAMLINE;
1461 sBresenhamLine.wX1 = x;
1462 sBresenhamLine.wY1 = y;
1463 sBresenhamLine.wLength = length;
1464 sBresenhamLine.wErr = initerr;
1465 sBresenhamLine.wE1 = axialerr;
1466 sBresenhamLine.wE2 = diagerr;
1467 sBresenhamLine.wFlags = flags;
1468
1469 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sBresenhamLine))
1470 return 0;
1471 else
1472 return 1;
1473 }
1474
1475 BOOLEAN
Gal_color_pattern_fill(unsigned short x,unsigned short y,unsigned short width,unsigned short height,unsigned long pattern)1476 Gal_color_pattern_fill(unsigned short x, unsigned short y,
1477 unsigned short width, unsigned short height,
1478 unsigned long pattern)
1479 {
1480 GAL_COLOR_PATTERNFILL sColorPat;
1481
1482 INIT_GAL(&sColorPat);
1483 sColorPat.dwSubfunction = GALFN_COLOR_PATTERNFILL;
1484 sColorPat.wDstx = x;
1485 sColorPat.wDsty = y;
1486 sColorPat.wWidth = width;
1487 sColorPat.wHeight = height;
1488 sColorPat.dwPattern = pattern;
1489
1490 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sColorPat))
1491 return 0;
1492 else
1493 return 1;
1494 }
1495
1496 BOOLEAN
Gal_color_bitmap_to_screen_blt(unsigned short srcx,unsigned short srcy,unsigned short dstx,unsigned short dsty,unsigned short width,unsigned short height,unsigned long data,long pitch)1497 Gal_color_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy,
1498 unsigned short dstx, unsigned short dsty,
1499 unsigned short width, unsigned short height,
1500 unsigned long data, long pitch)
1501 {
1502 GAL_COLOR_BITMAP_TO_SCREEN_BLT sBmp2Scr;
1503
1504 INIT_GAL(&sBmp2Scr);
1505 sBmp2Scr.dwSubfunction = GALFN_COLOR_BITMAP_TO_SCREEN_BLT;
1506 sBmp2Scr.wSrcx = srcx;
1507 sBmp2Scr.wSrcy = srcy;
1508 sBmp2Scr.wDstx = dstx;
1509 sBmp2Scr.wDsty = dsty;
1510 sBmp2Scr.wWidth = width;
1511 sBmp2Scr.wHeight = height;
1512 sBmp2Scr.dwData = data;
1513 sBmp2Scr.wPitch = pitch;
1514
1515 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sBmp2Scr))
1516 return 0;
1517 else
1518 return 1;
1519 }
1520
1521 BOOLEAN
Gal_color_bitmap_to_screen_xblt(unsigned short srcx,unsigned short srcy,unsigned short dstx,unsigned short dsty,unsigned short width,unsigned short height,unsigned long data,long pitch,unsigned long color)1522 Gal_color_bitmap_to_screen_xblt(unsigned short srcx, unsigned short srcy,
1523 unsigned short dstx, unsigned short dsty,
1524 unsigned short width, unsigned short height,
1525 unsigned long data, long pitch,
1526 unsigned long color)
1527 {
1528 GAL_COLOR_BITMAP_TO_SCREEN_XBLT sBmp2Scr;
1529
1530 INIT_GAL(&sBmp2Scr);
1531 sBmp2Scr.dwSubfunction = GALFN_COLOR_BITMAP_TO_SCREEN_XBLT;
1532 sBmp2Scr.wSrcx = srcx;
1533 sBmp2Scr.wSrcy = srcy;
1534 sBmp2Scr.wDstx = dstx;
1535 sBmp2Scr.wDsty = dsty;
1536 sBmp2Scr.wWidth = width;
1537 sBmp2Scr.wHeight = height;
1538 sBmp2Scr.dwData = data;
1539 sBmp2Scr.wPitch = pitch;
1540 sBmp2Scr.dwColor = color;
1541
1542 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sBmp2Scr))
1543 return 0;
1544 else
1545 return 1;
1546 }
1547
1548 BOOLEAN
Gal_mono_bitmap_to_screen_blt(unsigned short srcx,unsigned short srcy,unsigned short dstx,unsigned short dsty,unsigned short width,unsigned short height,unsigned long data,short pitch)1549 Gal_mono_bitmap_to_screen_blt(unsigned short srcx, unsigned short srcy,
1550 unsigned short dstx, unsigned short dsty,
1551 unsigned short width, unsigned short height,
1552 unsigned long data, short pitch)
1553 {
1554 GAL_MONO_BITMAP_TO_SCREEN_BLT sBmp2Scr;
1555
1556 INIT_GAL(&sBmp2Scr);
1557 sBmp2Scr.dwSubfunction = GALFN_MONO_BITMAP_TO_SCREEN_BLT;
1558 sBmp2Scr.wSrcx = srcx;
1559 sBmp2Scr.wSrcy = srcy;
1560 sBmp2Scr.wDstx = dstx;
1561 sBmp2Scr.wDsty = dsty;
1562 sBmp2Scr.wWidth = width;
1563 sBmp2Scr.wHeight = height;
1564 sBmp2Scr.dwData = data;
1565 sBmp2Scr.wPitch = pitch;
1566
1567 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sBmp2Scr))
1568 return 0;
1569 else
1570 return 1;
1571 }
1572
1573 BOOLEAN
Gal_text_blt(unsigned short dstx,unsigned short dsty,unsigned short width,unsigned short height,unsigned long data)1574 Gal_text_blt(unsigned short dstx, unsigned short dsty, unsigned short width,
1575 unsigned short height, unsigned long data)
1576 {
1577 GAL_TEXT_BLT sTextBlt;
1578
1579 INIT_GAL(&sTextBlt);
1580 sTextBlt.dwSubfunction = GALFN_TEXT_BLT;
1581 sTextBlt.wDstx = dstx;
1582 sTextBlt.wDsty = dsty;
1583 sTextBlt.wWidth = width;
1584 sTextBlt.wHeight = height;
1585 sTextBlt.dwData = data;
1586
1587 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sTextBlt))
1588 return 0;
1589 else
1590 return 1;
1591 }
1592
1593 /*------------------------------------------------------------------------
1594 * Gal_set_compression_enable
1595 *
1596 * Description: This function enables or disables display
1597 * compression.
1598 * parameters:
1599 * bCompressionState: It specifies the display compression state.
1600 * return: '1' was returned on success otherwise
1601 * '0' was returned.
1602 *----------------------------------------------------------------------*/
1603 BOOLEAN
Gal_set_compression_enable(BOOLEAN bCompressionState)1604 Gal_set_compression_enable(BOOLEAN bCompressionState)
1605 {
1606 GAL_COMPRESSIONSTATE sCompState;
1607
1608 INIT_GAL(&sCompState);
1609 sCompState.dwSubfunction = GALFN_SETCOMPRESSIONSTATE;
1610 sCompState.bCompressionState = bCompressionState;
1611
1612 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCompState))
1613 return 0;
1614 else
1615 return 1;
1616 }
1617
1618 /*------------------------------------------------------------------------
1619 * Gal_get_compression_enable
1620 *
1621 * Description: This function gets the compression state.
1622 *
1623 * parameters:
1624 * bCompressionState: gets the display compression state.
1625 * return: '1' was returned on success otherwise
1626 * '0' was returned.
1627 *----------------------------------------------------------------------*/
1628 BOOLEAN
Gal_get_compression_enable(int * bCompressionState)1629 Gal_get_compression_enable(int *bCompressionState)
1630 {
1631 GAL_COMPRESSIONSTATE sCompState;
1632
1633 INIT_GAL(&sCompState);
1634 sCompState.dwSubfunction = GALFN_GETCOMPRESSIONSTATE;
1635
1636 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCompState))
1637 return 0;
1638 else {
1639 *bCompressionState = sCompState.bCompressionState;
1640 return 1;
1641 }
1642 }
1643
1644 /*--------------------------------------------------------------------------
1645 * Gal_set_compression_parameters
1646 *
1647 * Description: This function sets the compression parameters of the
1648 * frame buffer device.
1649 * parameters:
1650 * flags: It specifies the flag.
1651 * offset: It specifies the base offset in graphics memory for the
1652 * compression buffer.
1653 * pitch: It specifies the pitch of compression buffer, in bytes.
1654 * size: It specifies the maximum line size of the compression buffer
1655 * in bytes.
1656 * return: '1' was returned on success otherwise '0' was returned.
1657 *------------------------------------------------------------------------*/
1658 BOOLEAN
Gal_set_compression_parameters(unsigned long flags,unsigned long offset,unsigned short pitch,unsigned short size)1659 Gal_set_compression_parameters(unsigned long flags,
1660 unsigned long offset, unsigned short pitch,
1661 unsigned short size)
1662 {
1663 GAL_COMPRESSIONPARAMS sCompParams;
1664
1665 INIT_GAL(&sCompParams);
1666 sCompParams.dwSubfunction = GALFN_SETCOMPRESSIONPARAMS;
1667 sCompParams.dwFlags = flags;
1668 sCompParams.dwCompOffset = offset;
1669 sCompParams.dwCompPitch = pitch;
1670 sCompParams.dwCompSize = size;
1671
1672 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCompParams))
1673 return 0;
1674 else
1675 return 1;
1676 }
1677
1678 /*--------------------------------------------------------------------------
1679 * Gal_get_compression_parameters
1680 *
1681 * Description: This function gets the compression parameters of the
1682 * frame buffer device.
1683 * parameters:
1684 * flags: It specifies the flag.
1685 * offset: gets the base offset in graphics memory for the
1686 * compression buffer.
1687 * pitch: gets the pitch of compression buffer, in bytes.
1688 * size: gets the maximum line size of the compression buffer
1689 * in bytes.
1690 * return: '1' was returned on success otherwise '0' was returned.
1691 *------------------------------------------------------------------------*/
1692 BOOLEAN
Gal_get_compression_parameters(unsigned long flags,unsigned long * offset,unsigned short * pitch,unsigned short * size)1693 Gal_get_compression_parameters(unsigned long flags,
1694 unsigned long *offset,
1695 unsigned short *pitch, unsigned short *size)
1696 {
1697 GAL_COMPRESSIONPARAMS sCompParams;
1698
1699 INIT_GAL(&sCompParams);
1700 sCompParams.dwSubfunction = GALFN_GETCOMPRESSIONPARAMS;
1701 sCompParams.dwFlags = flags;
1702
1703 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sCompParams))
1704 return 0;
1705 else {
1706 *offset = sCompParams.dwCompOffset;
1707 *pitch = sCompParams.dwCompPitch;
1708 *size = sCompParams.dwCompSize;
1709 return 1;
1710 }
1711 }
1712
1713 /*--------------------------------------------------------------------------
1714 * Gal_vga_mode_switch
1715 *
1716 * Description:This function signals the beginning or end of a
1717 * mode switch.
1718 * parameters:
1719 * active: It specifies the mode switch.
1720 * return: '1' was returned on success otherwise '0' was returned.
1721 *------------------------------------------------------------------------*/
1722 BOOLEAN
Gal_vga_mode_switch(int active)1723 Gal_vga_mode_switch(int active)
1724 {
1725 GAL_VGAMODEDATA sVgaData;
1726
1727 INIT_GAL(&sVgaData);
1728 sVgaData.dwSubfunction = GALFN_VGAMODESWITCH;
1729 sVgaData.dwFlags = active;
1730
1731 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgaData))
1732 return 0;
1733 else
1734 return 1;
1735 }
1736
1737 /*--------------------------------------------------------------------------
1738 * Gal_vga_clear_extended
1739 *
1740 * Description: This will clear the Svga data.
1741 * parameters: none.
1742 * return: '1' was returned on success otherwise '0' was returned.
1743 *------------------------------------------------------------------------*/
1744 BOOLEAN
Gal_vga_clear_extended(void)1745 Gal_vga_clear_extended(void)
1746 {
1747 GAL_VGAMODEDATA sVgaData;
1748
1749 INIT_GAL(&sVgaData);
1750 sVgaData.dwSubfunction = GALFN_VGACLEARCRTEXT;
1751
1752 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sVgaData))
1753 return 0;
1754 else
1755 return 1;
1756 }
1757
1758 /*--------------------------------------------------------------------------
1759 * Gal_vga_pitch
1760 *
1761 * Description: This function sets VGA register values in VGA
1762 * structure for specified pitch.
1763 * parameters:
1764 * pVgaData: It specifies the vga structure.
1765 * pitch: It specifies the number of bytes between scanlines.
1766 * return: '1' was returned on success otherwise '0' was returned.
1767 *------------------------------------------------------------------------*/
1768 BOOLEAN
Gal_vga_pitch(PGAL_VGAMODEDATA pVgaData,unsigned short pitch)1769 Gal_vga_pitch(PGAL_VGAMODEDATA pVgaData, unsigned short pitch)
1770 {
1771 INIT_GAL(pVgaData);
1772 pVgaData->dwSubfunction = GALFN_VGASETPITCH;
1773 pVgaData->dwFlags = pitch;
1774
1775 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pVgaData))
1776 return 0;
1777 else {
1778 return 1;
1779 }
1780 }
1781
1782 /*--------------------------------------------------------------------------
1783 * Gal_vga_restore
1784 *
1785 * Description: This function sets the VGA state to the values in the
1786 * VGA structure.
1787 * parameters:
1788 * pVgaData: It specifies the vga structure.
1789 * return: '1' was returned on success otherwise '0' was returned.
1790 *------------------------------------------------------------------------*/
1791 BOOLEAN
Gal_vga_restore(PGAL_VGAMODEDATA pVgaData)1792 Gal_vga_restore(PGAL_VGAMODEDATA pVgaData)
1793 {
1794 INIT_GAL(pVgaData);
1795 pVgaData->dwSubfunction = GALFN_VGARESTORE;
1796
1797 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pVgaData))
1798 return 0;
1799 else
1800 return 1;
1801 }
1802
1803 /*--------------------------------------------------------------------------
1804 * Gal_vga_save
1805 *
1806 * Description: This function saves the current VGA state in the
1807 * VGA structure.
1808 * parameters:
1809 * pVgaData: It specifies the vga structure.
1810 * return: '1' was returned on success otherwise '0' was returned.
1811 *------------------------------------------------------------------------*/
1812 BOOLEAN
Gal_vga_save(PGAL_VGAMODEDATA pVgaData)1813 Gal_vga_save(PGAL_VGAMODEDATA pVgaData)
1814 {
1815 INIT_GAL(pVgaData);
1816 pVgaData->dwSubfunction = GALFN_VGASAVE;
1817
1818 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pVgaData))
1819 return 0;
1820 else {
1821 return 1;
1822 }
1823 }
1824
1825 /*--------------------------------------------------------------------------
1826 * Gal_vga_mode
1827 *
1828 * Description: This function sets VGA register values in VGA
1829 * structure for specified mode.
1830 * parameters:
1831 * pVgaData: It specifies the vga structure.
1832 * return: '1' was returned on success otherwise '0' was returned.
1833 *------------------------------------------------------------------------*/
1834 BOOLEAN
Gal_vga_mode(PGAL_VGAMODEDATA pVgaData)1835 Gal_vga_mode(PGAL_VGAMODEDATA pVgaData)
1836 {
1837 INIT_GAL(pVgaData);
1838 pVgaData->dwSubfunction = GALFN_VGASETMODE;
1839
1840 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pVgaData))
1841 return 0;
1842 else {
1843 return 1;
1844 }
1845 }
1846
1847 /*--------------------------------------------------------------------------
1848 * Gal_pnl_enabled_in_bios
1849 *
1850 * Description: This function gets the status of the FP in BIOS.
1851 * parameters:
1852 * status: returns the state of FP in Bios.
1853 * pParam: It specifies the panel parameters structure.
1854 * return: '1' was returned on success otherwise '0' was returned.
1855 *------------------------------------------------------------------------*/
1856 BOOLEAN
Gal_pnl_enabled_in_bios(int * state)1857 Gal_pnl_enabled_in_bios(int *state)
1858 {
1859 GAL_PNLBIOS pStat;
1860
1861 INIT_GAL(&pStat);
1862 pStat.dwSubfunction = GALFN_PNLBIOSENABLE;
1863
1864 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
1865 return 0;
1866 else {
1867 *state = pStat.state;
1868 return 1;
1869 }
1870 }
1871
1872 /*--------------------------------------------------------------------------
1873 * Gal_pnl_info_from_bios
1874 *
1875 * Description: This function gets the parameters of the FP in BIOS.
1876 * parameters:
1877 * status: returns the state of FP in Bios.
1878 * pParam: It specifies the panel parameters structure.
1879 * return: '1' was returned on success otherwise '0' was returned.
1880 *------------------------------------------------------------------------*/
1881 BOOLEAN
Gal_pnl_info_from_bios(int * xres,int * yres,int * bpp,int * hz)1882 Gal_pnl_info_from_bios(int *xres, int *yres, int *bpp, int *hz)
1883 {
1884 GAL_PNLBIOS pStat;
1885
1886 INIT_GAL(&pStat);
1887 pStat.dwSubfunction = GALFN_PNLBIOSINFO;
1888
1889 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
1890 return 0;
1891 else {
1892 *xres = pStat.XRes;
1893 *yres = pStat.YRes;
1894 *bpp = pStat.Bpp;
1895 *hz = pStat.Freq;
1896 return 1;
1897 }
1898 }
1899
1900 /*--------------------------------------------------------------------------
1901 * Gal_pnl_set_params
1902 *
1903 * Description: This function sets the panel parameters.
1904 * parameters:
1905 * flags:
1906 * pParam: It specifies the panel parameters structure.
1907 * return: '1' was returned on success otherwise '0' was returned.
1908 *------------------------------------------------------------------------*/
1909 BOOLEAN
Gal_pnl_set_params(unsigned long flags,PPnl_PanelParams pParam)1910 Gal_pnl_set_params(unsigned long flags, PPnl_PanelParams pParam)
1911 {
1912 GAL_PNLPARAMS pStat;
1913
1914 INIT_GAL(&pStat);
1915 pStat.dwSubfunction = GALFN_PNLSETPARAMS;
1916 pParam->Flags = flags;
1917 direct_memcpy(&(pStat.PanelParams), pParam, sizeof(Pnl_PanelParams));
1918
1919 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
1920 return 0;
1921 else {
1922 return 1;
1923 }
1924 }
1925
1926 /*--------------------------------------------------------------------------
1927 * Gal_pnl_get_params
1928 *
1929 * Description: This function gets the panel parameters.
1930 * parameters:
1931 * flags:
1932 * pParam: It specifies the panel parameters structure.
1933 * return: '1' was returned on success otherwise '0' was returned.
1934 *------------------------------------------------------------------------*/
1935 BOOLEAN
Gal_pnl_get_params(unsigned long flags,PPnl_PanelParams pParam)1936 Gal_pnl_get_params(unsigned long flags, PPnl_PanelParams pParam)
1937 {
1938 GAL_PNLPARAMS pStat;
1939
1940 INIT_GAL(&pStat);
1941 pStat.dwSubfunction = GALFN_PNLGETPARAMS;
1942 direct_memcpy(&(pStat.PanelParams), pParam, sizeof(Pnl_PanelParams));
1943 pStat.PanelParams.Flags = flags;
1944
1945 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
1946 return 0;
1947 else {
1948 direct_memcpy(pParam, &(pStat.PanelParams), sizeof(Pnl_PanelParams));
1949 return 1;
1950 }
1951 }
1952
1953 /*--------------------------------------------------------------------------
1954 * Gal_pnl_init
1955 *
1956 * Description: This function initializes the panel parameters.
1957 * parameters:
1958 * pParam: It specifies the panel parameters structure.
1959 * return: '1' was returned on success otherwise '0' was returned.
1960 *------------------------------------------------------------------------*/
1961 BOOLEAN
Gal_pnl_init(PPnl_PanelParams pParam)1962 Gal_pnl_init(PPnl_PanelParams pParam)
1963 {
1964 GAL_PNLPARAMS pStat;
1965
1966 INIT_GAL(&pStat);
1967 pStat.dwSubfunction = GALFN_PNLINITPANEL;
1968 direct_memcpy(&(pStat.PanelParams), pParam, sizeof(Pnl_PanelParams));
1969
1970 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
1971 return 0;
1972 else
1973 return 1;
1974
1975 }
1976
1977 /*--------------------------------------------------------------------------
1978 * Gal_pnl_save
1979 *
1980 * Description: This function saves the current panel parameters.
1981 * parameters: none.
1982 * return: '1' was returned on success otherwise '0' was returned.
1983 *------------------------------------------------------------------------*/
1984 BOOLEAN
Gal_pnl_save(void)1985 Gal_pnl_save(void)
1986 {
1987 GAL_PNLPARAMS pStat;
1988
1989 INIT_GAL(&pStat);
1990 pStat.dwSubfunction = GALFN_PNLSAVESTATE;
1991
1992 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
1993 return 0;
1994 else {
1995 return 1;
1996 }
1997 }
1998
1999 /*--------------------------------------------------------------------------
2000 * Gal_pnl_restore
2001 *
2002 * Description: This function restores the current panel parameters.
2003 * parameters: none.
2004 * return: '1' was returned on success otherwise '0' was returned.
2005 *------------------------------------------------------------------------*/
2006 BOOLEAN
Gal_pnl_restore(void)2007 Gal_pnl_restore(void)
2008 {
2009 GAL_PNLPARAMS pStat;
2010
2011 INIT_GAL(&pStat);
2012 pStat.dwSubfunction = GALFN_PNLRESTORESTATE;
2013
2014 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
2015 return 0;
2016 else {
2017 return 1;
2018 }
2019 }
2020
2021 /*--------------------------------------------------------------------------
2022 * Gal_pnl_powerup
2023 *
2024 * Description: This function powers up the panel.
2025 * parameters: none.
2026 * return: '1' was returned on success otherwise '0' was returned.
2027 *------------------------------------------------------------------------*/
2028 BOOLEAN
Gal_pnl_powerup(void)2029 Gal_pnl_powerup(void)
2030 {
2031 GAL_BASE pStat;
2032
2033 INIT_GAL(&pStat);
2034 pStat.dwSubfunction = GALFN_PNLPOWERUP;
2035
2036 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
2037 return 0;
2038 else {
2039 return 1;
2040 }
2041 }
2042
2043 /*--------------------------------------------------------------------------
2044 * Gal_pnl_powerdown
2045 *
2046 * Description: This function powers down the panel.
2047 * parameters: none.
2048 * return: '1' was returned on success otherwise '0' was returned.
2049 *------------------------------------------------------------------------*/
2050 BOOLEAN
Gal_pnl_powerdown(void)2051 Gal_pnl_powerdown(void)
2052 {
2053 GAL_BASE pStat;
2054
2055 INIT_GAL(&pStat);
2056 pStat.dwSubfunction = GALFN_PNLPOWERDOWN;
2057
2058 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pStat))
2059 return 0;
2060 else {
2061 return 1;
2062 }
2063 }
2064
2065 /*--------------------------------------------------------------------------
2066 * Gal_enable_panning
2067 *
2068 * Description: This routine enables the panning when the Mode
2069 * is bigger than the panel size.
2070 * parameters:
2071 * x: x-positon of the screen.
2072 * y: y-positon of the screen.
2073 *
2074 * return: '1' was returned on success otherwise '0' was returned.
2075 *------------------------------------------------------------------------*/
2076 BOOLEAN
Gal_enable_panning(int x,int y)2077 Gal_enable_panning(int x, int y)
2078 {
2079 GAL_ENABLEPANNING pEnablePanning;
2080
2081 INIT_GAL(&pEnablePanning);
2082 pEnablePanning.dwSubfunction = GALFN_ENABLEPANNING;
2083 pEnablePanning.x = x;
2084 pEnablePanning.y = y;
2085
2086 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pEnablePanning))
2087 return 0;
2088 else {
2089 return 1;
2090 }
2091 }
2092
2093
2094 /*--------------------------------------------------------------------------
2095 * Gal_tv_set_params
2096 *
2097 * Description: This function sets the tv parameters of
2098 * tvparameters structure.
2099 * parameters:
2100 * flags:
2101 * pTV: It specifies the tv parameters structure.
2102 * return: '1' was returned on success otherwise '0' was returned.
2103 *------------------------------------------------------------------------*/
2104 BOOLEAN
Gal_tv_set_params(unsigned long flags,PGAL_TVPARAMS pTV)2105 Gal_tv_set_params(unsigned long flags, PGAL_TVPARAMS pTV)
2106 {
2107 INIT_GAL(pTV);
2108 pTV->dwSubfunction = GALFN_SETTVPARAMS;
2109 pTV->dwFlags = flags;
2110
2111 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV))
2112 return 0;
2113 else {
2114 return 1;
2115 }
2116 }
2117
2118 /*--------------------------------------------------------------------------
2119 * Gal_tv_get_params
2120 *
2121 * Description: This function gets the tv parameters of
2122 * tvparameters structure.
2123 * parameters:
2124 * flags: Dummy flag
2125 * pTV: It specifies the tv parameters structure.
2126 * return: '1' was returned on success otherwise '0' was returned.
2127 *------------------------------------------------------------------------*/
2128 BOOLEAN
Gal_tv_get_params(unsigned long flags,PGAL_TVPARAMS pTV)2129 Gal_tv_get_params(unsigned long flags, PGAL_TVPARAMS pTV)
2130 {
2131 INIT_GAL(pTV);
2132 pTV->dwSubfunction = GALFN_GETTVPARAMS;
2133 pTV->dwFlags = flags;
2134
2135 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV))
2136 return 0;
2137 else
2138 return 1;
2139
2140 }
2141
2142 /*--------------------------------------------------------------------------
2143 * Gal_tv_set_timings
2144 *
2145 * Description: This function sets the tv timing registers.
2146 * parameters:
2147 * flags: Dummy flag.
2148 * pTV: It specifies the tv parameters structure.
2149 * return: '1' was returned on success otherwise '0' was returned.
2150 *------------------------------------------------------------------------*/
2151 BOOLEAN
Gal_tv_set_timings(unsigned long flags,PGAL_TVTIMING pTV)2152 Gal_tv_set_timings(unsigned long flags, PGAL_TVTIMING pTV)
2153 {
2154 INIT_GAL(pTV);
2155 pTV->dwSubfunction = GALFN_SETTVTIMING;
2156 pTV->dwFlags = flags;
2157
2158 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV))
2159 return 0;
2160 else {
2161 return 1;
2162 }
2163 }
2164
2165 /*--------------------------------------------------------------------------
2166 * Gal_tv_get_timings
2167 *
2168 * Description: This function gets the tv timing registers.
2169 * parameters:
2170 * flags: Dummy flag.
2171 * pTV: It specifies the tv parameters structure.
2172 * return: '1' was returned on success otherwise '0' was returned.
2173 *------------------------------------------------------------------------*/
2174 BOOLEAN
Gal_tv_get_timings(unsigned long flags,PGAL_TVTIMING pTV)2175 Gal_tv_get_timings(unsigned long flags, PGAL_TVTIMING pTV)
2176 {
2177 INIT_GAL(pTV);
2178 pTV->dwSubfunction = GALFN_GETTVTIMING;
2179 pTV->dwFlags = flags;
2180
2181 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV))
2182 return 0;
2183 else {
2184 return 1;
2185 }
2186 }
2187
2188 /*--------------------------------------------------------------------------
2189 * Gal_set_tv_enable
2190 *
2191 * Description: This function sets the tv state of the device .
2192 * parameters:
2193 * bState : set the tv state.
2194 * return: '1' was returned on success otherwise '0' was returned.
2195 *------------------------------------------------------------------------*/
2196 BOOLEAN
Gal_set_tv_enable(int bState)2197 Gal_set_tv_enable(int bState)
2198 {
2199 GAL_TVPARAMS pTV;
2200
2201 INIT_GAL(&pTV);
2202 pTV.dwSubfunction = GALFN_SETENABLE;
2203 pTV.bState = bState;
2204
2205 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pTV))
2206 return 0;
2207 else {
2208 return 1;
2209 }
2210 }
2211
2212 /*--------------------------------------------------------------------------
2213 * Gal_get_tv_enable
2214 *
2215 * Description: This function gets the tv state of the device .
2216 * parameters:
2217 * bState : get the tv state.
2218 * return: '1' was returned on success otherwise '0' was returned.
2219 *------------------------------------------------------------------------*/
2220 BOOLEAN
Gal_get_tv_enable(unsigned int * bState)2221 Gal_get_tv_enable(unsigned int *bState)
2222 {
2223 GAL_TVPARAMS pTV;
2224
2225 INIT_GAL(&pTV);
2226 pTV.dwSubfunction = GALFN_GETENABLE;
2227
2228 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &pTV)) {
2229 *bState = 0;
2230 return 0;
2231 } else {
2232 *bState = pTV.bState;
2233 return 1;
2234 }
2235 }
2236
2237 /*--------------------------------------------------------------------------
2238 * Gal_is_tv_mode_supported
2239 *
2240 * Description: This function checks the tv mode is supported or not.
2241 * parameters:
2242 * flags: Dummy flag
2243 * pTV: It specifies the tv parameters structure.
2244 * return: '1' was returned on success otherwise '0' was returned.
2245 *------------------------------------------------------------------------*/
2246 BOOLEAN
Gal_is_tv_mode_supported(unsigned long flags,PGAL_TVPARAMS pTV,int * bState)2247 Gal_is_tv_mode_supported(unsigned long flags, PGAL_TVPARAMS pTV, int *bState)
2248 {
2249 INIT_GAL(pTV);
2250 pTV->dwSubfunction = GALFN_ISTVMODESUPPORTED;
2251 pTV->dwFlags = flags;
2252
2253 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, pTV)) {
2254 return 0;
2255 } else {
2256 *bState = pTV->bState;
2257 return 1;
2258 }
2259 }
2260
2261 /** Video **********************************************************/
2262
2263 /*--------------------------------------------------------------------------
2264 * Gal_set_video_enable
2265 *
2266 * Description: This function sets the video enable state.
2267 * parameters:
2268 * enable: Its value is '1' to enable video and '0' to disable video.
2269 * return: '1' was returned on success otherwise '0' was returned.
2270 *------------------------------------------------------------------------*/
2271 BOOLEAN
Gal_set_video_enable(int enable)2272 Gal_set_video_enable(int enable)
2273 {
2274 GAL_VIDEOENABLE sSetVideo;
2275
2276 INIT_GAL(&sSetVideo);
2277 sSetVideo.dwSubfunction = GALFN_SETVIDEOENABLE;
2278 sSetVideo.enable = enable;
2279 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2280 return 0;
2281 else
2282 return 1;
2283 }
2284
2285 /*--------------------------------------------------------------------------
2286 * Gal_set_video_format
2287 *
2288 * Description: This function sets the video format.
2289 * parameters:
2290 * format: Its video format value.
2291 * return: '1' was returned on success otherwise '0' was returned.
2292 *------------------------------------------------------------------------*/
2293 BOOLEAN
Gal_set_video_format(int format)2294 Gal_set_video_format(int format)
2295 {
2296 GAL_VIDEOFORMAT sSetVideo;
2297
2298 INIT_GAL(&sSetVideo);
2299 sSetVideo.dwSubfunction = GALFN_SETVIDEOFORMAT;
2300 sSetVideo.format = format;
2301 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2302 return 0;
2303 else
2304 return 1;
2305 }
2306
2307 /*--------------------------------------------------------------------------
2308 * Gal_set_video_size
2309 *
2310 * Description: This function sets the video size.
2311 * parameters:
2312 * width: Width of the video.
2313 * height: Height of the video.
2314 * return: '1' was returned on success otherwise '0' was returned.
2315 *------------------------------------------------------------------------*/
2316 BOOLEAN
Gal_set_video_size(unsigned short width,unsigned short height)2317 Gal_set_video_size(unsigned short width, unsigned short height)
2318 {
2319 GAL_VIDEOSIZE sSetVideo;
2320
2321 INIT_GAL(&sSetVideo);
2322 sSetVideo.dwSubfunction = GALFN_SETVIDEOSIZE;
2323 sSetVideo.width = width;
2324 sSetVideo.height = height;
2325 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2326 return 0;
2327 else
2328 return 1;
2329 }
2330
2331 /*--------------------------------------------------------------------------
2332 * Gal_set_video_offset
2333 *
2334 * Description: This function sets the video size.
2335 * parameters:
2336 * offset: Offset of the video.
2337 * return: '1' was returned on success otherwise '0' was returned.
2338 *------------------------------------------------------------------------*/
2339 BOOLEAN
Gal_set_video_offset(unsigned long offset)2340 Gal_set_video_offset(unsigned long offset)
2341 {
2342 GAL_VIDEOOFFSET sSetVideo;
2343
2344 INIT_GAL(&sSetVideo);
2345 sSetVideo.dwSubfunction = GALFN_SETVIDEOOFFSET;
2346 sSetVideo.offset = offset;
2347 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2348 return 0;
2349 else
2350 return 1;
2351 }
2352
2353 /*--------------------------------------------------------------------------
2354 * Gal_set_video_window
2355 *
2356 * Description: This function sets the video window.
2357 * parameters:
2358 * x: X co-ordinate of the Video screen.
2359 * y: Y co-ordinate of the Video screen.
2360 * w: Width of the Video screen.
2361 * h: Height of the Video screen.
2362 * return: '1' was returned on success otherwise '0' was returned.
2363 *------------------------------------------------------------------------*/
2364 BOOLEAN
Gal_set_video_window(short x,short y,short w,short h)2365 Gal_set_video_window(short x, short y, short w, short h)
2366 {
2367 GAL_VIDEOWINDOW sSetVideo;
2368
2369 INIT_GAL(&sSetVideo);
2370 sSetVideo.dwSubfunction = GALFN_SETVIDEOWINDOW;
2371 sSetVideo.x = x;
2372 sSetVideo.y = y;
2373 sSetVideo.w = w;
2374 sSetVideo.h = h;
2375 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2376 return 0;
2377 else
2378 return 1;
2379 }
2380
2381 /*--------------------------------------------------------------------------
2382 * Gal_set_video_scale
2383 *
2384 * Description: This function sets the video scale.
2385 * parameters:
2386 * srcw: Source width.
2387 * srch: Source height.
2388 * dstw: Destination width.
2389 * dsth: Destination height.
2390 * return: '1' was returned on success otherwise '0' was returned.
2391 *------------------------------------------------------------------------*/
2392 BOOLEAN
Gal_set_video_scale(unsigned short srcw,unsigned short srch,unsigned short dstw,unsigned short dsth)2393 Gal_set_video_scale(unsigned short srcw, unsigned short srch,
2394 unsigned short dstw, unsigned short dsth)
2395 {
2396 GAL_VIDEOSCALE sSetVideo;
2397
2398 INIT_GAL(&sSetVideo);
2399 sSetVideo.dwSubfunction = GALFN_SETVIDEOSCALE;
2400 sSetVideo.srcw = srcw;
2401 sSetVideo.srch = srch;
2402 sSetVideo.dstw = dstw;
2403 sSetVideo.dsth = dsth;
2404 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2405 return 0;
2406 else
2407 return 1;
2408 }
2409
2410 /*--------------------------------------------------------------------------
2411 * Gal_set_video_filter.
2412 *
2413 * Description: This function sets the video filter.
2414 * parameters:
2415 * xfilter: X-co-ordinate filter.
2416 * yfilter: Y-co-ordinate filter.
2417 * return: '1' was returned on success otherwise '0' was returned.
2418 *------------------------------------------------------------------------*/
2419 BOOLEAN
Gal_set_video_filter(int xfilter,int yfilter)2420 Gal_set_video_filter(int xfilter, int yfilter)
2421 {
2422 GAL_VIDEOFILTER sSetVideo;
2423
2424 INIT_GAL(&sSetVideo);
2425 sSetVideo.dwSubfunction = GALFN_SETVIDEOFILTER;
2426 sSetVideo.xfilter = xfilter;
2427 sSetVideo.yfilter = yfilter;
2428 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2429 return 0;
2430 else
2431 return 1;
2432 }
2433
2434 /*--------------------------------------------------------------------------
2435 * Gal_set_video_color_key.
2436 *
2437 * Description: This function sets the video color key.
2438 * parameters:
2439 * key: Color key.
2440 * mask: Color mask.
2441 * bluescreen: Value for bluescreen.
2442 * return: '1' was returned on success otherwise '0' was returned.
2443 *------------------------------------------------------------------------*/
2444 BOOLEAN
Gal_set_video_color_key(unsigned long key,unsigned long mask,int bluescreen)2445 Gal_set_video_color_key(unsigned long key, unsigned long mask, int bluescreen)
2446 {
2447 GAL_VIDEOCOLORKEY sSetVideo;
2448
2449 INIT_GAL(&sSetVideo);
2450 sSetVideo.dwSubfunction = GALFN_SETVIDEOCOLORKEY;
2451 sSetVideo.key = key;
2452 sSetVideo.mask = mask;
2453 sSetVideo.bluescreen = bluescreen;
2454 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2455 return 0;
2456 else
2457 return 1;
2458 }
2459
2460 /*--------------------------------------------------------------------------
2461 * Gal_set_video_downscale_enable.
2462 *
2463 * Description: This function sets the video downscale enable state.
2464 * parameters:
2465 * enable: Value for enable or disable the video downscale.
2466 * return: '1' was returned on success otherwise '0' was returned.
2467 *------------------------------------------------------------------------*/
2468 BOOLEAN
Gal_set_video_downscale_enable(int enable)2469 Gal_set_video_downscale_enable(int enable)
2470 {
2471 GAL_VIDEODOWNSCALEENABLE sSetVideo;
2472
2473 INIT_GAL(&sSetVideo);
2474 sSetVideo.dwSubfunction = GALFN_SETVIDEODOWNSCALEENABLE;
2475 sSetVideo.enable = enable;
2476 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2477 return 0;
2478 else
2479 return 1;
2480 }
2481
2482 /*--------------------------------------------------------------------------
2483 * Gal_set_video_downscale_config.
2484 *
2485 * Description: This function sets the video downscale configuration.
2486 * parameters:
2487 * type: Video down scale type.
2488 * m: Factor for the Video overlay window.
2489 * return: '1' was returned on success otherwise '0' was returned.
2490 *------------------------------------------------------------------------*/
2491 BOOLEAN
Gal_set_video_downscale_config(unsigned short type,unsigned short m)2492 Gal_set_video_downscale_config(unsigned short type, unsigned short m)
2493 {
2494 GAL_VIDEODOWNSCALECONFIG sSetVideo;
2495
2496 INIT_GAL(&sSetVideo);
2497 sSetVideo.dwSubfunction = GALFN_SETVIDEODOWNSCALECONFIG;
2498 sSetVideo.type = type;
2499 sSetVideo.m = m;
2500 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2501 return 0;
2502 else
2503 return 1;
2504 }
2505
2506 /*--------------------------------------------------------------------------
2507 * Gal_set_video_downscale_coefficients.
2508 *
2509 * Description: This function sets the video downscale coefficients.
2510 * parameters:
2511 * coef1: Video downscale filter coefficient.
2512 * coef2: Video downscale filter coefficient.
2513 * coef3: Video downscale filter coefficient.
2514 * coef4: Video downscale filter coefficient.
2515 * return: '1' was returned on success otherwise '0' was returned.
2516 *------------------------------------------------------------------------*/
2517 BOOLEAN
Gal_set_video_downscale_coefficients(unsigned short coef1,unsigned short coef2,unsigned short coef3,unsigned short coef4)2518 Gal_set_video_downscale_coefficients(unsigned short coef1,
2519 unsigned short coef2,
2520 unsigned short coef3,
2521 unsigned short coef4)
2522 {
2523 GAL_VIDEODOWNSCALECOEFF sSetVideo;
2524
2525 INIT_GAL(&sSetVideo);
2526 sSetVideo.dwSubfunction = GALFN_SETVIDEODOWNSCALECOEFF;
2527 sSetVideo.coef1 = coef1;
2528 sSetVideo.coef2 = coef2;
2529 sSetVideo.coef3 = coef3;
2530 sSetVideo.coef4 = coef4;
2531 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2532 return 0;
2533 else
2534 return 1;
2535 }
2536
2537 /*--------------------------------------------------------------------------
2538 * Gal_set_video_source.
2539 *
2540 * Description: This function sets the video source to either memory or Direct
2541 * VIP
2542 * parameters:
2543 * source: Video source.
2544 * return: '1' was returned on success otherwise '0' was returned.
2545 *------------------------------------------------------------------------*/
2546 BOOLEAN
Gal_set_video_source(int source)2547 Gal_set_video_source(int source)
2548 {
2549 GAL_VIDEOSOURCE sSetVideo;
2550
2551 INIT_GAL(&sSetVideo);
2552 sSetVideo.dwSubfunction = GALFN_SETVIDEOSOURCE;
2553 sSetVideo.source = source;
2554 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2555 return 0;
2556 else
2557 return 1;
2558 }
2559
2560 /*--------------------------------------------------------------------------
2561 * Gal_set_video_interlaced
2562 *
2563 * Description: This function configures the Video processor video overlay mode
2564 * to be interlaced YUV.
2565 * parameters:
2566 * enable: Value used to enable or disalbe the Video interlaced.
2567 * return: '1' was returned on success otherwise '0' was returned.
2568 *------------------------------------------------------------------------*/
2569
2570 BOOLEAN
Gal_set_video_interlaced(int enable)2571 Gal_set_video_interlaced(int enable)
2572 {
2573 GAL_SETVIDEOINTERLACED sSetVideo;
2574
2575 INIT_GAL(&sSetVideo);
2576 sSetVideo.dwSubfunction = GALFN_SETVIDEOINTERLACED;
2577 sSetVideo.enable = enable;
2578 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2579 return 0;
2580 else
2581 return 1;
2582 }
2583
2584 /*--------------------------------------------------------------------------
2585 * Gal_set_video_color_space
2586 *
2587 * Description: This function configures the Video processor to prcoess
2588 * graphics and video in either YUV or RGB color space.
2589 *
2590 * parameters:
2591 * enable: Value used to enable or disalbe the Video color space.
2592 * return: '1' was returned on success otherwise '0' was returned.
2593 *------------------------------------------------------------------------*/
2594 BOOLEAN
Gal_set_color_space_YUV(int colorspace)2595 Gal_set_color_space_YUV(int colorspace)
2596 {
2597 GAL_COLORSPACEYUV sSetVideo;
2598
2599 INIT_GAL(&sSetVideo);
2600 sSetVideo.dwSubfunction = GALFN_SETVIDEOCOLORSPACE;
2601 sSetVideo.colorspace = colorspace;
2602 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2603 return 0;
2604 else
2605 return 1;
2606 }
2607
2608 /*--------------------------------------------------------------------------
2609 * Gal_set_video_cursor.
2610 *
2611 * Description: This function configures the Video Hardware cursor.
2612 *
2613 *
2614 * parameters:
2615 * key: color key.
2616 * mask: color mask.
2617 *select_color2: selected for color2.
2618 * color1: color1 value.
2619 * color2: color2 value.
2620 * return: '1' was returned on success otherwise '0' was returned.
2621 *------------------------------------------------------------------------*/
2622 BOOLEAN
Gal_set_video_cursor(unsigned long key,unsigned long mask,unsigned short select_color2,unsigned long color1,unsigned long color2)2623 Gal_set_video_cursor(unsigned long key,
2624 unsigned long mask,
2625 unsigned short select_color2,
2626 unsigned long color1, unsigned long color2)
2627 {
2628 GAL_VIDEOCURSOR sSetVideo;
2629
2630 INIT_GAL(&sSetVideo);
2631 sSetVideo.dwSubfunction = GALFN_SETVIDEOCURSOR;
2632 sSetVideo.key = key;
2633 sSetVideo.mask = mask;
2634 sSetVideo.select_color2 = select_color2;
2635 sSetVideo.color1 = color1;
2636 sSetVideo.color2 = color2;
2637 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2638 return 0;
2639 else
2640 return 1;
2641 }
2642
2643 /*--------------------------------------------------------------------------
2644 * Gal_set_video_request.
2645 *
2646 * Description: This function sets the horizontal(pixel) and vertical(line)
2647 * video request values.
2648 *
2649 * parameters:
2650 * x: X video request value.
2651 * y: Y video request value.
2652 * return: '1' was returned on success otherwise '0' was returned.
2653 *------------------------------------------------------------------------*/
2654 BOOLEAN
Gal_set_video_request(short x,short y)2655 Gal_set_video_request(short x, short y)
2656 {
2657 GAL_VIDEOREQUEST sSetVideo;
2658
2659 INIT_GAL(&sSetVideo);
2660 sSetVideo.dwSubfunction = GALFN_SETVIDEOREQUEST;
2661 sSetVideo.x = x;
2662 sSetVideo.y = y;
2663 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2664 return 0;
2665 else
2666 return 1;
2667 }
2668
2669 /*--------------------------------------------------------------------------
2670 * Gal_set_alpha_enable.
2671 *
2672 * Description: This function enables or disables the currently selected
2673 * alpha region.
2674 *
2675 * parameters:
2676 * enable: Value to enalbe or disable alha region.
2677 * return: '1' was returned on success otherwise '0' was returned.
2678 *------------------------------------------------------------------------*/
2679 BOOLEAN
Gal_set_alpha_enable(int enable)2680 Gal_set_alpha_enable(int enable)
2681 {
2682 GAL_ALPHAENABLE sSetVideo;
2683
2684 INIT_GAL(&sSetVideo);
2685 sSetVideo.dwSubfunction = GALFN_SETALPHAENABLE;
2686 sSetVideo.enable = enable;
2687 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2688 return 0;
2689 else
2690 return 1;
2691 }
2692
2693 /*--------------------------------------------------------------------------
2694 * Gal_get_alpha_enable.
2695 *
2696 * Description: This function gets the alpha enable state.
2697 *
2698 * parameters:
2699 * enable: Pointer to get the enable state.
2700 * return: '1' was returned on success otherwise '0' was returned.
2701 *------------------------------------------------------------------------*/
2702 BOOLEAN
Gal_get_alpha_enable(int * enable)2703 Gal_get_alpha_enable(int *enable)
2704 {
2705 GAL_ALPHAENABLE sGetalphaenable;
2706
2707 INIT_GAL(&sGetalphaenable);
2708 sGetalphaenable.dwSubfunction = GALFN_GETALPHAENABLE;
2709
2710 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetalphaenable))
2711 return 0;
2712 else
2713
2714 *enable = sGetalphaenable.enable;
2715 return 1;
2716 }
2717
2718 /*--------------------------------------------------------------------------
2719 * Gal_set_alpha_window
2720 *
2721 * Description: This function sets the size of the currently selected
2722 * alpha region.
2723 * parameters:
2724 * x: X co-ordinate of the alpha region.
2725 * y: Y co-ordinate of the alpha region.
2726 * width: Width of the alpha region.
2727 * height: Height of the alpha region.
2728 * return: '1' was returned on success otherwise '0' was returned.
2729 *------------------------------------------------------------------------*/
2730 BOOLEAN
Gal_set_alpha_window(short x,short y,unsigned short width,unsigned short height)2731 Gal_set_alpha_window(short x, short y,
2732 unsigned short width, unsigned short height)
2733 {
2734 GAL_ALPHAWINDOW sSetVideo;
2735
2736 INIT_GAL(&sSetVideo);
2737 sSetVideo.dwSubfunction = GALFN_SETALPHAWINDOW;
2738 sSetVideo.x = x;
2739 sSetVideo.y = y;
2740 sSetVideo.width = width;
2741 sSetVideo.height = height;
2742 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2743 return 0;
2744 else
2745 return 1;
2746 }
2747
2748 /*--------------------------------------------------------------------------
2749 * Gal_get_alpha_size
2750 *
2751 * Description: This function gets the size of the currently selected
2752 * alpha region.
2753 * parameters:
2754 * x: X co-ordinate of the alpha region.
2755 * y: Y co-ordinate of the alpha region.
2756 * width: Width of the alpha region.
2757 * height: Height of the alpha region.
2758 * return: '1' was returned on success otherwise '0' was returned.
2759 *------------------------------------------------------------------------*/
2760 BOOLEAN
Gal_get_alpha_size(unsigned short * x,unsigned short * y,unsigned short * width,unsigned short * height)2761 Gal_get_alpha_size(unsigned short *x, unsigned short *y,
2762 unsigned short *width, unsigned short *height)
2763 {
2764 GAL_ALPHASIZE sGetalphasize;
2765
2766 INIT_GAL(&sGetalphasize);
2767 sGetalphasize.dwSubfunction = GALFN_GETALPHASIZE;
2768 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetalphasize))
2769 return 0;
2770 else {
2771 *x = *(sGetalphasize.x);
2772 *y = *(sGetalphasize.y);
2773 *width = *(sGetalphasize.width);
2774 *height = *(sGetalphasize.height);
2775 return 1;
2776 }
2777 }
2778
2779 /*--------------------------------------------------------------------------
2780 * Gal_set_alpha_value
2781 *
2782 * Description: This function sets the alpha value for the selected alpha
2783 * region. It also specifies an increment/decrement value for
2784 * fading.
2785 * parameters:
2786 * alpha: Alpha value for the currently selected alpha region.
2787 * delta: Gives the increment/decrement fading value.
2788 * return: '1' was returned on success otherwise '0' was returned.
2789 *------------------------------------------------------------------------*/
2790 BOOLEAN
Gal_set_alpha_value(unsigned char alpha,char delta)2791 Gal_set_alpha_value(unsigned char alpha, char delta)
2792 {
2793 GAL_ALPHAVALUE sSetVideo;
2794
2795 INIT_GAL(&sSetVideo);
2796 sSetVideo.dwSubfunction = GALFN_SETALPHAVALUE;
2797 sSetVideo.alpha = alpha;
2798 sSetVideo.delta = delta;
2799 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2800 return 0;
2801 else
2802 return 1;
2803 }
2804
2805 /*--------------------------------------------------------------------------
2806 * Gal_get_alpha_value
2807 *
2808 * Description: This function gets the alpha value for the selected alpha
2809 * region. It also gets increment/decrement value for
2810 * fading.
2811 * parameters:
2812 * alpha: Alpha value for the currently selected alpha region.
2813 * delta: Gives the increment/decrement fading value.
2814 * return: '1' was returned on success otherwise '0' was returned.
2815 *------------------------------------------------------------------------*/
2816 BOOLEAN
Gal_get_alpha_value(unsigned char * alpha,char * delta)2817 Gal_get_alpha_value(unsigned char *alpha, char *delta)
2818 {
2819 GAL_ALPHAVALUE sGetalphavalue;
2820
2821 INIT_GAL(&sGetalphavalue);
2822 sGetalphavalue.dwSubfunction = GALFN_GETALPHAVALUE;
2823
2824 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetalphavalue))
2825 return 0;
2826 else {
2827 *alpha = sGetalphavalue.alpha;
2828 *delta = sGetalphavalue.delta;
2829 return 1;
2830 }
2831 }
2832
2833 /*--------------------------------------------------------------------------
2834 * Gal_set_alpha_priority
2835 *
2836 * Description: This function sets the priority of the selected alpha
2837 * region.
2838 * parameters:
2839 * priority: Gives the priority value.
2840 * return: '1' was returned on success otherwise '0' was returned.
2841 *------------------------------------------------------------------------*/
2842 BOOLEAN
Gal_set_alpha_priority(int priority)2843 Gal_set_alpha_priority(int priority)
2844 {
2845 GAL_ALPHAPRIORITY sSetVideo;
2846
2847 INIT_GAL(&sSetVideo);
2848 sSetVideo.dwSubfunction = GALFN_SETALPHAPRIORITY;
2849 sSetVideo.priority = priority;
2850 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2851 return 0;
2852 else
2853 return 1;
2854 }
2855
2856 /*--------------------------------------------------------------------------
2857 * Gal_get_alpha_priority
2858 *
2859 * Description: This function gets the priority of the selected alpha
2860 * region.
2861 * parameters:
2862 * priority: Gives the priority value.
2863 * return: '1' was returned on success otherwise '0' was returned.
2864 *------------------------------------------------------------------------*/
2865 BOOLEAN
Gal_get_alpha_priority(int * priority)2866 Gal_get_alpha_priority(int *priority)
2867 {
2868 GAL_ALPHAPRIORITY sGetalphapriority;
2869
2870 INIT_GAL(&sGetalphapriority);
2871 sGetalphapriority.dwSubfunction = GALFN_GETALPHAPRIORITY;
2872 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetalphapriority))
2873 return 0;
2874 else {
2875 *priority = sGetalphapriority.priority;
2876 return 1;
2877 }
2878 }
2879
2880 /*--------------------------------------------------------------------------
2881 * Gal_set_alpha_color
2882 *
2883 * Description: This function sets the color to be displayed inside the
2884 * currently of the selected alpha window.
2885 * parameters:
2886 * color: Gives the color value to be displayed.
2887 * return: '1' was returned on success otherwise '0' was returned.
2888 *------------------------------------------------------------------------*/
2889 BOOLEAN
Gal_set_alpha_color(unsigned long color)2890 Gal_set_alpha_color(unsigned long color)
2891 {
2892 GAL_ALPHACOLOR sSetVideo;
2893
2894 INIT_GAL(&sSetVideo);
2895 sSetVideo.dwSubfunction = GALFN_SETALPHACOLOR;
2896 sSetVideo.color = color;
2897 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2898 return 0;
2899 else
2900 return 1;
2901 }
2902
2903 /*--------------------------------------------------------------------------
2904 * Gal_get_alpha_color
2905 *
2906 * Description: This function gets the color to be displayed inside the
2907 * currently of the selected alpha window.
2908 * parameters:
2909 * color: Gives the color value to be displayed.
2910 * return: '1' was returned on success otherwise '0' was returned.
2911 *------------------------------------------------------------------------*/
2912 BOOLEAN
Gal_get_alpha_color(unsigned long * color)2913 Gal_get_alpha_color(unsigned long *color)
2914 {
2915 GAL_ALPHACOLOR sGetalphacolor;
2916
2917 INIT_GAL(&sGetalphacolor);
2918 sGetalphacolor.dwSubfunction = GALFN_GETALPHACOLOR;
2919
2920 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetalphacolor))
2921 return 0;
2922 else {
2923 *color = sGetalphacolor.color;
2924 return 1;
2925 }
2926 }
2927
2928 /*--------------------------------------------------------------------------
2929 * Gal_select_alpha_region
2930 *
2931 * Description: This function selects the alpha region should be used for
2932 * future updates.
2933 * parameters:
2934 * region: Gives the alpha window number.
2935 * return: '1' was returned on success otherwise '0' was returned.
2936 *------------------------------------------------------------------------*/
2937 BOOLEAN
Gal_select_alpha_region(int region)2938 Gal_select_alpha_region(int region)
2939 {
2940 GAL_ALPHAREGION sSetVideo;
2941
2942 INIT_GAL(&sSetVideo);
2943 sSetVideo.dwSubfunction = GALFN_SETALPHAREGION;
2944 sSetVideo.region = region;
2945 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2946 return 0;
2947 else
2948 return 1;
2949 }
2950
2951 /*--------------------------------------------------------------------------
2952 * Gal_set_video_outside_alpha
2953 *
2954 * Description: This function enable/disable the video outside alpha region.
2955 * parameters:
2956 * enable: Gives the value for enable/disable.
2957 * return: '1' was returned on success otherwise '0' was returned.
2958 *------------------------------------------------------------------------*/
2959 BOOLEAN
Gal_set_video_outside_alpha(int enable)2960 Gal_set_video_outside_alpha(int enable)
2961 {
2962 GAL_VIDEOOUTSIDEALPHA sSetVideo;
2963
2964 INIT_GAL(&sSetVideo);
2965 sSetVideo.dwSubfunction = GALFN_SETVIDEOOUTSIDEALPHA;
2966 sSetVideo.enable = enable;
2967 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2968 return 0;
2969 else
2970 return 1;
2971 }
2972
2973 /*--------------------------------------------------------------------------
2974 * Gal_set_video_palette
2975 *
2976 * Description: This function loads the video hardware palette.
2977 * parameters:
2978 * palette: Gives value for hardware palette.
2979 * return: '1' was returned on success otherwise '0' was returned.
2980 *------------------------------------------------------------------------*/
2981 BOOLEAN
Gal_set_video_palette(unsigned long * palette)2982 Gal_set_video_palette(unsigned long *palette)
2983 {
2984 GAL_VIDEOPALETTE sSetVideo;
2985
2986 INIT_GAL(&sSetVideo);
2987 sSetVideo.dwSubfunction = GALFN_SETVIDEOPALETTE;
2988
2989 if (palette == NULL) {
2990 sSetVideo.identity = 1;
2991 } else {
2992 sSetVideo.identity = 0;
2993 direct_memcpy(sSetVideo.palette, palette, 256 * sizeof(*palette));
2994 }
2995
2996 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideo))
2997 return 0;
2998 else
2999 return 1;
3000 }
3001
3002 /** Video **********************************************************/
3003
3004 /*--------------------------------------------------------------------------
3005 * Gal_set_icon_enable
3006 *
3007 * Description: This function enable/disables the hardware icon. The icon
3008 * position and colors should be programmed prior to calling
3009 * this routine.
3010 * parameters:
3011 * enable: Gives value for enable state.
3012 * return: '1' was returned on success otherwise '0' was returned.
3013 *------------------------------------------------------------------------*/
3014 BOOLEAN
Gal_set_icon_enable(int enable)3015 Gal_set_icon_enable(int enable)
3016 {
3017 GAL_ICONENABLE sSetIconenable;
3018
3019 INIT_GAL(&sSetIconenable);
3020 sSetIconenable.dwSubfunction = GALFN_SETICONENABLE;
3021 sSetIconenable.enable = enable;
3022 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetIconenable)) {
3023 return 0;
3024 } else {
3025 return 1;
3026 }
3027 }
3028
3029 /*--------------------------------------------------------------------------
3030 * Gal_set_icon_colors
3031 *
3032 * Description: This function sets the three hardware icon colors.
3033 * parameters:
3034 * color0: Gives first color value.
3035 * color1: Gives second color value.
3036 * color2: Gives third color value.
3037 * return: '1' was returned on success otherwise '0' was returned.
3038 *------------------------------------------------------------------------*/
3039 BOOLEAN
Gal_set_icon_colors(unsigned long color0,unsigned long color1,unsigned long color2)3040 Gal_set_icon_colors(unsigned long color0, unsigned long color1,
3041 unsigned long color2)
3042 {
3043 GAL_ICONCOLORS sSetIconcolors;
3044
3045 INIT_GAL(&sSetIconcolors);
3046 sSetIconcolors.dwSubfunction = GALFN_SETICONCOLORS;
3047 sSetIconcolors.color0 = color0;
3048 sSetIconcolors.color1 = color1;
3049 sSetIconcolors.color2 = color2;
3050 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetIconcolors)) {
3051 return 0;
3052 } else {
3053 return 1;
3054 }
3055 }
3056
3057 /*--------------------------------------------------------------------------
3058 * Gal_set_icon_position.
3059 *
3060 * Description: This function sets the hardware icon position.
3061 * parameters:
3062 * memoffset: Memory offset of the icon buffer.
3063 * xpos: Starting X co-ordinate for the hardware icon.
3064 * return: '1' was returned on success otherwise '0' was returned.
3065 *------------------------------------------------------------------------*/
3066 BOOLEAN
Gal_set_icon_position(unsigned long memoffset,unsigned short xpos)3067 Gal_set_icon_position(unsigned long memoffset, unsigned short xpos)
3068 {
3069 GAL_ICONPOSITION sSetIconposi;
3070
3071 INIT_GAL(&sSetIconposi);
3072 sSetIconposi.dwSubfunction = GALFN_SETICONPOSITION;
3073 sSetIconposi.memoffset = memoffset;
3074 sSetIconposi.xpos = xpos;
3075 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetIconposi)) {
3076 return 0;
3077 } else {
3078 return 1;
3079 }
3080 }
3081
3082 /*--------------------------------------------------------------------------
3083 * Gal_set_icon_shape64.
3084 *
3085 * Description: This function initializes the icon buffer according to
3086 * the current mode.
3087 * parameters:
3088 * memoffset: Memory offset of the icon buffer.
3089 * andmask: Andmask of the icon buffer.
3090 * xormask: Xormask of the icon buffer.
3091 * lines: Lines of the icon buffer.
3092 * return: '1' was returned on success otherwise '0' was returned.
3093 *------------------------------------------------------------------------*/
3094 BOOLEAN
Gal_set_icon_shape64(unsigned long memoffset,unsigned long * andmask,unsigned long * xormask,unsigned int lines)3095 Gal_set_icon_shape64(unsigned long memoffset, unsigned long *andmask,
3096 unsigned long *xormask, unsigned int lines)
3097 {
3098 GAL_ICONSHAPE64 sSetIconshape64;
3099
3100 INIT_GAL(&sSetIconshape64);
3101 sSetIconshape64.dwSubfunction = GALFN_SETICONSHAPE64;
3102 sSetIconshape64.memoffset = memoffset;
3103 *(sSetIconshape64.andmask) = *andmask;
3104 *(sSetIconshape64.xormask) = *xormask;
3105 sSetIconshape64.lines = lines;
3106
3107 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetIconshape64)) {
3108 return 0;
3109 } else {
3110 return 1;
3111 }
3112 }
3113
3114 /* VIP Functions */
3115
3116 /*--------------------------------------------------------------------------
3117 * Gal_set_vip_enable
3118 *
3119 * Description: This function enable/disables the writes to memory from the
3120 * video port.
3121 * position and colors should be programmed prior to calling
3122 * this routine.
3123 * parameters:
3124 * enable: Gives value for enable state.
3125 * return: '1' was returned on success otherwise '0' was returned.
3126 *------------------------------------------------------------------------*/
3127 BOOLEAN
Gal_set_vip_enable(int enable)3128 Gal_set_vip_enable(int enable)
3129 {
3130 GAL_VIPENABLE sSetVipenable;
3131
3132 INIT_GAL(&sSetVipenable);
3133 sSetVipenable.dwSubfunction = GALFN_SETVIPENABLE;
3134 sSetVipenable.enable = enable;
3135 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipenable)) {
3136 return 0;
3137 } else {
3138 return 1;
3139 }
3140 }
3141
3142 /*--------------------------------------------------------------------------
3143 * Gal_get_vip_enable
3144 *
3145 * Description: This function gets the enable state of the
3146 * video port.
3147 * parameters:
3148 * enable: Gives value for enable state.
3149 * return: '1' was returned on success otherwise '0' was returned.
3150 *------------------------------------------------------------------------*/
3151 BOOLEAN
Gal_get_vip_enable(int * enable)3152 Gal_get_vip_enable(int *enable)
3153 {
3154 GAL_VIPENABLE sGetVipenable;
3155
3156 INIT_GAL(&sGetVipenable);
3157 sGetVipenable.dwSubfunction = GALFN_GETVIPENABLE;
3158 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipenable)) {
3159 return 0;
3160 } else {
3161
3162 *enable = sGetVipenable.enable;
3163 return 1;
3164 }
3165 }
3166
3167 /*--------------------------------------------------------------------------
3168 * Gal_set_vip_capture_run_mode
3169 *
3170 * Description: This function selects the VIP capture run mode.
3171 *
3172 * parameters:
3173 * mode: VIP capture run mode.
3174 * return: '1' was returned on success otherwise '0' was returned.
3175 *------------------------------------------------------------------------*/
3176 BOOLEAN
Gal_set_vip_capture_run_mode(int mode)3177 Gal_set_vip_capture_run_mode(int mode)
3178 {
3179 GAL_VIPCAPTURERUNMODE sSetVipcapturerunmode;
3180
3181 INIT_GAL(&sSetVipcapturerunmode);
3182 sSetVipcapturerunmode.dwSubfunction = GALFN_SETVIPCAPTURERUNMODE;
3183 sSetVipcapturerunmode.mode = mode;
3184
3185 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipcapturerunmode)) {
3186 return 0;
3187 } else {
3188 return 1;
3189 }
3190 }
3191
3192 /*--------------------------------------------------------------------------
3193 * Gal_set_vip_base
3194 *
3195 * Description: This routine sets the odd and even base address values for
3196 * the VIP memory buffer.
3197 * parameters:
3198 * even: Even base address.
3199 * odd: odd base address.
3200 * return: '1' was returned on success otherwise '0' was returned.
3201 *------------------------------------------------------------------------*/
3202 BOOLEAN
Gal_set_vip_base(unsigned long even,unsigned long odd)3203 Gal_set_vip_base(unsigned long even, unsigned long odd)
3204 {
3205 GAL_VIPBASE sSetVipBase;
3206
3207 INIT_GAL(&sSetVipBase);
3208 sSetVipBase.dwSubfunction = GALFN_SETVIPBASE;
3209 sSetVipBase.even = even;
3210 sSetVipBase.odd = odd;
3211
3212 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipBase)) {
3213 return 0;
3214 } else {
3215 return 1;
3216 }
3217 }
3218
3219 /*--------------------------------------------------------------------------
3220 * Gal_get_vip_base
3221 *
3222 * Description: This routine gets the base address value for
3223 * the VIP memory buffer.
3224 * parameters:
3225 * address: VIP base address.
3226 * odd: odd base address.
3227 * return: '1' was returned on success otherwise '0' was returned.
3228 *------------------------------------------------------------------------*/
3229 BOOLEAN
Gal_get_vip_base(unsigned long * address,int odd)3230 Gal_get_vip_base(unsigned long *address, int odd)
3231 {
3232 GAL_VIPBASE sGetVipBase;
3233
3234 INIT_GAL(&sGetVipBase);
3235 sGetVipBase.dwSubfunction = GALFN_GETVIPBASE;
3236 sGetVipBase.odd = odd;
3237
3238 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipBase)) {
3239 return 0;
3240 } else {
3241 *address = sGetVipBase.address;
3242 return 1;
3243 }
3244 }
3245
3246 /*--------------------------------------------------------------------------
3247 * Gal_set_vip_pitch
3248 *
3249 * Description: This routine sets the number of bytes between scanlines
3250 * for the VIP data.
3251 * parameters:
3252 * pitch: VIP pitch.
3253 * return: '1' was returned on success otherwise '0' was returned.
3254 *------------------------------------------------------------------------*/
3255 BOOLEAN
Gal_set_vip_pitch(unsigned long pitch)3256 Gal_set_vip_pitch(unsigned long pitch)
3257 {
3258 GAL_VIPPITCH sSetVipPitch;
3259
3260 INIT_GAL(&sSetVipPitch);
3261 sSetVipPitch.dwSubfunction = GALFN_SETVIPPITCH;
3262 sSetVipPitch.pitch = pitch;
3263
3264 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipPitch)) {
3265 return 0;
3266 } else {
3267 return 1;
3268 }
3269 }
3270
3271 /*--------------------------------------------------------------------------
3272 * Gal_get_vip_pitch
3273 *
3274 * Description: This routine gets the number of bytes between scanlines
3275 * for the VIP data.
3276 * parameters:
3277 * pitch: VIP pitch.
3278 * return: '1' was returned on success otherwise '0' was returned.
3279 *------------------------------------------------------------------------*/
3280 BOOLEAN
Gal_get_vip_pitch(unsigned long * pitch)3281 Gal_get_vip_pitch(unsigned long *pitch)
3282 {
3283 GAL_VIPPITCH sGetVipPitch;
3284
3285 INIT_GAL(&sGetVipPitch);
3286 sGetVipPitch.dwSubfunction = GALFN_GETVIPPITCH;
3287
3288 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipPitch)) {
3289 return 0;
3290 } else {
3291 *pitch = sGetVipPitch.pitch;
3292 return 1;
3293
3294 }
3295 }
3296
3297 /*--------------------------------------------------------------------------
3298 * Gal_set_vip_mode
3299 *
3300 * Description: This routine sets the VIP operating mode.
3301 * parameters:
3302 * mode: VIP operating mode.
3303 * return: '1' was returned on success otherwise '0' was returned.
3304 *------------------------------------------------------------------------*/
3305 BOOLEAN
Gal_set_vip_mode(int mode)3306 Gal_set_vip_mode(int mode)
3307 {
3308 GAL_VIPMODE sSetVipMode;
3309
3310 INIT_GAL(&sSetVipMode);
3311 sSetVipMode.dwSubfunction = GALFN_SETVIPMODE;
3312 sSetVipMode.mode = mode;
3313
3314 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipMode)) {
3315 return 0;
3316 } else {
3317 return 1;
3318 }
3319 }
3320
3321 /*--------------------------------------------------------------------------
3322 * Gal_get_vip_mode
3323 *
3324 * Description: This routine gets the VIP operating mode.
3325 * parameters:
3326 * mode: VIP operating mode.
3327 * return: '1' was returned on success otherwise '0' was returned.
3328 *------------------------------------------------------------------------*/
3329 BOOLEAN
Gal_get_vip_mode(int * mode)3330 Gal_get_vip_mode(int *mode)
3331 {
3332 GAL_VIPMODE sGetVipMode;
3333
3334 INIT_GAL(&sGetVipMode);
3335 sGetVipMode.dwSubfunction = GALFN_GETVIPMODE;
3336
3337 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipMode)) {
3338 return 0;
3339 } else {
3340
3341 *mode = sGetVipMode.mode;
3342 return 1;
3343 }
3344 }
3345
3346 /*--------------------------------------------------------------------------
3347 * Gal_set_vip_bus_request_threshold_high
3348 *
3349 * Description: This function sets the VIP FIFO bus request threshold.
3350 *
3351 * parameters:
3352 * enable: Enable state.
3353 * return: '1' was returned on success otherwise '0' was returned.
3354 *------------------------------------------------------------------------*/
3355 BOOLEAN
Gal_set_vip_bus_request_threshold_high(int enable)3356 Gal_set_vip_bus_request_threshold_high(int enable)
3357 {
3358 GAL_VIPBUS_RTH sSetVipBRTH;
3359
3360 INIT_GAL(&sSetVipBRTH);
3361 sSetVipBRTH.dwSubfunction = GALFN_SETVIPBRTH;
3362 sSetVipBRTH.enable = enable;
3363
3364 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVipBRTH)) {
3365 return 0;
3366 } else {
3367 return 1;
3368 }
3369 }
3370
3371 /*--------------------------------------------------------------------------
3372 * Gal_get_vip_bus_request_threshold_high
3373 *
3374 * Description: This function gets the VIP FIFO bus request threshold.
3375 *
3376 * parameters:
3377 * enable: Enable state.
3378 * return: '1' was returned on success otherwise '0' was returned.
3379 *------------------------------------------------------------------------*/
3380 BOOLEAN
Gal_get_vip_bus_request_threshold_high(int * enable)3381 Gal_get_vip_bus_request_threshold_high(int *enable)
3382 {
3383 GAL_VIPBUS_RTH sGetVipBRTH;
3384
3385 INIT_GAL(&sGetVipBRTH);
3386 sGetVipBRTH.dwSubfunction = GALFN_GETVIPBRTH;
3387
3388 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipBRTH)) {
3389 return 0;
3390 } else {
3391
3392 *enable = sGetVipBRTH.enable;
3393 return 1;
3394 }
3395 }
3396
3397 /*--------------------------------------------------------------------------
3398 * Gal_set_vip_last_line
3399 *
3400 * Description: This function sets the maximum number of lines captured
3401 * in each field.
3402 *
3403 * parameters:
3404 * last_line: Maximum number of lines captured in each field.
3405 * return: '1' was returned on success otherwise '0' was returned.
3406 *------------------------------------------------------------------------*/
3407 BOOLEAN
Gal_set_vip_last_line(int last_line)3408 Gal_set_vip_last_line(int last_line)
3409 {
3410 GAL_VIPLASTLINE sSetViplastline;
3411
3412 INIT_GAL(&sSetViplastline);
3413 sSetViplastline.dwSubfunction = GALFN_SETVIPLASTLINE;
3414 sSetViplastline.last_line = last_line;
3415
3416 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetViplastline)) {
3417 return 0;
3418 } else {
3419 return 1;
3420 }
3421 }
3422
3423 /*--------------------------------------------------------------------------
3424 * Gal_get_vip_line
3425 *
3426 * Description: This function gets the number of the current video line being
3427 * recieved by the VIP interface.
3428 *
3429 * parameters:
3430 * vip_line: Number of the current video line.
3431 * return: '1' was returned on success otherwise '0' was returned.
3432 *------------------------------------------------------------------------*/
3433 BOOLEAN
Gal_get_vip_line(int * vip_line)3434 Gal_get_vip_line(int *vip_line)
3435 {
3436 GAL_VIPLINE sGetVipline;
3437
3438 INIT_GAL(&sGetVipline);
3439 sGetVipline.dwSubfunction = GALFN_GETVIPLINE;
3440
3441 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVipline)) {
3442 return 0;
3443 } else {
3444 *vip_line = sGetVipline.status;
3445 return 1;
3446 }
3447 }
3448
3449 /*--------------------------------------------------------------------------
3450 * Gal_test_vip_odd_field
3451 *
3452 * Description: This function tests the VIP odd field.
3453 *
3454 * parameters:
3455 * status: Status of the odd field.
3456 * return: '1' was returned on success otherwise '0' was returned.
3457 *------------------------------------------------------------------------*/
3458 BOOLEAN
Gal_test_vip_odd_field(int * status)3459 Gal_test_vip_odd_field(int *status)
3460 {
3461 GAL_TESTVIPODDFIELD sTestVipoddfield;
3462
3463 INIT_GAL(&sTestVipoddfield);
3464 sTestVipoddfield.dwSubfunction = GALFN_TESTVIPODDFIELD;
3465
3466 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sTestVipoddfield)) {
3467 return 0;
3468 } else {
3469 *status = sTestVipoddfield.status;
3470 return 1;
3471 }
3472 }
3473
3474 /*--------------------------------------------------------------------------
3475 * Gal_test_vip_bases_updated
3476 *
3477 * Description: This function tests the VIP bases updated.
3478 *
3479 * parameters:
3480 * status: Status of the VIP bases updated.
3481 * return: '1' was returned on success otherwise '0' was returned.
3482 *------------------------------------------------------------------------*/
3483 BOOLEAN
Gal_test_vip_bases_updated(int * status)3484 Gal_test_vip_bases_updated(int *status)
3485 {
3486 GAL_TESTVIPBASESUPDATED sTestVipbasesupdated;
3487
3488 INIT_GAL(&sTestVipbasesupdated);
3489 sTestVipbasesupdated.dwSubfunction = GALFN_TESTVIPBASESUPDATED;
3490
3491 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sTestVipbasesupdated)) {
3492 return 0;
3493 } else {
3494 *status = sTestVipbasesupdated.status;
3495 return 1;
3496 }
3497 }
3498
3499 /*--------------------------------------------------------------------------
3500 * Gal_test_vip_fifo_overflow
3501 *
3502 * Description: This function tests the VIP FIFO overflow.
3503 *
3504 * parameters:
3505 * status: Status of the VIP FIFO overflow.
3506 * return: '1' was returned on success otherwise '0' was returned.
3507 *------------------------------------------------------------------------*/
3508 BOOLEAN
Gal_test_vip_fifo_overflow(int * status)3509 Gal_test_vip_fifo_overflow(int *status)
3510 {
3511 GAL_TESTVIPOVERFLOW sTestVipoverflow;
3512
3513 INIT_GAL(&sTestVipoverflow);
3514 sTestVipoverflow.dwSubfunction = GALFN_TESTVIPFIFOOVERFLOW;
3515
3516 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sTestVipoverflow)) {
3517 return 0;
3518 } else {
3519 *status = sTestVipoverflow.status;
3520 return 1;
3521 }
3522 }
3523
3524 /*--------------------------------------------------------------------------
3525 * Gal_set_vbi_enable
3526 *
3527 * Description: This function enable/disables the VBI data capture.
3528 *
3529 * parameters:
3530 * enable: VBI enable state.
3531 * return: '1' was returned on success otherwise '0' was returned.
3532 *------------------------------------------------------------------------*/
3533 BOOLEAN
Gal_set_vbi_enable(int enable)3534 Gal_set_vbi_enable(int enable)
3535 {
3536 GAL_VBIENABLE sSetVbienable;
3537
3538 INIT_GAL(&sSetVbienable);
3539 sSetVbienable.dwSubfunction = GALFN_SETVBIENABLE;
3540 sSetVbienable.enable = enable;
3541 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbienable)) {
3542 return 0;
3543 } else {
3544 return 1;
3545 }
3546 }
3547
3548 /*--------------------------------------------------------------------------
3549 * Gal_get_vbi_enable
3550 *
3551 * Description: This function gets the enable state of the VBI data capture.
3552 *
3553 * parameters:
3554 * enable: VBI enable state.
3555 * return: '1' was returned on success otherwise '0' was returned.
3556 *------------------------------------------------------------------------*/
3557 BOOLEAN
Gal_get_vbi_enable(int * enable)3558 Gal_get_vbi_enable(int *enable)
3559 {
3560 GAL_VBIENABLE sGetVbienable;
3561
3562 INIT_GAL(&sGetVbienable);
3563 sGetVbienable.dwSubfunction = GALFN_GETVBIENABLE;
3564 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbienable)) {
3565 return 0;
3566 } else {
3567
3568 *enable = sGetVbienable.enable;
3569 return 1;
3570 }
3571 }
3572
3573 /*--------------------------------------------------------------------------
3574 * Gal_set_vbi_base
3575 *
3576 * Description: This function sets the VBI base addresses.
3577 *
3578 * parameters:
3579 * even: Even base address.
3580 * odd: Odd base address.
3581 * return: '1' was returned on success otherwise '0' was returned.
3582 *------------------------------------------------------------------------*/
3583 BOOLEAN
Gal_set_vbi_base(unsigned long even,unsigned long odd)3584 Gal_set_vbi_base(unsigned long even, unsigned long odd)
3585 {
3586 GAL_VBIBASE sSetVbiBase;
3587
3588 INIT_GAL(&sSetVbiBase);
3589 sSetVbiBase.dwSubfunction = GALFN_SETVBIBASE;
3590 sSetVbiBase.even = even;
3591 sSetVbiBase.odd = odd;
3592
3593 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbiBase)) {
3594 return 0;
3595 } else {
3596 return 1;
3597 }
3598 }
3599
3600 /*--------------------------------------------------------------------------
3601 * Gal_get_vbi_base
3602 *
3603 * Description: This function gets the VBI base address.
3604 *
3605 * parameters:
3606 * address: VBI base address.
3607 * odd: Odd base address.
3608 * return: '1' was returned on success otherwise '0' was returned.
3609 *------------------------------------------------------------------------*/
3610 BOOLEAN
Gal_get_vbi_base(unsigned long * address,int odd)3611 Gal_get_vbi_base(unsigned long *address, int odd)
3612 {
3613 GAL_VBIBASE sGetVbiBase;
3614
3615 INIT_GAL(&sGetVbiBase);
3616 sGetVbiBase.dwSubfunction = GALFN_GETVBIBASE;
3617 sGetVbiBase.odd = odd;
3618
3619 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbiBase)) {
3620 return 0;
3621 } else {
3622 *address = sGetVbiBase.address;
3623 return 1;
3624 }
3625 }
3626
3627 /*--------------------------------------------------------------------------
3628 * Gal_set_vbi_pitch
3629 *
3630 * Description: This function sets the number of bytes between scanlines for
3631 * VBI capture.
3632 *
3633 * parameters:
3634 * pitch: VBI pitch.
3635 * return: '1' was returned on success otherwise '0' was returned.
3636 *------------------------------------------------------------------------*/
3637 BOOLEAN
Gal_set_vbi_pitch(unsigned long pitch)3638 Gal_set_vbi_pitch(unsigned long pitch)
3639 {
3640 GAL_VBIPITCH sSetVbiPitch;
3641
3642 INIT_GAL(&sSetVbiPitch);
3643 sSetVbiPitch.dwSubfunction = GALFN_SETVBIPITCH;
3644 sSetVbiPitch.pitch = pitch;
3645
3646 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbiPitch)) {
3647 return 0;
3648 } else {
3649 return 1;
3650 }
3651 }
3652
3653 /*--------------------------------------------------------------------------
3654 * Gal_get_vbi_pitch
3655 *
3656 * Description: This function gets the number of bytes between scanlines for
3657 * VBI capture.
3658 *
3659 * parameters:
3660 * pitch: VBI pitch.
3661 * return: '1' was returned on success otherwise '0' was returned.
3662 *------------------------------------------------------------------------*/
3663 BOOLEAN
Gal_get_vbi_pitch(unsigned long * pitch)3664 Gal_get_vbi_pitch(unsigned long *pitch)
3665 {
3666 GAL_VBIPITCH sGetVbiPitch;
3667
3668 INIT_GAL(&sGetVbiPitch);
3669 sGetVbiPitch.dwSubfunction = GALFN_GETVBIPITCH;
3670
3671 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbiPitch)) {
3672 return 0;
3673 } else {
3674 *pitch = sGetVbiPitch.pitch;
3675 return 1;
3676
3677 }
3678 }
3679
3680 /*--------------------------------------------------------------------------
3681 * Gal_set_vbi_mode
3682 *
3683 * Description: This function sets the VBI data types captured to memory.
3684 *
3685 * parameters:
3686 * mode: VBI mode.
3687 * return: '1' was returned on success otherwise '0' was returned.
3688 *------------------------------------------------------------------------*/
3689 BOOLEAN
Gal_set_vbi_mode(int mode)3690 Gal_set_vbi_mode(int mode)
3691 {
3692 GAL_VBIMODE sSetVbiMode;
3693
3694 INIT_GAL(&sSetVbiMode);
3695 sSetVbiMode.dwSubfunction = GALFN_SETVBIMODE;
3696 sSetVbiMode.mode = mode;
3697
3698 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbiMode)) {
3699 return 0;
3700 } else {
3701 return 1;
3702 }
3703 }
3704
3705 /*--------------------------------------------------------------------------
3706 * Gal_get_vbi_mode
3707 *
3708 * Description: This function gets the VBI data types captured to memory.
3709 *
3710 * parameters:
3711 * mode: VBI mode.
3712 * return: '1' was returned on success otherwise '0' was returned.
3713 *------------------------------------------------------------------------*/
3714 BOOLEAN
Gal_get_vbi_mode(int * mode)3715 Gal_get_vbi_mode(int *mode)
3716 {
3717 GAL_VBIMODE sGetVbiMode;
3718
3719 INIT_GAL(&sGetVbiMode);
3720 sGetVbiMode.dwSubfunction = GALFN_GETVBIMODE;
3721
3722 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbiMode)) {
3723 return 0;
3724 } else {
3725
3726 *mode = sGetVbiMode.mode;
3727 return 1;
3728 }
3729 }
3730
3731 /*--------------------------------------------------------------------------
3732 * Gal_set_vbi_direct
3733 *
3734 * Description: This function sets the VBI lines to be passed to the
3735 * Direct VIP.
3736 *
3737 * parameters:
3738 * even_lines: VBI even lines.
3739 * odd_lines: VBI odd lines.
3740 * return: '1' was returned on success otherwise '0' was returned.
3741 *------------------------------------------------------------------------*/
3742 BOOLEAN
Gal_set_vbi_direct(unsigned long even_lines,unsigned long odd_lines)3743 Gal_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines)
3744 {
3745 GAL_SETVBIDIRECT sSetVbidirect;
3746
3747 INIT_GAL(&sSetVbidirect);
3748 sSetVbidirect.dwSubfunction = GALFN_SETVBIDIRECT;
3749 sSetVbidirect.even_lines = even_lines;
3750 sSetVbidirect.odd_lines = odd_lines;
3751
3752 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbidirect)) {
3753 return 0;
3754 } else {
3755 return 1;
3756 }
3757 }
3758 BOOLEAN
Gal2_set_destination_stride(unsigned short stride)3759 Gal2_set_destination_stride(unsigned short stride)
3760 {
3761 GAL_STRIDE sSetStride;
3762
3763 INIT_GAL(&sSetStride);
3764 sSetStride.dwSubfunction = GALFN_SETDESTINATIONSTRIDE;
3765
3766 sSetStride.stride = stride;
3767 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetStride))
3768 return 0;
3769 else
3770 return 1;
3771 }
3772
3773 BOOLEAN
Gal2_set_pattern_origin(int x,int y)3774 Gal2_set_pattern_origin(int x, int y)
3775 {
3776 GAL_PATTERNORIGIN sSetPatOrigin;
3777
3778 INIT_GAL(&sSetPatOrigin);
3779 sSetPatOrigin.dwSubfunction = GALFN_SETPATTERNORIGIN;
3780
3781 sSetPatOrigin.x = x;
3782 sSetPatOrigin.y = y;
3783 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetPatOrigin))
3784 return 0;
3785 else
3786 return 1;
3787 }
3788
3789 /*--------------------------------------------------------------------------
3790 * Gal_set_vbi_direct
3791 *
3792 * Description: This function gets the VBI lines to be passed to the
3793 * Direct VIP.
3794 *
3795 * parameters:
3796 * odd: VBI odd lines.
3797 * direct_lines: VBI direct lines.
3798 * return: '1' was returned on success otherwise '0' was returned.
3799 *------------------------------------------------------------------------*/
3800 BOOLEAN
Gal_get_vbi_direct(int odd,unsigned long * direct_lines)3801 Gal_get_vbi_direct(int odd, unsigned long *direct_lines)
3802 {
3803 GAL_GETVBIDIRECT sGetVbidirect;
3804
3805 INIT_GAL(&sGetVbidirect);
3806 sGetVbidirect.dwSubfunction = GALFN_GETVBIDIRECT;
3807 sGetVbidirect.odd = odd;
3808
3809 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbidirect)) {
3810 return 0;
3811 } else {
3812 *direct_lines = sGetVbidirect.direct_lines;
3813 return 1;
3814 }
3815 }
3816
3817 /*--------------------------------------------------------------------------
3818 * Gal_set_vbi_interrupt
3819 *
3820 * Description: This function enable/disables the VBI field interrupt.
3821 *
3822 * parameters:
3823 * enable: Value to enable/disable VBI interrupt.
3824 * return: '1' was returned on success otherwise '0' was returned.
3825 *------------------------------------------------------------------------*/
3826 BOOLEAN
Gal_set_vbi_interrupt(int enable)3827 Gal_set_vbi_interrupt(int enable)
3828 {
3829 GAL_VBIINTERRUPT sSetVbiinterrupt;
3830
3831 INIT_GAL(&sSetVbiinterrupt);
3832 sSetVbiinterrupt.dwSubfunction = GALFN_SETVBIINTERRUPT;
3833 sSetVbiinterrupt.enable = enable;
3834 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbiinterrupt)) {
3835 return 0;
3836 } else {
3837 return 1;
3838 }
3839 }
3840
3841 /*--------------------------------------------------------------------------
3842 * Gal_get_vbi_interrupt
3843 *
3844 * Description: This function gets the VBI field interrupt.
3845 *
3846 * parameters:
3847 * enable: Value of enable/disable VBI interrupt.
3848 * return: '1' was returned on success otherwise '0' was returned.
3849 *------------------------------------------------------------------------*/
3850 BOOLEAN
Gal_get_vbi_interrupt(int * enable)3851 Gal_get_vbi_interrupt(int *enable)
3852 {
3853 GAL_VBIINTERRUPT sGetVbiinterrupt;
3854
3855 INIT_GAL(&sGetVbiinterrupt);
3856 sGetVbiinterrupt.dwSubfunction = GALFN_GETVBIINTERRUPT;
3857
3858 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbiinterrupt)) {
3859 return 0;
3860 } else {
3861 *enable = sGetVbiinterrupt.enable;
3862 return 1;
3863 }
3864 }
3865
3866 /*--------------------------------------------------------------------------
3867 * Gal_set_source_stride
3868 *
3869 * Description: This function sets the stride to be used in successive screen
3870 * to screen BLTs.
3871 *
3872 * parameters:
3873 * enable: Value of enable/disable VBI interrupt.
3874 * return: '1' was returned on success otherwise '0' was returned.
3875 *------------------------------------------------------------------------*/
3876 BOOLEAN
Gal2_set_source_stride(unsigned short stride)3877 Gal2_set_source_stride(unsigned short stride)
3878 {
3879 GAL_STRIDE sSetsourcestride;
3880
3881 INIT_GAL(&sSetsourcestride);
3882 sSetsourcestride.dwSubfunction = GALFN_SETSOURCESTRIDE;
3883
3884 sSetsourcestride.stride = stride;
3885 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetsourcestride)) {
3886 return 0;
3887 } else {
3888
3889 return 1;
3890 }
3891 }
3892
3893 /*--------------------------------------------------------------------------
3894 * Gal_set_source_transparency
3895 *
3896 * Description: This function sets the source transparency color and
3897 * mask to be used in future rendering routines.
3898 * to screen BLTs.
3899 *
3900 * parameters:
3901 * color: Source color.
3902 * mask: Source mask.
3903 * return: '1' was returned on success otherwise '0' was returned.
3904 *------------------------------------------------------------------------*/
3905 BOOLEAN
Gal2_set_source_transparency(unsigned long color,unsigned long mask)3906 Gal2_set_source_transparency(unsigned long color, unsigned long mask)
3907 {
3908 GAL_SOURCETRANSPARENCY sSetsourcetransparency;
3909
3910 INIT_GAL(&sSetsourcetransparency);
3911 sSetsourcetransparency.dwSubfunction = GALFN_SETSOURCETRANSPARENCY;
3912
3913 sSetsourcetransparency.color = color;
3914 sSetsourcetransparency.mask = mask;
3915 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetsourcetransparency)) {
3916 return 0;
3917 } else {
3918
3919 return 1;
3920 }
3921 }
3922
3923 /*--------------------------------------------------------------------------
3924 * Gal_set_alpha_mode
3925 *
3926 * Description: This function sets the alpha blending mode.
3927 * parameters:
3928 * mode: Alpha blending mode.
3929 * return: '1' was returned on success otherwise '0' was returned.
3930 *------------------------------------------------------------------------*/
3931 BOOLEAN
Gal2_set_alpha_mode(int mode)3932 Gal2_set_alpha_mode(int mode)
3933 {
3934 GAL_GFX2ALPHAMODE sSetalphamode;
3935
3936 INIT_GAL(&sSetalphamode);
3937 sSetalphamode.dwSubfunction = GALFN_GFX2SETALPHAMODE;
3938
3939 sSetalphamode.mode = mode;
3940 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetalphamode)) {
3941 return 0;
3942 } else {
3943 return 1;
3944 }
3945 }
3946
3947 /*--------------------------------------------------------------------------
3948 * Gal_gfx2_set_alpha_value
3949 *
3950 * Description: This function sets the alpha value to be used with certain
3951 * alpha blending modes.
3952 * parameters:
3953 * value: Alpha blending value.
3954 * return: '1' was returned on success otherwise '0' was returned.
3955 *------------------------------------------------------------------------*/
3956 BOOLEAN
Gal2_set_alpha_value(unsigned char value)3957 Gal2_set_alpha_value(unsigned char value)
3958 {
3959 GAL_GFX2ALPHAVALUE sSetalphavalue;
3960
3961 INIT_GAL(&sSetalphavalue);
3962 sSetalphavalue.dwSubfunction = GALFN_GFX2SETALPHAVALUE;
3963
3964 sSetalphavalue.value = value;
3965 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetalphavalue)) {
3966 return 0;
3967 } else {
3968 return 1;
3969 }
3970 }
3971
3972 /*--------------------------------------------------------------------------
3973 * Gal2_pattern_fill
3974 *
3975 * Description: This function used to fill the pattern of GX2.
3976 * It allows the arbitary destination stride. The rendering
3977 * position is also specified as an offset instead of (x,y)
3978 * position.
3979 * parameters:
3980 * dstoffset: Rendering offset.
3981 * width: Width of the pattern.
3982 * height: Height of the pattern.
3983 * return: '1' was returned on success otherwise '0' was returned.
3984 *------------------------------------------------------------------------*/
3985 BOOLEAN
Gal2_pattern_fill(unsigned long dstoffset,unsigned short width,unsigned short height)3986 Gal2_pattern_fill(unsigned long dstoffset, unsigned short width,
3987 unsigned short height)
3988 {
3989 GAL_GFX2PATTERNFILL sPatternfill;
3990
3991 INIT_GAL(&sPatternfill);
3992 sPatternfill.dwSubfunction = GALFN_GFX2PATTERNFILL;
3993
3994 sPatternfill.dstoffset = dstoffset;
3995 sPatternfill.width = width;
3996 sPatternfill.height = height;
3997 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sPatternfill)) {
3998 return 0;
3999 } else {
4000 return 1;
4001 }
4002 }
4003
4004 /*--------------------------------------------------------------------------
4005 * Gal_gfx2_screen_to_screen_blt
4006 *
4007 * Description: This function used for screen to screen BLTs of GX2.
4008 * It allows the arbitary source and destination strides and
4009 * alpha blending.
4010 * parameters:
4011 * srcoffset: Source Rendering offset.
4012 * dstoffset: Destination Rendering offset.
4013 * width: Width of the screen.
4014 * height: Height of the screen.
4015 * flags: Flags of the screen to screen BLT.
4016 * return: '1' was returned on success otherwise '0' was returned.
4017 *------------------------------------------------------------------------*/
4018 BOOLEAN
Gal2_screen_to_screen_blt(unsigned long srcoffset,unsigned long dstoffset,unsigned short width,unsigned short height,int flags)4019 Gal2_screen_to_screen_blt(unsigned long srcoffset,
4020 unsigned long dstoffset, unsigned short width,
4021 unsigned short height, int flags)
4022 {
4023 GAL_GFX2SCREENTOSCREENBLT sScreentoScreenblt;
4024
4025 INIT_GAL(&sScreentoScreenblt);
4026 sScreentoScreenblt.dwSubfunction = GALFN_GFX2SCREENTOSCREENBLT;
4027
4028 sScreentoScreenblt.srcoffset = srcoffset;
4029 sScreentoScreenblt.dstoffset = dstoffset;
4030 sScreentoScreenblt.width = width;
4031 sScreentoScreenblt.height = height;
4032 sScreentoScreenblt.flags = flags;
4033 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sScreentoScreenblt)) {
4034 return 0;
4035 } else {
4036 return 1;
4037 }
4038 }
4039
4040 /*--------------------------------------------------------------------------
4041 * Gal2_mono_expand_blt
4042 *
4043 * Description: This function used to expand monochrome data stored in
4044 * graphics memory for screen to screen BLTs.
4045 * parameters:
4046 * srcbase: Source Rendering base address.
4047 * srcx: Source X offset.
4048 * srcy: Source Y offset.
4049 * dstoffset: Destination Rendering offset.
4050 * width: Width of the screen.
4051 * height: Height of the screen.
4052 * return: '1' was returned on success otherwise '0' was returned.
4053 *------------------------------------------------------------------------*/
4054 BOOLEAN
Gal2_mono_expand_blt(unsigned long srcbase,unsigned short srcx,unsigned short srcy,unsigned long dstoffset,unsigned short width,unsigned short height,int byte_packed)4055 Gal2_mono_expand_blt(unsigned long srcbase, unsigned short srcx,
4056 unsigned short srcy, unsigned long dstoffset,
4057 unsigned short width, unsigned short height,
4058 int byte_packed)
4059 {
4060 GAL_GFX2MONOEXPANDBLT sMonoexpandblt;
4061
4062 INIT_GAL(&sMonoexpandblt);
4063 sMonoexpandblt.dwSubfunction = GALFN_GFX2MONOEXPANDBLT;
4064 sMonoexpandblt.srcbase = srcbase;
4065 sMonoexpandblt.srcx = srcx;
4066 sMonoexpandblt.srcy = srcy;
4067 sMonoexpandblt.dstoffset = dstoffset;
4068 sMonoexpandblt.width = width;
4069 sMonoexpandblt.height = height;
4070 sMonoexpandblt.byte_packed = byte_packed;
4071
4072 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sMonoexpandblt)) {
4073 return 0;
4074 } else {
4075 return 1;
4076
4077 }
4078 }
4079
4080 /*--------------------------------------------------------------------------
4081 * Gal2_color_bitmap_to_screen_blt
4082 *
4083 * Description: This function used for color bmp to screen BLTs.
4084 * parameters:
4085 * srcx: Source X offset.
4086 * srcy: Source Y offset.
4087 * dstoffset: Destination Rendering offset.
4088 * width: Width of the screen.
4089 * height: Height of the screen.
4090 * *data: Color bmp data.
4091 * pitch: Pitch of the dispaly mode.
4092 * return: '1' was returned on success otherwise '0' was returned.
4093 *------------------------------------------------------------------------*/
4094 BOOLEAN
Gal2_color_bitmap_to_screen_blt(unsigned short srcx,unsigned short srcy,unsigned long dstoffset,unsigned short width,unsigned short height,unsigned char * data,unsigned short pitch)4095 Gal2_color_bitmap_to_screen_blt(unsigned short srcx,
4096 unsigned short srcy,
4097 unsigned long dstoffset,
4098 unsigned short width,
4099 unsigned short height,
4100 unsigned char *data, unsigned short pitch)
4101 {
4102 GAL_GFX2COLORBMPTOSCRBLT sColorbmptoscrblt;
4103
4104 INIT_GAL(&sColorbmptoscrblt);
4105 sColorbmptoscrblt.dwSubfunction = GALFN_GFX2COLORBMPTOSCRBLT;
4106 sColorbmptoscrblt.srcx = srcx;
4107 sColorbmptoscrblt.srcy = srcy;
4108 sColorbmptoscrblt.dstoffset = dstoffset;
4109 sColorbmptoscrblt.width = width;
4110 sColorbmptoscrblt.height = height;
4111 sColorbmptoscrblt.data = *data;
4112 sColorbmptoscrblt.pitch = pitch;
4113
4114 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sColorbmptoscrblt)) {
4115 return 0;
4116 } else {
4117 return 1;
4118 }
4119 }
4120
4121 /*--------------------------------------------------------------------------
4122 * Gal2_mono_bitmap_to_screen_blt
4123 *
4124 * Description: This function used for mono bmp to screen BLTs.
4125 * parameters:
4126 * srcx: Source X offset.
4127 * srcy: Source Y offset.
4128 * dstoffset: Destination Rendering offset.
4129 * width: Width of the screen.
4130 * height: Height of the screen.
4131 * *data: mono bmp data.
4132 * pitch: Pitch of the display mode.
4133 * return: '1' was returned on success otherwise '0' was returned.
4134 *------------------------------------------------------------------------*/
4135 BOOLEAN
Gal2_mono_bitmap_to_screen_blt(unsigned short srcx,unsigned short srcy,unsigned long dstoffset,unsigned short width,unsigned short height,unsigned char * data,unsigned short pitch)4136 Gal2_mono_bitmap_to_screen_blt(unsigned short srcx,
4137 unsigned short srcy,
4138 unsigned long dstoffset,
4139 unsigned short width,
4140 unsigned short height,
4141 unsigned char *data, unsigned short pitch)
4142 {
4143 GAL_GFX2MONOBMPTOSCRBLT sMonobmptoscrblt;
4144
4145 INIT_GAL(&sMonobmptoscrblt);
4146 sMonobmptoscrblt.dwSubfunction = GALFN_GFX2MONOBMPTOSCRBLT;
4147 sMonobmptoscrblt.srcx = srcx;
4148 sMonobmptoscrblt.srcy = srcy;
4149 sMonobmptoscrblt.dstoffset = dstoffset;
4150 sMonobmptoscrblt.width = width;
4151 sMonobmptoscrblt.height = height;
4152 sMonobmptoscrblt.data = *data;
4153 sMonobmptoscrblt.pitch = pitch;
4154
4155 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sMonobmptoscrblt)) {
4156 return 0;
4157 } else {
4158 return 1;
4159 }
4160 }
4161
4162 /*--------------------------------------------------------------------------
4163 * Gal2_bresenham_line
4164 *
4165 * Description: This function used to draw bresenham line. It allows the
4166 * arbitary destination stride.
4167 * parameters:
4168 * dstoffset: Destination offset.
4169 * length: Length of the line.
4170 * initerr: Intial error.
4171 * axialerr:
4172 * diagerr:
4173 * flags:
4174 * return: '1' was returned on success otherwise '0' was returned.
4175 *------------------------------------------------------------------------*/
4176 BOOLEAN
Gal2_bresenham_line(unsigned long dstoffset,unsigned short length,unsigned short initerr,unsigned short axialerr,unsigned short diagerr,unsigned short flags)4177 Gal2_bresenham_line(unsigned long dstoffset, unsigned short length,
4178 unsigned short initerr, unsigned short axialerr,
4179 unsigned short diagerr, unsigned short flags)
4180 {
4181 GAL_GFX2BRESENHAMLINE sBresenhamline;
4182
4183 INIT_GAL(&sBresenhamline);
4184 sBresenhamline.dwSubfunction = GALFN_GFX2BRESENHAMLINE;
4185 sBresenhamline.dstoffset = dstoffset;
4186 sBresenhamline.length = length;
4187 sBresenhamline.initerr = initerr;
4188 sBresenhamline.axialerr = axialerr;
4189 sBresenhamline.diagerr = diagerr;
4190 sBresenhamline.flags = flags;
4191
4192 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sBresenhamline)) {
4193 return 0;
4194 } else {
4195 return 1;
4196 }
4197 }
4198
4199 /*--------------------------------------------------------------------------
4200 * Gal2_sync_to_vblank
4201 *
4202 * Description: This function sets the a flag to synchronize the next
4203 * rendering routine to VBLANK.
4204 * parameters: none.
4205 * return: '1' was returned on success otherwise '0' was returned.
4206 *------------------------------------------------------------------------*/
4207 BOOLEAN
Gal2_sync_to_vblank(void)4208 Gal2_sync_to_vblank(void)
4209 {
4210 GAL_GFX2SYNCTOVBLANK sSynctovblank;
4211
4212 INIT_GAL(&sSynctovblank);
4213 sSynctovblank.dwSubfunction = GALFN_GFX2SYNCTOVBLANK;
4214
4215 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSynctovblank)) {
4216 return 0;
4217 } else {
4218 return 1;
4219 }
4220 }
4221
4222 /* Video routines */
4223
4224 /*--------------------------------------------------------------------------
4225 * Gal_set_video_yuv_pitch
4226 *
4227 * Description: This function sets the Video YUV pitch.
4228 *
4229 * parameters:
4230 * y_pitch: Y pitch.
4231 * uv_pitch: UV pitch.
4232 * return: '1' was returned on success otherwise '0' was returned.
4233 *------------------------------------------------------------------------*/
4234 BOOLEAN
Gal_set_video_yuv_pitch(unsigned long y_pitch,unsigned long uv_pitch)4235 Gal_set_video_yuv_pitch(unsigned long y_pitch, unsigned long uv_pitch)
4236 {
4237 GAL_VIDEOYUVPITCH sSetVideoyuvpitch;
4238
4239 INIT_GAL(&sSetVideoyuvpitch);
4240 sSetVideoyuvpitch.dwSubfunction = GALFN_SETVIDEOYUVPITCH;
4241 sSetVideoyuvpitch.y_pitch = y_pitch;
4242 sSetVideoyuvpitch.uv_pitch = uv_pitch;
4243
4244 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideoyuvpitch)) {
4245 return 0;
4246 } else {
4247 return 1;
4248 }
4249 }
4250
4251 /*--------------------------------------------------------------------------
4252 * Gal_get_video_yuv_pitch
4253 *
4254 * Description: This function gets the Video YUV pitch.
4255 *
4256 * parameters:
4257 * y_pitch: Y pitch.
4258 * uv_pitch: UV pitch.
4259 * return: '1' was returned on success otherwise '0' was returned.
4260 *------------------------------------------------------------------------*/
4261 BOOLEAN
Gal_get_video_yuv_pitch(unsigned long * y_pitch,unsigned long * uv_pitch)4262 Gal_get_video_yuv_pitch(unsigned long *y_pitch, unsigned long *uv_pitch)
4263 {
4264 GAL_VIDEOYUVPITCH sGetVideoyuvpitch;
4265
4266 INIT_GAL(&sGetVideoyuvpitch);
4267 sGetVideoyuvpitch.dwSubfunction = GALFN_GETVIDEOYUVPITCH;
4268
4269 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVideoyuvpitch)) {
4270 return 0;
4271 } else {
4272 *y_pitch = sGetVideoyuvpitch.y_pitch;
4273 *uv_pitch = sGetVideoyuvpitch.uv_pitch;
4274
4275 return 1;
4276 }
4277 }
4278
4279 /*--------------------------------------------------------------------------
4280 * Gal_set_video_yuv_offsets
4281 *
4282 * Description: This function sets the Video YUV offsets.
4283 *
4284 * parameters:
4285 * y_offset: Y offset.
4286 * u_offset: U offset.
4287 * v_offset: V offset.
4288 * return: '1' was returned on success otherwise '0' was returned.
4289 *------------------------------------------------------------------------*/
4290 BOOLEAN
Gal_set_video_yuv_offsets(unsigned long y_offset,unsigned long u_offset,unsigned long v_offset)4291 Gal_set_video_yuv_offsets(unsigned long y_offset, unsigned long u_offset,
4292 unsigned long v_offset)
4293 {
4294 GAL_VIDEOYUVOFFSETS sSetVideoyuvoffsets;
4295
4296 INIT_GAL(&sSetVideoyuvoffsets);
4297 sSetVideoyuvoffsets.dwSubfunction = GALFN_SETVIDEOYUVOFFSETS;
4298 sSetVideoyuvoffsets.dwYoffset = y_offset;
4299 sSetVideoyuvoffsets.dwUoffset = u_offset;
4300 sSetVideoyuvoffsets.dwVoffset = v_offset;
4301
4302 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideoyuvoffsets)) {
4303 return 0;
4304 } else {
4305 return 1;
4306 }
4307 }
4308
4309 /*--------------------------------------------------------------------------
4310 * Gal_get_video_yuv_offsets
4311 *
4312 * Description: This function gets the Video YUV offsets.
4313 *
4314 * parameters:
4315 * y_offset: Y offset.
4316 * u_offset: U offset.
4317 * v_offset: V offset.
4318 * return: '1' was returned on success otherwise '0' was returned.
4319 *------------------------------------------------------------------------*/ BOOLEAN
Gal_get_video_yuv_offsets(unsigned long * y_offset,unsigned long * u_offset,unsigned long * v_offset)4320 Gal_get_video_yuv_offsets(unsigned long *y_offset,
4321 unsigned long *u_offset, unsigned long *v_offset)
4322 {
4323 GAL_VIDEOYUVOFFSETS sGetVideoyuvoffsets;
4324
4325 INIT_GAL(&sGetVideoyuvoffsets);
4326 sGetVideoyuvoffsets.dwSubfunction = GALFN_GETVIDEOYUVOFFSETS;
4327
4328 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVideoyuvoffsets)) {
4329 return 0;
4330 } else {
4331 *y_offset = sGetVideoyuvoffsets.dwYoffset;
4332 *u_offset = sGetVideoyuvoffsets.dwUoffset;
4333 *v_offset = sGetVideoyuvoffsets.dwVoffset;
4334 return 1;
4335 }
4336 }
4337
4338 /*--------------------------------------------------------------------------
4339 * Gal_set_video_left_crop
4340 *
4341 * Description: This function sets the number of pixels which will be cropped
4342 * from the beginning of each video line.
4343 *
4344 * parameters:
4345 * x:
4346 * return: '1' was returned on success otherwise '0' was returned.
4347 *------------------------------------------------------------------------*/ BOOLEAN
Gal_set_video_left_crop(unsigned short x)4348 Gal_set_video_left_crop(unsigned short x)
4349 {
4350 GAL_VIDEOLEFTCROP sSetVideoleftcrop;;
4351
4352 INIT_GAL(&sSetVideoleftcrop);
4353 sSetVideoleftcrop.dwSubfunction = GALFN_SETVIDEOLEFTCROP;
4354 sSetVideoleftcrop.x = x;
4355
4356 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideoleftcrop)) {
4357 return 0;
4358 } else {
4359 return 1;
4360 }
4361 }
4362
4363 /*--------------------------------------------------------------------------
4364 * Gal_set_video_vertical_downscale
4365 *
4366 * Description: This function sets the vertical downscale factor for the video
4367 * overlay window.
4368 *
4369 * parameters:
4370 * srch: Height of the source.
4371 * dsth: Height of the destination.
4372 * return: '1' was returned on success otherwise '0' was returned.
4373 *------------------------------------------------------------------------*/ BOOLEAN
Gal_set_video_vertical_downscale(unsigned short srch,unsigned short dsth)4374 Gal_set_video_vertical_downscale(unsigned short srch, unsigned short dsth)
4375 {
4376 GAL_VIDEOVERTICALDOWNSCALE sSetVideoverticaldownscale;
4377
4378 INIT_GAL(&sSetVideoverticaldownscale);
4379 sSetVideoverticaldownscale.dwSubfunction = GALFN_SETVIDEOVERTICALDOWNSCALE;
4380 sSetVideoverticaldownscale.srch = srch;
4381 sSetVideoverticaldownscale.dsth = dsth;
4382
4383 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVideoverticaldownscale)) {
4384 return 0;
4385 } else {
4386 return 1;
4387 }
4388 }
4389
4390 /*--------------------------------------------------------------------------
4391 * Gal_set_vbi_source
4392 *
4393 * Description: This function sets the VBI source.
4394 *
4395 * parameters:
4396 * source: VBI Source type.
4397 * return: '1' was returned on success otherwise '0' was returned.
4398 *------------------------------------------------------------------------*/ BOOLEAN
Gal_set_vbi_source(VbiSourceType source)4399 Gal_set_vbi_source(VbiSourceType source)
4400 {
4401 GAL_VBISOURCE sSetVbisource;
4402
4403 INIT_GAL(&sSetVbisource);
4404 sSetVbisource.dwSubfunction = GALFN_SETVBISOURCE;
4405 sSetVbisource.source = source;
4406
4407 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbisource)) {
4408 return 0;
4409 } else {
4410 return 1;
4411 }
4412 }
4413
4414 /*--------------------------------------------------------------------------
4415 * Gal_get_vbi_source
4416 *
4417 * Description: This function gets the VBI source.
4418 *
4419 * parameters:
4420 * source: VBI Source type.
4421 * return: '1' was returned on success otherwise '0' was returned.
4422 *------------------------------------------------------------------------*/
4423 BOOLEAN
Gal_get_vbi_source(VbiSourceType * source)4424 Gal_get_vbi_source(VbiSourceType * source)
4425 {
4426 GAL_VBISOURCE sGetVbisource;
4427
4428 INIT_GAL(&sGetVbisource);
4429 sGetVbisource.dwSubfunction = GALFN_GETVBISOURCE;
4430
4431 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbisource)) {
4432 return 0;
4433 } else {
4434
4435 *source = sGetVbisource.source;
4436 return 1;
4437 }
4438 }
4439
4440 /*--------------------------------------------------------------------------
4441 * Gal_set_vbi_lines
4442 *
4443 * Description: This function sets the VBI lines.
4444 *
4445 * parameters:
4446 * even: VBI even lines.
4447 * odd: VBI odd lines.
4448 * return: '1' was returned on success otherwise '0' was returned.
4449 *------------------------------------------------------------------------*/
4450 BOOLEAN
Gal_set_vbi_lines(unsigned long even,unsigned long odd)4451 Gal_set_vbi_lines(unsigned long even, unsigned long odd)
4452 {
4453 GAL_VBILINES sSetVbilines;
4454
4455 INIT_GAL(&sSetVbilines);
4456 sSetVbilines.dwSubfunction = GALFN_SETVBILINES;
4457 sSetVbilines.even = even;
4458 sSetVbilines.odd = odd;
4459
4460 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbilines)) {
4461 return 0;
4462 } else {
4463 return 1;
4464 }
4465 }
4466
4467 /*--------------------------------------------------------------------------
4468 * Gal_get_vbi_lines
4469 *
4470 * Description: This function gets the VBI lines.
4471 *
4472 * parameters:
4473 * lines: VBI lines.
4474 * odd: VBI odd lines.
4475 * return: '1' was returned on success otherwise '0' was returned.
4476 *------------------------------------------------------------------------*/ BOOLEAN
Gal_get_vbi_lines(int odd,unsigned long * lines)4477 Gal_get_vbi_lines(int odd, unsigned long *lines)
4478 {
4479 GAL_VBILINES sGetVbilines;
4480
4481 INIT_GAL(&sGetVbilines);
4482 sGetVbilines.dwSubfunction = GALFN_GETVBILINES;
4483 sGetVbilines.odd = odd;
4484
4485 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbilines)) {
4486 return 0;
4487 } else {
4488 *lines = sGetVbilines.lines;
4489 return 1;
4490 }
4491 }
4492
4493 /*--------------------------------------------------------------------------
4494 * Gal_set_vbi_total
4495 *
4496 * Description: This function sets the total number of VBI bytes for each
4497 * field.
4498 *
4499 * parameters:
4500 * even:
4501 * odd:
4502 * return: '1' was returned on success otherwise '0' was returned.
4503 *------------------------------------------------------------------------*/
4504 BOOLEAN
Gal_set_vbi_total(unsigned long even,unsigned long odd)4505 Gal_set_vbi_total(unsigned long even, unsigned long odd)
4506 {
4507 GAL_VBITOTAL sSetVbitotal;
4508
4509 INIT_GAL(&sSetVbitotal);
4510 sSetVbitotal.dwSubfunction = GALFN_SETVBITOTAL;
4511 sSetVbitotal.even = even;
4512 sSetVbitotal.odd = odd;
4513
4514 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVbitotal)) {
4515 return 0;
4516 } else {
4517 return 1;
4518 }
4519 }
4520
4521 /*--------------------------------------------------------------------------
4522 * Gal_set_vbi_total
4523 *
4524 * Description: This function gets the total number of VBI bytes in the
4525 * field.
4526 *
4527 * parameters:
4528 * even:
4529 * odd:
4530 * return: '1' was returned on success otherwise '0' was returned.
4531 *------------------------------------------------------------------------*/ BOOLEAN
Gal_get_vbi_total(int odd,unsigned long * total)4532 Gal_get_vbi_total(int odd, unsigned long *total)
4533 {
4534 GAL_VBITOTAL sGetVbitotal;
4535
4536 INIT_GAL(&sGetVbitotal);
4537 sGetVbitotal.dwSubfunction = GALFN_GETVBITOTAL;
4538 sGetVbitotal.odd = odd;
4539
4540 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVbitotal)) {
4541 return 0;
4542 } else {
4543 *total = sGetVbitotal.total;
4544 return 1;
4545 }
4546 }
4547
4548 /*--------------------------------------------------------------------------
4549 * Gal_set_vertical_scaler_offset
4550 *
4551 * Description: This function sets the Video vertical scaler offset.
4552 *
4553 * parameters:
4554 * offset: Vertical Scaler offset.
4555 * return: '1' was returned on success otherwise '0' was returned.
4556 *------------------------------------------------------------------------*/ BOOLEAN
Gal_set_vertical_scaler_offset(char offset)4557 Gal_set_vertical_scaler_offset(char offset)
4558 {
4559 GAL_VSCALEROFFSET sSetVscaleroffset;
4560
4561 INIT_GAL(&sSetVscaleroffset);
4562 sSetVscaleroffset.dwSubfunction = GALFN_SETVSCALEROFFSET;
4563 sSetVscaleroffset.offset = offset;
4564
4565 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetVscaleroffset)) {
4566 return 0;
4567 } else {
4568 return 1;
4569 }
4570 }
4571
4572 /*--------------------------------------------------------------------------
4573 * Gal_get_vertical_scaler_offset
4574 *
4575 * Description: This function gets the Video vertical scaler offset.
4576 *
4577 * parameters:
4578 * offset: Vertical Scaler offset.
4579 * return: '1' was returned on success otherwise '0' was returned.
4580 *------------------------------------------------------------------------*/ BOOLEAN
Gal_get_vertical_scaler_offset(char * offset)4581 Gal_get_vertical_scaler_offset(char *offset)
4582 {
4583 GAL_VSCALEROFFSET sGetVscaleroffset;
4584
4585 INIT_GAL(&sGetVscaleroffset);
4586 sGetVscaleroffset.dwSubfunction = GALFN_GETVSCALEROFFSET;
4587
4588 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetVscaleroffset)) {
4589 return 0;
4590 } else {
4591
4592 *offset = sGetVscaleroffset.offset;
4593 return 1;
4594 }
4595 }
4596
4597 /*--------------------------------------------------------------------------
4598 * Gal_get_video_interlaced
4599 *
4600 * Description: This function gets the video interlaced mode.
4601 * parameters:
4602 * interlaced: ptr to the interlaced status.
4603 * return: '1' was returned on success otherwise '0' was returned.
4604 *------------------------------------------------------------------------*/
4605 BOOLEAN
Gal_get_video_interlaced(int * interlaced)4606 Gal_get_video_interlaced(int *interlaced)
4607 {
4608 GAL_GETVIDEOINTERLACED sGetvideointerlaced;
4609
4610 INIT_GAL(&sGetvideointerlaced);
4611 sGetvideointerlaced.dwSubfunction = GALFN_GETVIDEOINTERLACED;
4612
4613 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetvideointerlaced)) {
4614 return 0;
4615 } else {
4616 *interlaced = sGetvideointerlaced.interlaced;
4617 return 1;
4618 }
4619 }
4620
4621 /*--------------------------------------------------------------------------
4622 * Gal_get_color_space_YUV
4623 *
4624 * Description: This function gets the video color space YUV.
4625 * parameters:
4626 * colorspace: ptr to the color space.
4627 * return: '1' was returned on success otherwise '0' was returned.
4628 *------------------------------------------------------------------------*/
4629 BOOLEAN
Gal_get_color_space_YUV(int * colorspace)4630 Gal_get_color_space_YUV(int *colorspace)
4631 {
4632 GAL_COLORSPACEYUV sGetcolorspaceyuv;
4633
4634 INIT_GAL(&sGetcolorspaceyuv);
4635 sGetcolorspaceyuv.dwSubfunction = GALFN_GETCOLORSPACEYUV;
4636
4637 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetcolorspaceyuv)) {
4638 return 0;
4639 } else {
4640 *colorspace = sGetcolorspaceyuv.colorspace;
4641 return 1;
4642 }
4643 }
4644
4645 /*--------------------------------------------------------------------------
4646 * Gal_get_genlock_enable
4647 *
4648 * Description: This function gets the enable state of the genlock.
4649 * parameters:
4650 * enable: ptr to the enable state of the genlock.
4651 * return: '1' was returned on success otherwise '0' was returned.
4652 *------------------------------------------------------------------------*/
4653 BOOLEAN
Gal_get_genlock_enable(int * enable)4654 Gal_get_genlock_enable(int *enable)
4655 {
4656 GAL_GENLOCKENABLE sGetgenlockenable;
4657
4658 INIT_GAL(&sGetgenlockenable);
4659 sGetgenlockenable.dwSubfunction = GALFN_GETGENLOCKENABLE;
4660
4661 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetgenlockenable)) {
4662 return 0;
4663 } else {
4664 *enable = sGetgenlockenable.enable;
4665 return 1;
4666 }
4667 }
4668
4669 /*--------------------------------------------------------------------------
4670 * Gal_set_genlock_enable
4671 *
4672 * Description: This function enable/disables and configure the genlock
4673 * according to the parameters.
4674 * parameters:
4675 * enable: enable state of the genlock.
4676 * return: '1' was returned on success otherwise '0' was returned.
4677 *------------------------------------------------------------------------*/
4678 BOOLEAN
Gal_set_genlock_enable(int enable)4679 Gal_set_genlock_enable(int enable)
4680 {
4681 GAL_GENLOCKENABLE sSetgenlockenable;
4682
4683 INIT_GAL(&sSetgenlockenable);
4684 sSetgenlockenable.dwSubfunction = GALFN_SETGENLOCKENABLE;
4685
4686 sSetgenlockenable.enable = enable;
4687 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetgenlockenable)) {
4688 return 0;
4689 } else {
4690 return 1;
4691 }
4692 }
4693
4694 /*--------------------------------------------------------------------------
4695 * Gal_get_genlock_delay
4696 *
4697 * Description: This function gets the genlock delay.
4698 * parameters:
4699 * delay: Ptr to the genlock delay.
4700 * return: '1' was returned on success otherwise '0' was returned.
4701 *------------------------------------------------------------------------*/
4702 BOOLEAN
Gal_get_genlock_delay(unsigned long * delay)4703 Gal_get_genlock_delay(unsigned long *delay)
4704 {
4705 GAL_GENLOCKDELAY sGetgenlockdelay;
4706
4707 INIT_GAL(&sGetgenlockdelay);
4708 sGetgenlockdelay.dwSubfunction = GALFN_GETGENLOCKDELAY;
4709
4710 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetgenlockdelay)) {
4711 return 0;
4712 } else {
4713 *delay = sGetgenlockdelay.delay;
4714 return 1;
4715 }
4716 }
4717
4718 /*--------------------------------------------------------------------------
4719 * Gal_set_genlock_delay
4720 *
4721 * Description: This function sets the genlock delay.
4722 * parameters:
4723 * delay: genlock delay.
4724 * return: '1' was returned on success otherwise '0' was returned.
4725 *------------------------------------------------------------------------*/
4726 BOOLEAN
Gal_set_genlock_delay(unsigned long delay)4727 Gal_set_genlock_delay(unsigned long delay)
4728 {
4729 GAL_GENLOCKDELAY sSetgenlockdelay;
4730
4731 INIT_GAL(&sSetgenlockdelay);
4732 sSetgenlockdelay.dwSubfunction = GALFN_SETGENLOCKDELAY;
4733
4734 sSetgenlockdelay.delay = delay;
4735 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetgenlockdelay)) {
4736 return 0;
4737 } else {
4738 return 1;
4739 }
4740 }
4741
4742 BOOLEAN
Gal_set_top_line_in_odd(int enable)4743 Gal_set_top_line_in_odd(int enable)
4744 {
4745 GAL_TOPLINEINODD sSettoplineinodd;
4746
4747 INIT_GAL(&sSettoplineinodd);
4748 sSettoplineinodd.dwSubfunction = GALFN_SETTOPLINEINODD;
4749
4750 sSettoplineinodd.enable = enable;
4751 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSettoplineinodd)) {
4752 return 0;
4753 } else {
4754 return 1;
4755 }
4756 }
4757
4758 /*--------------------------------------------------------------------------
4759 * Gal_get_video_cursor.
4760 *
4761 * Description: This function gets configuration of the Video Hardware
4762 * cursor.
4763 * parameters:
4764 * key: color key.
4765 * mask: color mask.
4766 *select_color2: selected for color2.
4767 * color1: color1 value.
4768 * color2: color2 value.
4769 * return: '1' was returned on success otherwise '0' was returned.
4770 *------------------------------------------------------------------------*/
4771 BOOLEAN
Gal_get_video_cursor(unsigned long * key,unsigned long * mask,unsigned short * select_color2,unsigned long * color1,unsigned long * color2)4772 Gal_get_video_cursor(unsigned long *key,
4773 unsigned long *mask,
4774 unsigned short *select_color2,
4775 unsigned long *color1, unsigned long *color2)
4776 {
4777 GAL_VIDEOCURSOR sGetvideocursor;
4778
4779 INIT_GAL(&sGetvideocursor);
4780 sGetvideocursor.dwSubfunction = GALFN_GETVIDEOCURSOR;
4781
4782 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetvideocursor)) {
4783 return 0;
4784 } else {
4785 *key = sGetvideocursor.key;
4786 *mask = sGetvideocursor.mask;
4787 *select_color2 = sGetvideocursor.select_color2;
4788 *color1 = sGetvideocursor.color1;
4789 *color2 = sGetvideocursor.color2;
4790 return 1;
4791 }
4792 }
4793
4794 /*--------------------------------------------------------------------------
4795 * Gal_read_crc.
4796 *
4797 * Description: This function reads the hardware CRC value, which is used for
4798 * automated testing.
4799 * parameters:
4800 * crc: Holds the crc value.
4801 * return: '1' was returned on success otherwise '0' was returned.
4802 *------------------------------------------------------------------------*/
4803 BOOLEAN
Gal_read_crc(unsigned long * crc)4804 Gal_read_crc(unsigned long *crc)
4805 {
4806 GAL_READCRC sReadcrc;
4807
4808 INIT_GAL(&sReadcrc);
4809 sReadcrc.dwSubfunction = GALFN_READCRC;
4810
4811 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sReadcrc)) {
4812 return 0;
4813 } else {
4814 *crc = sReadcrc.crc;
4815 return 1;
4816 }
4817 }
4818
4819 /*--------------------------------------------------------------------------
4820 * Gal_read_window_crc.
4821 *
4822 * Description: This function reads the hardware CRC value for a subsection
4823 * of the display.
4824 *
4825 * parameters:
4826 * source:
4827 * x:
4828 * y:
4829 * width:
4830 * height:
4831 * crc:
4832 * return: '1' was returned on success otherwise '0' was returned.
4833 *------------------------------------------------------------------------*/
4834 BOOLEAN
Gal_read_window_crc(int source,unsigned short x,unsigned short y,unsigned short width,unsigned short height,int crc32,unsigned long * crc)4835 Gal_read_window_crc(int source, unsigned short x, unsigned short y,
4836 unsigned short width, unsigned short height,
4837 int crc32, unsigned long *crc)
4838 {
4839 GAL_READWINDOWCRC sReadwindowcrc;
4840
4841 INIT_GAL(&sReadwindowcrc);
4842 sReadwindowcrc.dwSubfunction = GALFN_READWINDOWCRC;
4843 sReadwindowcrc.source = source;
4844 sReadwindowcrc.x = x;
4845 sReadwindowcrc.y = y;
4846 sReadwindowcrc.width = width;
4847 sReadwindowcrc.height = height;
4848 sReadwindowcrc.crc32 = crc32;
4849 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sReadwindowcrc)) {
4850 return 0;
4851 } else {
4852 *crc = sReadwindowcrc.crc;
4853 return 1;
4854 }
4855 }
4856
4857 /*--------------------------------------------------------------------------
4858 * Gal_get_macrovision_enable.
4859 *
4860 * Description: This function gets the enable state of the macrovision.
4861 *
4862 * parameters:
4863 * enable: ptr holds the macrovision enable state.
4864 * return: '1' was returned on success otherwise '0' was returned.
4865 *------------------------------------------------------------------------*/
4866 BOOLEAN
Gal_get_macrovision_enable(int * enable)4867 Gal_get_macrovision_enable(int *enable)
4868 {
4869 GAL_MACROVISIONENABLE sGetmacrovisionenable;
4870
4871 INIT_GAL(&sGetmacrovisionenable);
4872 sGetmacrovisionenable.dwSubfunction = GALFN_GETMACROVISIONENABLE;
4873
4874 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sGetmacrovisionenable)) {
4875 return 0;
4876 } else {
4877 *enable = sGetmacrovisionenable.enable;
4878 return 1;
4879 }
4880 }
4881
4882 /*--------------------------------------------------------------------------
4883 * Gal_set_macrovision_enable.
4884 *
4885 * Description: This function gets the enable state of the macrovision.
4886 *
4887 * parameters:
4888 * enable: macrovision enable state.
4889 * return: '1' was returned on success otherwise '0' was returned.
4890 *------------------------------------------------------------------------*/
4891 BOOLEAN
Gal_set_macrovision_enable(int enable)4892 Gal_set_macrovision_enable(int enable)
4893 {
4894 GAL_MACROVISIONENABLE sSetmacrovisionenable;
4895
4896 INIT_GAL(&sSetmacrovisionenable);
4897 sSetmacrovisionenable.dwSubfunction = GALFN_SETMACROVISIONENABLE;
4898
4899 sSetmacrovisionenable.enable = enable;
4900 if (ioctl(dfb_fbdev->fd, FBIOGAL_API, &sSetmacrovisionenable)) {
4901 return 0;
4902 } else {
4903 return 1;
4904 }
4905 }
4906