1 /* $OpenBSD: bt463.c,v 1.3 2001/04/21 20:03:54 aaron Exp $ */ 2 /* $NetBSD: bt463.c,v 1.2 2000/06/13 17:21:06 nathanw Exp $ */ 3 4 /*- 5 * Copyright (c) 1998 The NetBSD Foundation, Inc. 6 * All rights reserved. 7 * 8 * This code is derived from software contributed to The NetBSD Foundation 9 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 10 * NASA Ames Research Center. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * 2. Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * 3. All advertising materials mentioning features or use of this software 21 * must display the following acknowledgement: 22 * This product includes software developed by the NetBSD 23 * Foundation, Inc. and its contributors. 24 * 4. Neither the name of The NetBSD Foundation nor the names of its 25 * contributors may be used to endorse or promote products derived 26 * from this software without specific prior written permission. 27 * 28 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 29 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 31 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 32 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGE. 39 */ 40 41 /* 42 * Copyright (c) 1995, 1996 Carnegie-Mellon University. 43 * All rights reserved. 44 * 45 * Author: Chris G. Demetriou 46 * 47 * Permission to use, copy, modify and distribute this software and 48 * its documentation is hereby granted, provided that both the copyright 49 * notice and this permission notice appear in all copies of the 50 * software, derivative works or modified versions, and any portions 51 * thereof, and that both notices appear in supporting documentation. 52 * 53 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 54 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 55 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 56 * 57 * Carnegie Mellon requests users of this software to return to 58 * 59 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 60 * School of Computer Science 61 * Carnegie Mellon University 62 * Pittsburgh PA 15213-3890 63 * 64 * any improvements or extensions that they make and grant Carnegie the 65 * rights to redistribute these changes. 66 */ 67 68 /* This code was derived from and originally located in sys/dev/pci/ 69 * NetBSD: tga_bt463.c,v 1.5 2000/03/04 10:27:59 elric Exp 70 */ 71 72 #include <sys/param.h> 73 #include <sys/systm.h> 74 #include <sys/device.h> 75 #include <sys/buf.h> 76 #include <sys/kernel.h> 77 #include <sys/malloc.h> 78 79 #include <vm/vm.h> 80 81 #include <dev/pci/pcivar.h> 82 #include <dev/pci/tgareg.h> 83 #include <dev/pci/tgavar.h> 84 #include <dev/ic/bt463reg.h> 85 #include <dev/ic/bt463var.h> 86 87 #include <dev/wscons/wsconsio.h> 88 89 /* 90 * Functions exported via the RAMDAC configuration table. 91 */ 92 void bt463_init __P((struct ramdac_cookie *)); 93 int bt463_set_cmap __P((struct ramdac_cookie *, 94 struct wsdisplay_cmap *)); 95 int bt463_get_cmap __P((struct ramdac_cookie *, 96 struct wsdisplay_cmap *)); 97 int bt463_set_cursor __P((struct ramdac_cookie *, 98 struct wsdisplay_cursor *)); 99 int bt463_get_cursor __P((struct ramdac_cookie *, 100 struct wsdisplay_cursor *)); 101 int bt463_set_curpos __P((struct ramdac_cookie *, 102 struct wsdisplay_curpos *)); 103 int bt463_get_curpos __P((struct ramdac_cookie *, 104 struct wsdisplay_curpos *)); 105 int bt463_get_curmax __P((struct ramdac_cookie *, 106 struct wsdisplay_curpos *)); 107 int bt463_check_curcmap __P((struct ramdac_cookie *, 108 struct wsdisplay_cursor *cursorp)); 109 void bt463_set_curcmap __P((struct ramdac_cookie *, 110 struct wsdisplay_cursor *cursorp)); 111 int bt463_get_curcmap __P((struct ramdac_cookie *, 112 struct wsdisplay_cursor *cursorp)); 113 114 #ifdef BT463_DEBUG 115 int bt463_store __P((void *)); 116 int bt463_debug __P((void *)); 117 int bt463_readback __P((void *)); 118 void bt463_copyback __P((void *)); 119 #endif 120 121 struct ramdac_funcs bt463_funcsstruct = { 122 "Bt463", 123 bt463_register, 124 bt463_init, 125 bt463_set_cmap, 126 bt463_get_cmap, 127 bt463_set_cursor, 128 bt463_get_cursor, 129 bt463_set_curpos, 130 bt463_get_curpos, 131 bt463_get_curmax, 132 bt463_check_curcmap, 133 bt463_set_curcmap, 134 bt463_get_curcmap, 135 }; 136 137 /* 138 * Private data. 139 */ 140 struct bt463data { 141 void *cookie; /* This is what is passed 142 * around, and is probably 143 * struct tga_devconfig * 144 */ 145 146 int (*ramdac_sched_update) __P((void *, void (*)(void *))); 147 void (*ramdac_wr) __P((void *, u_int, u_int8_t)); 148 u_int8_t (*ramdac_rd) __P((void *, u_int)); 149 150 int changed; /* what changed; see below */ 151 char curcmap_r[2]; /* cursor colormap */ 152 char curcmap_g[2]; 153 char curcmap_b[2]; 154 char cmap_r[BT463_NCMAP_ENTRIES]; /* colormap */ 155 char cmap_g[BT463_NCMAP_ENTRIES]; 156 char cmap_b[BT463_NCMAP_ENTRIES]; 157 int window_type[16]; /* 16 24-bit window type table entries */ 158 }; 159 160 /* When we're doing console initialization, there's no 161 * way to get our cookie back to the video card's softc 162 * before we call sched_update. So we stash it here, 163 * and bt463_update will look for it here first. 164 */ 165 static struct bt463data *console_data; 166 167 168 #define BTWREG(data, addr, val) do { bt463_wraddr((data), (addr)); \ 169 (data)->ramdac_wr((data)->cookie, BT463_REG_IREG_DATA, (val)); } while (0) 170 #define BTWNREG(data, val) (data)->ramdac_wr((data)->cookie, \ 171 BT463_REG_IREG_DATA, (val)) 172 #define BTRREG(data, addr) (bt463_wraddr((data), (addr)), \ 173 (data)->ramdac_rd((data)->cookie, BT463_REG_IREG_DATA)) 174 #define BTRNREG(data) ((data)->ramdac_rd((data)->cookie, BT463_REG_IREG_DATA)) 175 176 #define DATA_CURCMAP_CHANGED 0x01 /* cursor colormap changed */ 177 #define DATA_CMAP_CHANGED 0x02 /* colormap changed */ 178 #define DATA_WTYPE_CHANGED 0x04 /* window type table changed */ 179 #define DATA_ALL_CHANGED 0x07 180 181 /* 182 * Internal functions. 183 */ 184 inline void bt463_wraddr __P((struct bt463data *, u_int16_t)); 185 186 void bt463_update __P((void *)); 187 188 189 /*****************************************************************************/ 190 191 /* 192 * Functions exported via the RAMDAC configuration table. 193 */ 194 195 struct ramdac_funcs * 196 bt463_funcs(void) 197 { 198 return &bt463_funcsstruct; 199 } 200 201 struct ramdac_cookie * 202 bt463_register(v, sched_update, wr, rd) 203 void *v; 204 int (*sched_update)(void *, void (*)(void *)); 205 void (*wr)(void *, u_int, u_int8_t); 206 u_int8_t (*rd)(void *, u_int); 207 { 208 struct bt463data *data; 209 /* 210 * XXX -- comment out of date. rcd. 211 * If we should allocate a new private info struct, do so. 212 * Otherwise, use the one we have (if it's there), or 213 * use the temporary one on the stack. 214 */ 215 data = malloc(sizeof *data, M_DEVBUF, M_WAITOK); 216 /* XXX -- if !data */ 217 data->cookie = v; 218 data->ramdac_sched_update = sched_update; 219 data->ramdac_wr = wr; 220 data->ramdac_rd = rd; 221 return (struct ramdac_cookie *)data; 222 } 223 224 /* 225 * This function exists solely to provide a means to init 226 * the RAMDAC without first registering. It is useful for 227 * initializing the console early on. 228 */ 229 void 230 bt463_cninit(v, sched_update, wr, rd) 231 void *v; 232 int (*sched_update)(void *, void (*)(void *)); 233 void (*wr)(void *, u_int, u_int8_t); 234 u_int8_t (*rd)(void *, u_int); 235 { 236 struct bt463data tmp, *data = &tmp; 237 data->cookie = v; 238 data->ramdac_sched_update = sched_update; 239 data->ramdac_wr = wr; 240 data->ramdac_rd = rd; 241 /* Set up console_data so that when bt463_update is called back, 242 * it can use the right information. 243 */ 244 console_data = data; 245 bt463_init((struct ramdac_cookie *)data); 246 console_data = NULL; 247 } 248 249 void 250 bt463_init(rc) 251 struct ramdac_cookie *rc; 252 { 253 struct bt463data *data = (struct bt463data *)rc; 254 255 int i; 256 257 /* 258 * Init the BT463 for normal operation. 259 */ 260 261 262 /* 263 * Setup: 264 * reg 0: 4:1 multiplexing, 25/75 blink. 265 * reg 1: Overlay mapping: mapped to common palette, 266 * 14 window type entries, 24-plane configuration mode, 267 * 4 overlay planes, underlays disabled, no cursor. 268 * reg 2: sync-on-green enabled, pedestal enabled. 269 */ 270 271 BTWREG(data, BT463_IREG_COMMAND_0, 0x40); 272 BTWREG(data, BT463_IREG_COMMAND_1, 0x48); 273 BTWREG(data, BT463_IREG_COMMAND_2, 0xC0); 274 275 /* 276 * Initialize the read mask. 277 */ 278 bt463_wraddr(data, BT463_IREG_READ_MASK_P0_P7); 279 for (i = 0; i < 4; i++) 280 BTWNREG(data, 0xff); 281 282 /* 283 * Initialize the blink mask. 284 */ 285 bt463_wraddr(data, BT463_IREG_BLINK_MASK_P0_P7); 286 for (i = 0; i < 4; i++) 287 BTWNREG(data, 0); 288 289 290 /* 291 * Clear test register 292 */ 293 BTWREG(data, BT463_IREG_TEST, 0); 294 295 /* 296 * Initalize the RAMDAC info struct to hold all of our 297 * data, and fill it in. 298 */ 299 data->changed = DATA_ALL_CHANGED; 300 301 /* initial cursor colormap: 0 is black, 1 is white */ 302 data->curcmap_r[0] = data->curcmap_g[0] = data->curcmap_b[0] = 0; 303 data->curcmap_r[1] = data->curcmap_g[1] = data->curcmap_b[1] = 0xff; 304 305 /* Initial colormap: 0 is black, everything else is white */ 306 data->cmap_r[0] = data->cmap_g[0] = data->cmap_b[0] = 0; 307 for (i = 1; i < 256; i++) { 308 data->cmap_r[i] = rasops_cmap[3*i + 0]; 309 data->cmap_g[i] = rasops_cmap[3*i + 1]; 310 data->cmap_b[i] = rasops_cmap[3*i + 2]; 311 } 312 313 /* Initialize the window type table: 314 * 315 * Entry 0: 24-plane truecolor, overlays enabled, bypassed. 316 * 317 * Lookup table bypass: yes ( 1 << 23 & 0x800000) 800000 318 * Colormap address: 0x000 (0x000 << 17 & 0x7e0000) 0 319 * Overlay mask: 0xf ( 0xf << 13 & 0x01e000) 1e000 320 * Overlay location: P<27:24> ( 0 << 12 & 0x001000) 0 321 * Display mode: Truecolor ( 0 << 9 & 0x000e00) 000 322 * Number of planes: 8 ( 8 << 5 & 0x0001e0) 100 323 * Plane shift: 0 ( 0 << 0 & 0x00001f) 0 324 * -------- 325 * 0x81e100 326 */ 327 data->window_type[0] = 0x81e100; 328 329 /* Entry 1: 8-plane pseudocolor in the bottom 8 bits, 330 * overlays enabled, colormap starting at 0. 331 * 332 * Lookup table bypass: no ( 0 << 23 & 0x800000) 0 333 * Colormap address: 0x000 (0x000 << 17 & 0x7e0000) 0 334 * Overlay mask: 0xf ( 0xf << 13 & 0x01e000) 0x1e000 335 * Overlay location: P<27:24> ( 0 << 12 & 0x001000) 0 336 * Display mode: Pseudocolor ( 1 << 9 & 0x000e00) 0x200 337 * Number of planes: 8 ( 8 << 5 & 0x0001e0) 0x100 338 * Plane shift: 16 ( 0x10 << 0 & 0x00001f) 10 339 * -------- 340 * 0x01e310 341 */ 342 data->window_type[1] = 0x01e310; 343 344 /* The colormap interface to the world only supports one colormap, 345 * so having an entry for the 'alternate' colormap in the bt463 346 * probably isn't useful. 347 */ 348 349 /* Fill the remaining table entries with clones of entry 0 until we 350 * figure out a better use for them. 351 */ 352 353 for (i = 2; i < BT463_NWTYPE_ENTRIES; i++) { 354 data->window_type[i] = 0x81e100; 355 } 356 357 data->ramdac_sched_update(data->cookie, bt463_update); 358 359 } 360 361 int 362 bt463_set_cmap(rc, cmapp) 363 struct ramdac_cookie *rc; 364 struct wsdisplay_cmap *cmapp; 365 { 366 struct bt463data *data = (struct bt463data *)rc; 367 int count, index, s; 368 369 if ((u_int)cmapp->index >= BT463_NCMAP_ENTRIES || 370 ((u_int)cmapp->index + (u_int)cmapp->count) > BT463_NCMAP_ENTRIES) 371 return (EINVAL); 372 #if defined(UVM) 373 if (!uvm_useracc(cmapp->red, cmapp->count, B_READ) || 374 !uvm_useracc(cmapp->green, cmapp->count, B_READ) || 375 !uvm_useracc(cmapp->blue, cmapp->count, B_READ)) 376 return (EFAULT); 377 #else 378 if (!useracc(cmapp->red, cmapp->count, B_READ) || 379 !useracc(cmapp->green, cmapp->count, B_READ) || 380 !useracc(cmapp->blue, cmapp->count, B_READ)) 381 return (EFAULT); 382 #endif 383 384 s = spltty(); 385 386 index = cmapp->index; 387 count = cmapp->count; 388 copyin(cmapp->red, &data->cmap_r[index], count); 389 copyin(cmapp->green, &data->cmap_g[index], count); 390 copyin(cmapp->blue, &data->cmap_b[index], count); 391 392 data->changed |= DATA_CMAP_CHANGED; 393 394 data->ramdac_sched_update(data->cookie, bt463_update); 395 splx(s); 396 397 return (0); 398 } 399 400 int 401 bt463_get_cmap(rc, cmapp) 402 struct ramdac_cookie *rc; 403 struct wsdisplay_cmap *cmapp; 404 { 405 struct bt463data *data = (struct bt463data *)rc; 406 int error, count, index; 407 408 if ((u_int)cmapp->index >= BT463_NCMAP_ENTRIES || 409 ((u_int)cmapp->index + (u_int)cmapp->count) > BT463_NCMAP_ENTRIES) 410 return (EINVAL); 411 412 count = cmapp->count; 413 index = cmapp->index; 414 415 error = copyout(&data->cmap_r[index], cmapp->red, count); 416 if (error) 417 return (error); 418 error = copyout(&data->cmap_g[index], cmapp->green, count); 419 if (error) 420 return (error); 421 error = copyout(&data->cmap_b[index], cmapp->blue, count); 422 return (error); 423 } 424 425 int 426 bt463_check_curcmap(rc, cursorp) 427 struct ramdac_cookie *rc; 428 struct wsdisplay_cursor *cursorp; 429 { 430 int count; 431 432 if ((u_int)cursorp->cmap.index > 2 || 433 ((u_int)cursorp->cmap.index + 434 (u_int)cursorp->cmap.count) > 2) 435 return (EINVAL); 436 count = cursorp->cmap.count; 437 #if defined(UVM) 438 if (!uvm_useracc(cursorp->cmap.red, count, B_READ) || 439 !uvm_useracc(cursorp->cmap.green, count, B_READ) || 440 !uvm_useracc(cursorp->cmap.blue, count, B_READ)) 441 return (EFAULT); 442 #else 443 if (!useracc(cursorp->cmap.red, count, B_READ) || 444 !useracc(cursorp->cmap.green, count, B_READ) || 445 !useracc(cursorp->cmap.blue, count, B_READ)) 446 return (EFAULT); 447 #endif 448 return (0); 449 } 450 451 void 452 bt463_set_curcmap(rc, cursorp) 453 struct ramdac_cookie *rc; 454 struct wsdisplay_cursor *cursorp; 455 { 456 struct bt463data *data = (struct bt463data *)rc; 457 int count, index; 458 459 /* can't fail; parameters have already been checked. */ 460 count = cursorp->cmap.count; 461 index = cursorp->cmap.index; 462 copyin(cursorp->cmap.red, &data->curcmap_r[index], count); 463 copyin(cursorp->cmap.green, &data->curcmap_g[index], count); 464 copyin(cursorp->cmap.blue, &data->curcmap_b[index], count); 465 data->changed |= DATA_CURCMAP_CHANGED; 466 data->ramdac_sched_update(data->cookie, bt463_update); 467 } 468 469 int 470 bt463_get_curcmap(rc, cursorp) 471 struct ramdac_cookie *rc; 472 struct wsdisplay_cursor *cursorp; 473 { 474 struct bt463data *data = (struct bt463data *)rc; 475 int error; 476 477 cursorp->cmap.index = 0; /* DOCMAP */ 478 cursorp->cmap.count = 2; 479 if (cursorp->cmap.red != NULL) { 480 error = copyout(data->curcmap_r, cursorp->cmap.red, 2); 481 if (error) 482 return (error); 483 } 484 if (cursorp->cmap.green != NULL) { 485 error = copyout(data->curcmap_g, cursorp->cmap.green, 2); 486 if (error) 487 return (error); 488 } 489 if (cursorp->cmap.blue != NULL) { 490 error = copyout(data->curcmap_b, cursorp->cmap.blue, 2); 491 if (error) 492 return (error); 493 } 494 return (0); 495 } 496 497 498 /*****************************************************************************/ 499 500 /* 501 * Internal functions. 502 */ 503 504 #ifdef BT463_DEBUG 505 int bt463_store(void *v) 506 { 507 struct bt463data *data = (struct bt463data *)v; 508 509 data->changed = DATA_ALL_CHANGED; 510 data->ramdac_sched_update(data->cookie, bt463_update); 511 printf("Scheduled bt463 store\n"); 512 513 return 0; 514 } 515 516 517 int bt463_readback(void *v) 518 { 519 struct bt463data *data = (struct bt463data *)v; 520 521 data->ramdac_sched_update(data->cookie, bt463_copyback); 522 printf("Scheduled bt463 copyback\n"); 523 return 0; 524 } 525 526 int 527 bt463_debug(v) 528 void *v; 529 { 530 struct bt463data *data = (struct bt463data *)v; 531 int i; 532 u_int8_t val; 533 534 printf("BT463 main regs:\n"); 535 for (i = 0x200; i < 0x20F; i ++) { 536 val = BTRREG(data, i); 537 printf(" $%04x %02x\n", i, val); 538 } 539 540 printf("BT463 revision register:\n"); 541 val = BTRREG(data, 0x220); 542 printf(" $%04x %02x\n", 0x220, val); 543 544 printf("BT463 window type table (from softc):\n"); 545 546 for (i = 0; i < BT463_NWTYPE_ENTRIES; i++) { 547 printf("%02x %06x\n", i, data->window_type[i]); 548 } 549 550 return 0; 551 } 552 553 void 554 bt463_copyback(p) 555 void *p; 556 { 557 struct bt463data *data = (struct bt463data *)p; 558 int i; 559 560 for (i = 0; i < BT463_NWTYPE_ENTRIES; i++) { 561 bt463_wraddr(data, BT463_IREG_WINDOW_TYPE_TABLE + i); 562 data->window_type[i] = (BTRNREG(data) & 0xff); /* B0-7 */ 563 data->window_type[i] |= (BTRNREG(data) & 0xff) << 8; /* B8-15 */ 564 data->window_type[i] |= (BTRNREG(data) & 0xff) << 16; /* B16-23 */ 565 } 566 } 567 #endif 568 569 inline void 570 bt463_wraddr(data, ireg) 571 struct bt463data *data; 572 u_int16_t ireg; 573 { 574 data->ramdac_wr(data->cookie, BT463_REG_ADDR_LOW, ireg & 0xff); 575 data->ramdac_wr(data->cookie, BT463_REG_ADDR_HIGH, (ireg >> 8) & 0xff); 576 } 577 578 void 579 bt463_update(p) 580 void *p; 581 { 582 struct bt463data *data = (struct bt463data *)p; 583 int i, v; 584 585 if (console_data != NULL) { 586 /* The cookie passed in from sched_update is incorrect. Use the 587 * right one. 588 */ 589 data = console_data; 590 } 591 592 v = data->changed; 593 594 /* The Bt463 won't accept window type data except during a blanking 595 * interval, so we do this early in the interrupt. 596 * Blanking the screen might also be a good idea, but it can cause 597 * unpleasant flashing and is hard to do from this side of the 598 * ramdac interface. 599 */ 600 if (v & DATA_WTYPE_CHANGED) { 601 /* spit out the window type data */ 602 for (i = 0; i < BT463_NWTYPE_ENTRIES; i++) { 603 bt463_wraddr(data, BT463_IREG_WINDOW_TYPE_TABLE + i); 604 BTWNREG(data, (data->window_type[i]) & 0xff); /* B0-7 */ 605 BTWNREG(data, (data->window_type[i] >> 8) & 0xff); /* B8-15 */ 606 BTWNREG(data, (data->window_type[i] >> 16) & 0xff); /* B16-23 */ 607 } 608 } 609 610 if (v & DATA_CURCMAP_CHANGED) { 611 bt463_wraddr(data, BT463_IREG_CURSOR_COLOR_0); 612 /* spit out the cursor data */ 613 for (i = 0; i < 2; i++) { 614 BTWNREG(data, data->curcmap_r[i]); 615 BTWNREG(data, data->curcmap_g[i]); 616 BTWNREG(data, data->curcmap_b[i]); 617 } 618 } 619 620 if (v & DATA_CMAP_CHANGED) { 621 bt463_wraddr(data, BT463_IREG_CPALETTE_RAM); 622 /* spit out the colormap data */ 623 for (i = 0; i < BT463_NCMAP_ENTRIES; i++) { 624 data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA, 625 data->cmap_r[i]); 626 data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA, 627 data->cmap_g[i]); 628 data->ramdac_wr(data->cookie, BT463_REG_CMAP_DATA, 629 data->cmap_b[i]); 630 } 631 } 632 633 data->changed = 0; 634 } 635 636 int bt463_set_cursor (rc, cur) 637 struct ramdac_cookie *rc; 638 struct wsdisplay_cursor *cur; 639 { 640 struct bt463data *data = (struct bt463data *)rc; 641 return tga_builtin_set_cursor(data->cookie, cur); 642 } 643 644 int bt463_get_cursor (rc, cur) 645 struct ramdac_cookie *rc; 646 struct wsdisplay_cursor *cur; 647 { 648 struct bt463data *data = (struct bt463data *)rc; 649 return tga_builtin_get_cursor(data->cookie, cur); 650 } 651 652 int bt463_set_curpos (rc, cur) 653 struct ramdac_cookie *rc; 654 struct wsdisplay_curpos *cur; 655 { 656 struct bt463data *data = (struct bt463data *)rc; 657 return tga_builtin_set_curpos(data->cookie, cur); 658 } 659 660 int bt463_get_curpos (rc, cur) 661 struct ramdac_cookie *rc; 662 struct wsdisplay_curpos *cur; 663 { 664 struct bt463data *data = (struct bt463data *)rc; 665 return tga_builtin_get_curpos(data->cookie, cur); 666 } 667 668 int bt463_get_curmax (rc, cur) 669 struct ramdac_cookie *rc; 670 struct wsdisplay_curpos *cur; 671 { 672 struct bt463data *data = (struct bt463data *)rc; 673 return tga_builtin_get_curmax(data->cookie, cur); 674 } 675