gfx_vip.c revision f29dbc25
1/* Copyright (c) 2005 Advanced Micro Devices, Inc. 2 * 3 * Permission is hereby granted, free of charge, to any person obtaining a copy 4 * of this software and associated documentation files (the "Software"), to 5 * deal in the Software without restriction, including without limitation the 6 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 7 * sell copies of the Software, and to permit persons to whom the Software is 8 * furnished to do so, subject to the following conditions: 9 * 10 * The above copyright notice and this permission notice shall be included in 11 * all copies or substantial portions of the Software. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 19 * IN THE SOFTWARE. 20 * 21 * Neither the name of the Advanced Micro Devices, Inc. nor the names of its 22 * contributors may be used to endorse or promote products derived from this 23 * software without specific prior written permission. 24 * */ 25 26/* 27 * This file contains routines to control the video input port (VIP). 28 * 29 * gfx_set_vip_enable 30 * gfx_set_vip_capture_run_mode 31 * gfx_set_vip_base 32 * gfx_set_vip_pitch 33 * gfx_set_vip_mode 34 * gfx_set_vbi_enable 35 * gfx_set_vbi_mode 36 * gfx_set_vbi_base 37 * gfx_set_vbi_pitch 38 * gfx_set_vbi_direct 39 * gfx_set_vbi_interrupt 40 * gfx_set_vip_bus_request_threshold_high 41 * gfx_set_vip_last_line 42 * gfx_test_vip_odd_field 43 * gfx_test_vip_bases_updated 44 * gfx_test_vip_fifo_overflow 45 * gfx_get_vip_line 46 * gfx_get_vip_base 47 * gfx_get_vbi_pitch 48 * 49 * And the following routines if GFX_READ_ROUTINES is set: 50 * 51 * gfx_get_vip_enable 52 * gfx_get_vip_pitch 53 * gfx_get_vip_mode 54 * gfx_get_vbi_enable 55 * gfx_get_vbi_mode 56 * gfx_get_vbi_base 57 * gfx_get_vbi_direct 58 * gfx_get_vbi_interrupt 59 * gfx_get_vip_bus_request_threshold_high 60 * */ 61 62/* INCLUDE SUPPORT FOR SC1200, IF SPECIFIED. */ 63 64#if GFX_VIP_SC1200 65#include "vip_1200.c" 66#endif 67 68/* WRAPPERS IF DYNAMIC SELECTION */ 69/* Extra layer to call either CS5530 or SC1200 routines. */ 70 71#if GFX_VIP_DYNAMIC 72 73/*--------------------------------------------------------------------------- 74 * gfx_set_vip_enable 75 *---------------------------------------------------------------------------- 76 */ 77int 78gfx_set_vip_enable(int enable) 79{ 80 int status = GFX_STATUS_UNSUPPORTED; 81 82#if GFX_VIP_SC1200 83 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 84 status = sc1200_set_vip_enable(enable); 85#endif 86 return (status); 87} 88 89/*---------------------------------------------------------------------------- 90 * gfx_set_vip_capture_run_mode 91 *---------------------------------------------------------------------------- 92 */ 93int 94gfx_set_vip_capture_run_mode(int mode) 95{ 96 int status = GFX_STATUS_UNSUPPORTED; 97 98#if GFX_VIP_SC1200 99 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 100 status = sc1200_set_vip_capture_run_mode(mode); 101#endif 102 return (status); 103} 104 105/*---------------------------------------------------------------------------- 106 * gfx_set_vip_base 107 *---------------------------------------------------------------------------- 108 */ 109int 110gfx_set_vip_base(unsigned long even, unsigned long odd) 111{ 112 int status = GFX_STATUS_UNSUPPORTED; 113 114#if GFX_VIP_SC1200 115 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 116 status = sc1200_set_vip_base(even, odd); 117#endif 118 return (status); 119} 120 121/*---------------------------------------------------------------------------- 122 * gfx_set_vip_pitch 123 *---------------------------------------------------------------------------- 124 */ 125int 126gfx_set_vip_pitch(unsigned long pitch) 127{ 128 int status = GFX_STATUS_UNSUPPORTED; 129 130#if GFX_VIP_SC1200 131 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 132 status = sc1200_set_vip_pitch(pitch); 133#endif 134 return (status); 135} 136 137/*---------------------------------------------------------------------------- 138 * gfx_set_vip_mode 139 *---------------------------------------------------------------------------- 140 */ 141int 142gfx_set_vip_mode(int mode) 143{ 144 int status = GFX_STATUS_UNSUPPORTED; 145 146#if GFX_VIP_SC1200 147 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 148 status = sc1200_set_vip_mode(mode); 149#endif 150 return (status); 151} 152 153/*---------------------------------------------------------------------------- 154 * gfx_set_vbi_enable 155 *---------------------------------------------------------------------------- 156 */ 157int 158gfx_set_vbi_enable(int enable) 159{ 160 int status = GFX_STATUS_UNSUPPORTED; 161 162#if GFX_VIP_SC1200 163 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 164 status = sc1200_set_vbi_enable(enable); 165#endif 166 return (status); 167} 168 169/*---------------------------------------------------------------------------- 170 * gfx_set_vbi_mode 171 *---------------------------------------------------------------------------- 172 */ 173int 174gfx_set_vbi_mode(int mode) 175{ 176 int status = GFX_STATUS_UNSUPPORTED; 177 178#if GFX_VIP_SC1200 179 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 180 status = sc1200_set_vbi_mode(mode); 181#endif 182 return (status); 183} 184 185/*---------------------------------------------------------------------------- 186 * gfx_set_vbi_base 187 *---------------------------------------------------------------------------- 188 */ 189int 190gfx_set_vbi_base(unsigned long even, unsigned long odd) 191{ 192 int status = GFX_STATUS_UNSUPPORTED; 193 194#if GFX_VIP_SC1200 195 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 196 status = sc1200_set_vbi_base(even, odd); 197#endif 198 return (status); 199} 200 201/*---------------------------------------------------------------------------- 202 * gfx_set_vbi_pitch 203 *---------------------------------------------------------------------------- 204 */ 205int 206gfx_set_vbi_pitch(unsigned long pitch) 207{ 208 int status = GFX_STATUS_UNSUPPORTED; 209 210#if GFX_VIP_SC1200 211 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 212 status = sc1200_set_vbi_pitch(pitch); 213#endif 214 return (status); 215} 216 217/*---------------------------------------------------------------------------- 218 * gfx_set_vbi_direct 219 *---------------------------------------------------------------------------- 220 */ 221int 222gfx_set_vbi_direct(unsigned long even_lines, unsigned long odd_lines) 223{ 224 int status = GFX_STATUS_UNSUPPORTED; 225 226#if GFX_VIP_SC1200 227 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 228 status = sc1200_set_vbi_direct(even_lines, odd_lines); 229#endif 230 return (status); 231} 232 233/*---------------------------------------------------------------------------- 234 * gfx_set_vbi_interrupt 235 *---------------------------------------------------------------------------- 236 */ 237int 238gfx_set_vbi_interrupt(int enable) 239{ 240 int status = GFX_STATUS_UNSUPPORTED; 241 242#if GFX_VIP_SC1200 243 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 244 status = sc1200_set_vbi_interrupt(enable); 245#endif 246 return (status); 247} 248 249/*---------------------------------------------------------------------------- 250 * gfx_set_vip_bus_request_threshold_high 251 *---------------------------------------------------------------------------- 252 */ 253int 254gfx_set_vip_bus_request_threshold_high(int enable) 255{ 256 int status = GFX_STATUS_UNSUPPORTED; 257 258#if GFX_VIP_SC1200 259 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 260 status = sc1200_set_vip_bus_request_threshold_high(enable); 261#endif 262 return (status); 263} 264 265/*---------------------------------------------------------------------------- 266 * gfx_set_vip_last_line 267 *---------------------------------------------------------------------------- 268 */ 269int 270gfx_set_vip_last_line(int last_line) 271{ 272 int status = GFX_STATUS_UNSUPPORTED; 273 274#if GFX_VIP_SC1200 275 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 276 status = sc1200_set_vip_last_line(last_line); 277#endif 278 return (status); 279} 280 281/*---------------------------------------------------------------------------- 282 * gfx_test_vip_odd_field 283 *---------------------------------------------------------------------------- 284 */ 285int 286gfx_test_vip_odd_field(void) 287{ 288 int status = GFX_STATUS_UNSUPPORTED; 289 290#if GFX_VIP_SC1200 291 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 292 status = sc1200_test_vip_odd_field(); 293#endif 294 return (status); 295} 296 297/*---------------------------------------------------------------------------- 298 * gfx_test_vip_bases_updated 299 *---------------------------------------------------------------------------- 300 */ 301int 302gfx_test_vip_bases_updated(void) 303{ 304 int status = GFX_STATUS_UNSUPPORTED; 305 306#if GFX_VIP_SC1200 307 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 308 status = sc1200_test_vip_bases_updated(); 309#endif 310 return (status); 311} 312 313/*---------------------------------------------------------------------------- 314 * gfx_test_vip_fifo_overflow 315 *---------------------------------------------------------------------------- 316 */ 317int 318gfx_test_vip_fifo_overflow(void) 319{ 320 int status = GFX_STATUS_UNSUPPORTED; 321 322#if GFX_VIP_SC1200 323 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 324 status = sc1200_test_vip_fifo_overflow(); 325#endif 326 return (status); 327} 328 329/*---------------------------------------------------------------------------- 330 * gfx_get_vip_line 331 *---------------------------------------------------------------------------- 332 */ 333int 334gfx_get_vip_line(void) 335{ 336 int status = GFX_STATUS_UNSUPPORTED; 337 338#if GFX_VIP_SC1200 339 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 340 status = sc1200_get_vip_line(); 341#endif 342 return (status); 343} 344 345/*---------------------------------------------------------------------------- 346 * gfx_get_vip_base 347 *---------------------------------------------------------------------------- 348 */ 349unsigned long 350gfx_get_vip_base(int odd) 351{ 352 unsigned long base = 0; 353 354#if GFX_VIP_SC1200 355 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 356 base = sc1200_get_vip_base(odd); 357#endif 358 return (base); 359} 360 361/*---------------------------------------------------------------------------- 362 * gfx_get_vbi_pitch 363 *---------------------------------------------------------------------------- 364 */ 365unsigned long 366gfx_get_vbi_pitch(void) 367{ 368 unsigned long pitch = 0; 369 370#if GFX_VIP_SC1200 371 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 372 pitch = sc1200_get_vbi_pitch(); 373#endif 374 return (pitch); 375} 376 377/*************************************************************/ 378/* READ ROUTINES | INCLUDED FOR DIAGNOSTIC PURPOSES ONLY */ 379/*************************************************************/ 380 381#if GFX_READ_ROUTINES 382 383/*---------------------------------------------------------------------------- 384 * gfx_get_vip_enable 385 *---------------------------------------------------------------------------- 386 */ 387int 388gfx_get_vip_enable(void) 389{ 390 int enable = 0; 391 392#if GFX_VIP_SC1200 393 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 394 enable = sc1200_get_vip_enable(); 395#endif 396 return (enable); 397} 398 399/*---------------------------------------------------------------------------- 400 * gfx_get_vip_pitch 401 *---------------------------------------------------------------------------- 402 */ 403unsigned long 404gfx_get_vip_pitch(void) 405{ 406 unsigned long pitch = 0; 407 408#if GFX_VIP_SC1200 409 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 410 pitch = sc1200_get_vip_pitch(); 411#endif 412 return (pitch); 413} 414 415/*---------------------------------------------------------------------------- 416 * gfx_get_vip_mode 417 *---------------------------------------------------------------------------- 418 */ 419int 420gfx_get_vip_mode(void) 421{ 422 int mode = 0; 423 424#if GFX_VIP_SC1200 425 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 426 mode = sc1200_get_vip_mode(); 427#endif 428 return (mode); 429} 430 431/*---------------------------------------------------------------------------- 432 * gfx_get_vbi_enable 433 *---------------------------------------------------------------------------- 434 */ 435int 436gfx_get_vbi_enable(void) 437{ 438 int enable = 0; 439 440#if GFX_VIP_SC1200 441 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 442 enable = sc1200_get_vbi_enable(); 443#endif 444 return (enable); 445} 446 447/*---------------------------------------------------------------------------- 448 * gfx_get_vbi_mode 449 *---------------------------------------------------------------------------- 450 */ 451int 452gfx_get_vbi_mode(void) 453{ 454 int mode = 0; 455 456#if GFX_VIP_SC1200 457 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 458 mode = sc1200_get_vbi_mode(); 459#endif 460 return (mode); 461} 462 463/*---------------------------------------------------------------------------- 464 * gfx_get_vbi_base 465 *---------------------------------------------------------------------------- 466 */ 467unsigned long 468gfx_get_vbi_base(int odd) 469{ 470 unsigned long base = 0; 471 472#if GFX_VIP_SC1200 473 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 474 base = sc1200_get_vbi_base(odd); 475#endif 476 return (base); 477} 478 479/*---------------------------------------------------------------------------- 480 * gfx_get_vbi_direct 481 *---------------------------------------------------------------------------- 482 */ 483unsigned long 484gfx_get_vbi_direct(int odd) 485{ 486 unsigned long vbi_direct_lines = 0; 487 488#if GFX_VIP_SC1200 489 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 490 vbi_direct_lines = sc1200_get_vbi_direct(odd); 491#endif 492 return (vbi_direct_lines); 493} 494 495/*---------------------------------------------------------------------------- 496 * gfx_get_vbi_interrupt 497 *---------------------------------------------------------------------------- 498 */ 499int 500gfx_get_vbi_interrupt(void) 501{ 502 int enable = 0; 503 504#if GFX_VIP_SC1200 505 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 506 enable = sc1200_get_vbi_interrupt(); 507#endif 508 return (enable); 509} 510 511/*---------------------------------------------------------------------------- 512 * gfx_get_vip_bus_request_threshold_high 513 *---------------------------------------------------------------------------- 514 */ 515int 516gfx_get_vip_bus_request_threshold_high(void) 517{ 518 int enable = 0; 519 520#if GFX_VIP_SC1200 521 if (gfx_vip_type == GFX_VIP_TYPE_SC1200) 522 enable = sc1200_get_vip_bus_request_threshold_high(); 523#endif 524 return (enable); 525} 526 527#endif /* GFX_READ_ROUTINES */ 528 529#endif /* GFX_VIP_DYNAMIC */ 530 531/* END OF FILE */ 532