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