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