1 /* $NetBSD: sequoia.c,v 1.1 2002/02/10 01:58:09 thorpej Exp $ */ 2 3 /* 4 * Copyright 1997 5 * Digital Equipment Corporation. All rights reserved. 6 * 7 * This software is furnished under license and may be used and 8 * copied only in accordance with the following terms and conditions. 9 * Subject to these conditions, you may download, copy, install, 10 * use, modify and distribute this software in source and/or binary 11 * form. No title or ownership is transferred hereby. 12 * 13 * 1) Any source code used, modified or distributed must reproduce 14 * and retain this copyright notice and list of conditions as 15 * they appear in the source file. 16 * 17 * 2) No right is granted to use any trade name, trademark, or logo of 18 * Digital Equipment Corporation. Neither the "Digital Equipment 19 * Corporation" name nor any trademark or logo of Digital Equipment 20 * Corporation may be used to endorse or promote products derived 21 * from this software without the prior written permission of 22 * Digital Equipment Corporation. 23 * 24 * 3) This software is provided "AS-IS" and any express or implied 25 * warranties, including but not limited to, any implied warranties 26 * of merchantability, fitness for a particular purpose, or 27 * non-infringement are disclaimed. In no event shall DIGITAL be 28 * liable for any damages whatsoever, and in particular, DIGITAL 29 * shall not be liable for special, indirect, consequential, or 30 * incidental damages or damages for lost profits, loss of 31 * revenue or loss of use, whether such damages arise in contract, 32 * negligence, tort, under statute, in equity, at law or otherwise, 33 * even if advised of the possibility of such damage. 34 */ 35 36 /* 37 ** 38 ** INCLUDE FILES 39 ** 40 */ 41 42 #include <sys/param.h> 43 #include <sys/systm.h> 44 #include <sys/callout.h> 45 #include <sys/syslog.h> 46 #include <sys/types.h> 47 #include <machine/bus.h> 48 #include <sys/time.h> 49 #include <sys/kernel.h> 50 51 52 #include <dev/isa/isareg.h> 53 #include <machine/isa_machdep.h> 54 #include <shark/shark/sequoia.h> 55 #include <shark/shark/shark_fiq.h> 56 #include <arm/cpufunc.h> 57 58 59 60 61 62 /* 63 ** 64 ** MACROS 65 ** 66 */ 67 #define SET(t, f) (t) |= (f) 68 #define CLR(t, f) (t) &= ~(f) 69 #define ISSET(t, f) ((t) & (f)) 70 #define ISCLR(t, f) ( ((t) & (f)) == 0) 71 72 /* define regisers on sequoia used by pins */ 73 #define SEQUOIA_1GPIO PMC_GPCR_REG /* reg 0x007 gpio 0-3 */ 74 #define SEQUOIA_2GPIO SEQ2_OGPIOCR_REG /* reg 0x304 gpio 4.8 */ 75 76 /* define pins on sequoia that talk to smart card reader */ 77 #define SCR_DETECT_DIR GPIOCR2_M_GPIOBDIR0 78 #define SCR_DETECT GPIOCR2_M_GPIOBDATA0 79 80 81 #define SCR_POWER_DIR GPCR_M_GPIODIR0 82 #define SCR_POWER GPCR_M_GPIODATA0 83 84 #define SCR_RESET_DIR GPCR_M_GPIODIR1 85 #define SCR_RESET GPCR_M_GPIODATA1 86 87 #define SCR_CLOCK_DIR OGPIOCR_M_GPIODIR6 88 #define SCR_CLOCK OGPIOCR_M_GPIODATA6 89 90 #define SCR_DATA_IN_DIR GPCR_M_GPIODIR2 91 #define SCR_DATA_IN GPCR_M_GPIODATA2 92 93 #define SCR_DATA_OUT_DIR OGPIOCR_M_GPIODIR5 94 #define SCR_DATA_OUT OGPIOCR_M_GPIODATA5 95 96 #define SCR_BUGA_DIR OGPIOCR_M_GPIODIR4 97 #define SCR_BUGA OGPIOCR_M_GPIODATA4 98 99 #define SCR_BUGB_DIR OGPIOCR_M_GPIODIR7 100 #define SCR_BUGB OGPIOCR_M_GPIODATA7 101 102 103 104 /* define pins on sequoia that talk to leds */ 105 #define LED_BILED_YELLOW_BIT FOMPCR_M_PCON5 106 #define LED_BILED_GREEN_BIT FOMPCR_M_PCON6 107 108 #define LED_DEBUG_YELLOW_BIT FOMPCR_M_PCON7 109 #define LED_DEBUG_GREEN_BIT FOMPCR_M_PCON8 110 111 112 /* define biled colors */ 113 #define LED_BILED_NONE 0 114 #define LED_BILED_GREEN 1 115 #define LED_BILED_YELLOW 2 116 #define LED_BILED_RED 3 117 118 119 #define LED_TIMEOUT hz / 20 /* 20 times a second */ 120 #define LED_NET_ACTIVE (1000000/hz) * LED_TIMEOUT /* delay in us for net activity */ 121 122 123 124 125 /* 126 ** 127 ** DATA 128 ** 129 */ 130 static bus_space_handle_t sequoia_ioh; 131 132 static struct timeval ledLastActive; /* last time we get net activity */ 133 static int ledColor; /* present color of led */ 134 static int ledBlockCount;; /* reference count of block calles */ 135 int sequoia_index_cache = -1; /* set to silly value so that we dont cache on init */ 136 137 static struct callout led_timo_ch = CALLOUT_INITIALIZER; 138 139 /* 140 ** 141 ** FUNCITONAL PROTOTYPES 142 ** 143 */ 144 static void ledSetBiled(int color); 145 static void ledTimeout(void * arg); 146 147 /* 148 ** 149 ** FUNCITONS 150 ** 151 */ 152 void sequoiaInit(void) 153 { 154 u_int16_t seqReg; 155 156 /* map the sequoi registers */ 157 if (bus_space_map(&isa_io_bs_tag, SEQUOIA_BASE, SEQUOIA_NPORTS, 0, &sequoia_ioh)) 158 { 159 panic("SequoiaInit: io mapping failed"); 160 } 161 162 /* 163 ** 164 ** setup the pins associated with the X server 165 ** 166 */ 167 /* seems power on sets them correctly */ 168 169 170 171 /* 172 ** setup the pins associated with the led 173 */ 174 sequoiaRead(SEQR_SEQPSR1_REG,&seqReg); 175 SET(seqReg,SEQPSR1_M_TAGDEN); /* enable pc[4:9] */ 176 sequoiaWrite(SEQR_SEQPSR1_REG,seqReg); 177 178 179 sequoiaRead(SEQR_SEQPSR3_REG,&seqReg); 180 CLR(seqReg,SEQPSR3_M_PC5PINEN); /* enable pc5, biled */ 181 CLR(seqReg,SEQPSR3_M_PC6PINEN); /* enable pc6, biled */ 182 CLR(seqReg,SEQPSR3_M_PC7PINEN); /* enable pc7, debug led yellow */ 183 CLR(seqReg,SEQPSR3_M_PC8PINEN); /* enable pc8, debug led green */ 184 sequoiaWrite(SEQR_SEQPSR3_REG,seqReg); 185 186 sequoiaRead (PMC_FOMPCR_REG, &seqReg); 187 CLR(seqReg,LED_BILED_YELLOW_BIT); 188 CLR(seqReg,LED_BILED_GREEN_BIT); 189 SET(seqReg,LED_DEBUG_YELLOW_BIT); 190 CLR(seqReg,LED_DEBUG_GREEN_BIT); 191 sequoiaWrite(PMC_FOMPCR_REG, seqReg); 192 193 194 /* setup the biled info */ 195 ledColor = LED_BILED_GREEN; 196 ledLastActive.tv_usec = 0; 197 ledLastActive.tv_sec = 0; 198 ledBlockCount = 0; 199 callout_reset(&led_timo_ch, LED_TIMEOUT, ledTimeout, NULL); 200 /* 201 ** 202 ** setup the pins associated with the smart card reader * 203 ** 204 */ 205 /* sequoia 1 direction & data */ 206 207 sequoiaRead(SEQUOIA_1GPIO,&seqReg); 208 209 SET(seqReg,SCR_POWER_DIR); /* output */ 210 SET(seqReg,SCR_RESET_DIR); /* output */ 211 CLR(seqReg,SCR_DATA_IN_DIR); /* input */ 212 213 CLR(seqReg,SCR_POWER); /* 0V to card */ 214 SET(seqReg,SCR_RESET); /* 0V to card */ 215 216 sequoiaWrite(SEQUOIA_1GPIO,seqReg); 217 218 219 220 221 /* sequoia 2 pin enables */ 222 sequoiaRead(SEQ2_SEQ2PSR_REG,&seqReg); 223 224 SET(seqReg,SEQ2PSR_M_DPBUSEN); 225 CLR(seqReg,SEQ2PSR_M_GPIOPINEN); 226 227 sequoiaWrite(SEQ2_SEQ2PSR_REG,seqReg); 228 229 230 231 /* sequoia 2 direction & data */ 232 sequoiaRead(SEQUOIA_2GPIO,&seqReg); 233 234 SET(seqReg,SCR_BUGA_DIR); /* output */ 235 SET(seqReg,SCR_DATA_OUT_DIR); /* output */ 236 SET(seqReg,SCR_CLOCK_DIR); /* output */ 237 SET(seqReg,SCR_BUGB_DIR); /* output */ 238 239 CLR(seqReg,SCR_BUGA); /* 0 */ 240 CLR(seqReg,SCR_BUGB); /* 0 */ 241 CLR(seqReg,SCR_CLOCK); /* 0 */ 242 sequoiaWrite(SEQUOIA_2GPIO,seqReg); 243 244 /* setup the wak0 pin to be detect */ 245 sequoiaRead(SEQR_SEQPSR2_REG,&seqReg); 246 247 SET(seqReg,SEQPSR2_M_DIRTYPINEN); 248 SET(seqReg,SEQPSR2_M_GPIOB0PINEN); 249 250 sequoiaWrite(SEQR_SEQPSR2_REG,seqReg); 251 252 253 sequoiaRead(PMC_GPIOCR2_REG,&seqReg); 254 255 CLR(seqReg,SCR_DETECT_DIR); /* input */ 256 257 sequoiaWrite(PMC_GPIOCR2_REG,seqReg); 258 259 /* don't delay when setting PC bits. this is particularly important 260 for using PC[4] to clear the FIQ. */ 261 sequoiaRead(PMC_SCCR_REG, &seqReg); 262 sequoiaWrite(PMC_SCCR_REG, seqReg | SCCR_M_PCSTGDIS); 263 264 } 265 266 267 268 269 270 /* X console functions */ 271 void consXTvOn(void) 272 { 273 u_int16_t savedPSR3; 274 u_int16_t savedFMPCR; 275 /* 276 ** Switch on TV output on the Sequoia, data indicates mode, 277 ** but we are currently hardwired to NTSC, so ignore it. 278 */ 279 280 sequoiaRead (SEQR_SEQPSR3_REG, &savedPSR3); 281 sequoiaWrite(SEQR_SEQPSR3_REG, (savedPSR3 | SEQPSR3_M_PC3PINEN)); 282 283 sequoiaRead (PMC_FOMPCR_REG, &savedFMPCR); 284 sequoiaWrite(PMC_FOMPCR_REG, (savedFMPCR | FOMPCR_M_PCON3)); 285 286 } 287 288 void consXTvOff(void) 289 { 290 u_int16_t savedPSR3; 291 u_int16_t savedFMPCR; 292 /* 293 ** Switch off TV output on the Seqoia 294 */ 295 sequoiaRead (SEQR_SEQPSR3_REG, &savedPSR3); 296 sequoiaWrite(SEQR_SEQPSR3_REG, (savedPSR3 & ~SEQPSR3_M_PC3PINEN)); 297 298 sequoiaRead (PMC_FOMPCR_REG, &savedFMPCR); 299 sequoiaWrite(PMC_FOMPCR_REG, (savedFMPCR & ~FOMPCR_M_PCON3)); 300 301 } 302 303 304 305 306 /* smart card routines */ 307 308 int scrGetDetect (void) 309 { 310 int r; 311 u_int16_t seqReg; 312 313 sequoiaRead(PMC_GPIOCR2_REG,&seqReg); 314 315 /* inverse logic, so invert */ 316 if (ISSET(seqReg,SCR_DETECT)) 317 { 318 r = 0; 319 } else 320 { 321 r = 1; 322 } 323 324 return r; 325 } 326 327 328 void scrSetPower (int value) 329 { 330 u_int16_t seqReg; 331 #ifdef SHARK 332 u_int savedints; 333 334 savedints = disable_interrupts(I32_bit | F32_bit); 335 #endif 336 337 sequoiaRead(SEQUOIA_1GPIO,&seqReg); 338 339 if (value) 340 { 341 SET(seqReg,SCR_POWER); 342 } else 343 { 344 CLR(seqReg,SCR_POWER); 345 } 346 sequoiaWrite(SEQUOIA_1GPIO,seqReg); 347 348 #ifdef SHARK 349 restore_interrupts(savedints); 350 #endif 351 } 352 353 void scrSetClock (int value) 354 { 355 u_int16_t seqReg; 356 #ifdef SHARK 357 u_int savedints; 358 359 savedints = disable_interrupts(I32_bit | F32_bit); 360 #endif 361 362 sequoiaRead(SEQUOIA_2GPIO,&seqReg); 363 364 if (value) 365 { 366 SET(seqReg,SCR_CLOCK); 367 } else 368 { 369 CLR(seqReg,SCR_CLOCK); 370 } 371 sequoiaWrite(SEQUOIA_2GPIO,seqReg); 372 #ifdef SHARK 373 restore_interrupts(savedints); 374 #endif 375 } 376 377 void scrSetReset (int value) 378 { 379 u_int16_t seqReg; 380 #ifdef SHARK 381 u_int savedints; 382 383 savedints = disable_interrupts(I32_bit | F32_bit); 384 #endif 385 386 sequoiaRead(SEQUOIA_1GPIO,&seqReg); 387 388 if (value) 389 { 390 SET(seqReg,SCR_RESET); 391 } else 392 { 393 CLR(seqReg,SCR_RESET); 394 } 395 sequoiaWrite(SEQUOIA_1GPIO,seqReg); 396 397 #ifdef SHARK 398 restore_interrupts(savedints); 399 #endif 400 } 401 402 403 void scrSetDataHighZ (void) 404 { 405 u_int16_t seqReg; 406 #ifdef SHARK 407 u_int savedints; 408 409 savedints = disable_interrupts(I32_bit | F32_bit); 410 #endif 411 412 sequoiaRead(SEQUOIA_2GPIO,&seqReg); 413 414 /* set data to 5V, io pin is inverse logic */ 415 CLR(seqReg,SCR_DATA_OUT); 416 417 sequoiaWrite(SEQUOIA_2GPIO,seqReg); 418 #ifdef SHARK 419 restore_interrupts(savedints); 420 #endif 421 } 422 423 void scrSetData (int value) 424 { 425 u_int16_t seqReg; 426 #ifdef SHARK 427 u_int savedints; 428 429 savedints = disable_interrupts(I32_bit | F32_bit); 430 #endif 431 432 sequoiaRead(SEQUOIA_2GPIO,&seqReg); 433 /* inverse logic */ 434 if (value ) 435 { 436 CLR(seqReg,SCR_DATA_OUT); 437 } else 438 { 439 SET(seqReg,SCR_DATA_OUT); 440 } 441 sequoiaWrite(SEQUOIA_2GPIO,seqReg); 442 #ifdef SHARK 443 restore_interrupts(savedints); 444 #endif 445 } 446 447 int scrGetData (void) 448 { 449 int r; 450 u_int16_t seqReg; 451 452 sequoiaRead(SEQUOIA_1GPIO,&seqReg); 453 454 if (ISSET(seqReg,SCR_DATA_IN)) 455 { 456 r = 1; 457 } else 458 { 459 r = 0; 460 } 461 return r; 462 } 463 464 465 466 467 468 469 470 471 void ledNetActive (void) 472 { 473 ledLastActive = time; 474 } 475 476 void ledNetBlock (void) 477 { 478 ledBlockCount++; 479 } 480 481 void ledNetUnblock (void) 482 { 483 ledBlockCount--; 484 } 485 486 void ledPanic (void) 487 { 488 /* we are in panic, timeout wont happen, so set led */ 489 ledSetBiled(LED_BILED_RED); 490 } 491 492 static void ledTimeout(void * arg) 493 { 494 int timeSpan; /* in usec */ 495 496 if(time.tv_sec == ledLastActive.tv_sec) 497 { 498 timeSpan = time.tv_usec - ledLastActive.tv_usec; 499 } 500 501 else if (time.tv_sec - 10 < ledLastActive.tv_sec) /* stop rollover problems */ 502 { 503 timeSpan = (1000000 + time.tv_usec) - ledLastActive.tv_usec; 504 } 505 506 else 507 { 508 timeSpan = LED_NET_ACTIVE * 2; /* ie big number */ 509 } 510 511 512 513 /* check if we are blocked */ 514 if(ledBlockCount) 515 { 516 if(ledColor == LED_BILED_YELLOW) 517 { 518 ledSetBiled(LED_BILED_NONE); 519 } 520 else 521 { 522 ledSetBiled(LED_BILED_YELLOW); 523 } 524 } 525 526 527 /* check if we have network activity */ 528 else if (timeSpan < LED_NET_ACTIVE) 529 { 530 if(ledColor == LED_BILED_GREEN) 531 { 532 ledSetBiled(LED_BILED_NONE); 533 } 534 else 535 { 536 ledSetBiled(LED_BILED_GREEN); 537 } 538 } 539 540 /* normal operating mode */ 541 else 542 { 543 if(ledColor != LED_BILED_GREEN) 544 { 545 ledSetBiled(LED_BILED_GREEN); 546 } 547 } 548 549 /* resubmint the timeout */ 550 callout_reset(&led_timo_ch, LED_TIMEOUT, ledTimeout, NULL); 551 552 } 553 554 555 static void ledSetBiled(int color) 556 { 557 u_int16_t seqReg; 558 #ifdef SHARK 559 u_int savedints; 560 561 savedints = disable_interrupts(I32_bit | F32_bit); 562 #endif 563 ledColor = color; 564 565 566 sequoiaRead (PMC_FOMPCR_REG, &seqReg); 567 switch(color) 568 { 569 case LED_BILED_NONE: 570 SET(seqReg,LED_BILED_YELLOW_BIT); 571 SET(seqReg,LED_BILED_GREEN_BIT); 572 break; 573 574 case LED_BILED_YELLOW: 575 CLR(seqReg,LED_BILED_YELLOW_BIT); 576 SET(seqReg,LED_BILED_GREEN_BIT); 577 break; 578 579 case LED_BILED_GREEN: 580 SET(seqReg,LED_BILED_YELLOW_BIT); 581 CLR(seqReg,LED_BILED_GREEN_BIT); 582 break; 583 584 case LED_BILED_RED: 585 CLR(seqReg,LED_BILED_YELLOW_BIT); 586 CLR(seqReg,LED_BILED_GREEN_BIT); 587 break; 588 589 default: 590 panic("invalid color %x\n",color); 591 break; 592 } 593 sequoiaWrite(PMC_FOMPCR_REG, seqReg); 594 #ifdef SHARK 595 restore_interrupts(savedints); 596 #endif 597 } 598 599 600 int hwGetRev(void) 601 { 602 u_int16_t seqReg; 603 604 sequoiaRead(SR_POR_REG,&seqReg); 605 606 seqReg = seqReg >> POR_V_MISCCF0; 607 seqReg = seqReg & 0x7; 608 609 return seqReg; 610 } 611 612 613 614 615 616 /* routines to read/write to sequoia registers */ 617 void sequoiaWrite(int reg,u_int16_t seqReg) 618 { 619 #ifdef SHARK 620 u_int savedints; 621 622 savedints = disable_interrupts(I32_bit | F32_bit); 623 #endif 624 625 /* 626 On SHARK, the fiq comes from the pmi/smi. After receiving 627 a FIQ, the SMI must be cleared. The SMI gets cleared by 628 changing to sleep mode, thereby lowering PC[4]. */ 629 // need to do the right thing with the cache if this is going to work */ 630 if (reg == PMC_FOMPCR_REG) { 631 bus_space_write_2(&isa_io_bs_tag,sequoia_ioh,SEQUOIA_INDEX_OFFSET,reg); 632 bus_space_write_2(&isa_io_bs_tag,sequoia_ioh,SEQUOIA_DATA_OFFSET, 633 seqReg | (FOMPCR_M_PCON4)); 634 bus_space_write_2(&isa_io_bs_tag,sequoia_ioh,SEQUOIA_INDEX_OFFSET, 635 PMC_SLPMPCR_REG); 636 bus_space_write_2(&isa_io_bs_tag,sequoia_ioh,SEQUOIA_DATA_OFFSET, 637 seqReg & ~(SLPMPCR_M_PCSLP4)); 638 sequoia_index_cache = PMC_SLPMPCR_REG; 639 } else { 640 /* normal case: just do the write */ 641 if(sequoia_index_cache != reg) 642 { 643 sequoia_index_cache = reg; 644 bus_space_write_2(&isa_io_bs_tag,sequoia_ioh,SEQUOIA_INDEX_OFFSET,reg); 645 } 646 bus_space_write_2(&isa_io_bs_tag,sequoia_ioh,SEQUOIA_DATA_OFFSET,seqReg); 647 } 648 #ifdef SHARK 649 restore_interrupts(savedints); 650 #endif 651 } 652 653 void sequoiaRead (int reg,u_int16_t * seqReg_ptr) 654 { 655 #ifdef SHARK 656 u_int savedints; 657 658 savedints = disable_interrupts(I32_bit | F32_bit); 659 #endif 660 if(sequoia_index_cache != reg) 661 { 662 sequoia_index_cache = reg; 663 bus_space_write_2(&isa_io_bs_tag,sequoia_ioh,SEQUOIA_INDEX_OFFSET,reg); 664 } 665 *seqReg_ptr = bus_space_read_2(&isa_io_bs_tag,sequoia_ioh,SEQUOIA_DATA_OFFSET); 666 #ifdef SHARK 667 restore_interrupts(savedints); 668 #endif 669 } 670 671 672 void ledSetDebug(int command) 673 { 674 u_int16_t seqReg; 675 #ifdef SHARK 676 u_int savedints; 677 678 savedints = disable_interrupts(I32_bit | F32_bit); 679 #endif 680 sequoiaRead (PMC_FOMPCR_REG, &seqReg); 681 682 683 switch (command) 684 { 685 case LED_DEBUG_STATE_0: 686 CLR(seqReg,LED_DEBUG_YELLOW_BIT); 687 CLR(seqReg,LED_DEBUG_GREEN_BIT); 688 break; 689 690 case LED_DEBUG_STATE_1: 691 SET(seqReg,LED_DEBUG_YELLOW_BIT); 692 CLR(seqReg,LED_DEBUG_GREEN_BIT); 693 break; 694 695 case LED_DEBUG_STATE_2: 696 CLR(seqReg,LED_DEBUG_YELLOW_BIT); 697 SET(seqReg,LED_DEBUG_GREEN_BIT); 698 break; 699 700 case LED_DEBUG_STATE_3: 701 SET(seqReg,LED_DEBUG_YELLOW_BIT); 702 SET(seqReg,LED_DEBUG_GREEN_BIT); 703 break; 704 705 case LED_DEBUG_YELLOW_ON: 706 SET(seqReg,LED_DEBUG_YELLOW_BIT); 707 break; 708 709 case LED_DEBUG_YELLOW_OFF: 710 CLR(seqReg,LED_DEBUG_YELLOW_BIT); 711 break; 712 713 case LED_DEBUG_GREEN_ON: 714 SET(seqReg,LED_DEBUG_GREEN_BIT); 715 break; 716 717 case LED_DEBUG_GREEN_OFF: 718 CLR(seqReg,LED_DEBUG_GREEN_BIT); 719 break; 720 721 default: 722 panic("ledSetDebug: invalid command %d\n",command); 723 break; 724 } 725 sequoiaWrite(PMC_FOMPCR_REG, seqReg); 726 #ifdef SHARK 727 restore_interrupts(savedints); 728 #endif 729 } 730 731 732 #ifdef USEFULL_DEBUG 733 void sequoiaOneAccess(void) 734 { 735 u_int16_t reg; 736 #ifdef SHARK 737 u_int savedints; 738 739 savedints = disable_interrupts(I32_bit | F32_bit); 740 #endif 741 reg = bus_space_read_2(&isa_io_bs_tag,sequoia_ioh,SEQUOIA_DATA_OFFSET); 742 #ifdef SHARK 743 restore_interrupts(savedints); 744 #endif 745 } 746 #endif 747 748 int testPin=0; 749 void scrToggleTestPin (void) 750 { 751 u_int16_t seqReg; 752 #ifdef SHARK 753 u_int savedints; 754 755 savedints = disable_interrupts(I32_bit | F32_bit); 756 #endif 757 758 sequoiaRead(SEQUOIA_2GPIO,&seqReg); 759 760 if (testPin) 761 { 762 testPin = 0; 763 CLR(seqReg,SCR_BUGA); 764 } 765 else 766 { 767 SET(seqReg,SCR_BUGA); 768 testPin = 1; 769 } 770 sequoiaWrite(SEQUOIA_2GPIO,seqReg); 771 #ifdef SHARK 772 restore_interrupts(savedints); 773 #endif 774 } 775 776