Changeset c27b2d0d in rtems
- Timestamp:
- 01/20/99 18:55:50 (25 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 97d6366
- Parents:
- f91b8df1
- Location:
- c/src/lib/libbsp/i386/i386ex
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/i386/i386ex/Makefile.in
rf91b8df1 rc27b2d0d 12 12 include $(RTEMS_ROOT)/make/directory.cfg 13 13 14 # #We only build the Network library if HAS_NETWORKING was defined15 #NETWORK_yes_V = network16 #NETWORK = $(NETWORK_$(HAS_NETWORKING)_V)14 # We only build the Network library if HAS_NETWORKING was defined 15 NETWORK_yes_V = network 16 NETWORK = $(NETWORK_$(HAS_NETWORKING)_V) 17 17 18 18 # wrapup is the one that actually builds and installs the library -
c/src/lib/libbsp/i386/i386ex/network/netexterns.h
rf91b8df1 rc27b2d0d 1 /* 2 * $Id$ 3 */ 4 1 5 #ifndef NET_EXTERNS_H 2 6 #define NET_EXTERNS_H … … 10 14 extern void uti596reset(void); 11 15 extern void uti596Diagnose(int); 16 extern void uti596_request_reset(void); 12 17 13 18 #endif -
c/src/lib/libbsp/i386/i386ex/network/network.c
rf91b8df1 rc27b2d0d 1 /* uti596.c: An 82596 ethernet driver for rtems-bsd. */ 1 /* uti596.c: An 82596 ethernet driver for rtems-bsd. 2 * 3 * $Id$ 4 */ 5 2 6 void dump_scb(void); 3 7 … … 11 15 12 16 13 int forceResetRX = 0;14 int forceResetTX = 0;15 16 17 17 /* 18 18 19 19 EII: Oct 16 : Version 0.0 20 21 20 22 21 */ … … 30 29 struct i596_rfd *pISR_Rfd; 31 30 32 33 #define MY_PRINT_1( msg, p1 ) { char buffer[80]; int i,j; sprintf(buffer, msg, p1 );j=strlen(buffer); for ( i=0;i<j;i++) outbyte(buffer[i]); }34 35 31 void show_buffers (void); 36 32 void show_queues(void); … … 68 64 #include <asm.h> 69 65 70 int reset_bit_test = 0;71 66 72 67 /* #include "../misc/utils.h" */ … … 74 69 static struct uti596_softc uti596_softc; 75 70 76 void uti596rxStart(int);77 71 int uti596packetNumber = 0; 78 72 … … 109 103 #define INTERRUPT_EVENT RTEMS_EVENT_1 110 104 #define START_TRANSMIT_EVENT RTEMS_EVENT_2 105 #define NIC_RESET_EVENT RTEMS_EVENT_3 111 106 112 107 #define RBUF_SIZE 1520 … … 131 126 void uti596_txDaemon (void *); 132 127 void uti596_rxDaemon (void *); 128 void uti596_resetDaemon (void *); 133 129 134 130 void uti596_stop (struct uti596_softc *); … … 140 136 141 137 void uti596_initialize_hardware(struct uti596_softc *); 138 void uti596_reset_hardware(struct uti596_softc *); 142 139 143 140 void uti596clearListStatus(struct i596_rfd *); … … 173 170 } \ 174 171 } 175 176 177 178 static void nopOn(const rtems_irq_connect_data* notUsed) 172 /*************************************************************************/ 173 174 void 175 uti596_request_reset(void){ 176 uti596_softc.nic_reset = 0; 177 sc = rtems_event_send(uti596_softc.resetDaemonTid, NIC_RESET_EVENT); 178 if ( sc != RTEMS_SUCCESSFUL ) 179 rtems_panic ("Can't notify resetDaemon: %s\n", rtems_status_text (sc)); 180 } 181 182 183 184 static void uti596_maskOn(const rtems_irq_connect_data* irq) 179 185 { 180 186 /* … … 182 188 * to this location ? 183 189 */ 190 (void) BSP_irq_enable_at_i8259s (irq->name); 191 } 192 193 static void uti596_maskOff(const rtems_irq_connect_data* irq) 194 { 195 /* 196 * code should be moved from initialize_hardware 197 * to this location ? 198 */ 199 (void) BSP_irq_disable_at_i8259s (irq->name); 184 200 } 185 201 … … 277 293 278 294 uti596_softc.savedCount = 0; 295 296 uti596_softc.nop.cmd.command = CmdNOp; /* initialize the nop command */ 279 297 280 298 return (i); /* the number of allocated buffers */ … … 327 345 pLastRfd -> cmd &= ~CMD_EOL; /* RESET_EL : reset EL bit to 0 */ 328 346 uti596_softc.countRFD++; /* Lets assume we add it successfully 329 If not, the RFD may be used, and may decrement countRFD < 0 !!*/ 330 /* if (uti596_softc.countRFD > UTI_596_RFD_NUMBER) { 331 printf( "Supply: Count too high, count == %d, when adding %p\n",uti596_softc.countRFD, pRfd); 332 dumpQ(); 333 } 334 */ 347 If not, the RFD may be used, and may decrement countRFD < 0 !!*/ 335 348 /* 336 349 * Check if the last RFD was used while appending. … … 354 367 */ 355 368 if (uti596_softc.pLastUnkRFD != I596_NULL ) { 356 /* printf("Before appending\n"); 357 dumpQ(); */ 369 358 370 uti596append(&uti596_softc.pSavedRfdQueue, pRfd); /* Only here! saved Q */ 359 371 uti596_softc.pEndSavedQueue = pRfd; 360 372 uti596_softc.savedCount++; 361 373 uti596_softc.countRFD--; 362 /* printf("Last UNK must be NULL: %p\n",uti596_softc.pLastUnkRFD); 363 dumpQ(); */ 374 364 375 } 365 376 else { … … 370 381 uti596_softc.pBeginRFA -> cmd &= ~CMD_EOL; /* Ensure that beginRFA is not EOL */ 371 382 372 UTI_596_ASSERT(uti596_softc.pEndRFA -> next == I596_NULL, "supply: List isbuggered\n");383 UTI_596_ASSERT(uti596_softc.pEndRFA -> next == I596_NULL, "supply: List buggered\n"); 373 384 UTI_596_ASSERT(uti596_softc.pEndRFA -> cmd & CMD_EOL, "supply: No EOL at end.\n"); 374 385 UTI_596_ASSERT(uti596_softc.scb.command == 0, "Supply: scb command must be zero\n"); 375 386 #ifdef DBG_START 376 printf("B"); 377 #endif 378 uti596rxStart(SCB_STAT_RNR); /*Ack the RNR interrupt */ 379 387 printf("Supply FD: starting receiver"); 388 #endif 389 /* start the receiver */ 390 UTI_596_ASSERT(uti596_softc.pBeginRFA != I596_NULL, "rx start w/ NULL begin! \n"); 391 uti596_softc.scb.pRfd = uti596_softc.pBeginRFA; 392 uti596_softc.scb.command = RX_START | SCB_STAT_RNR; /* Don't ack RNR! The receiver should be stopped in this case */ 393 UTI_596_ASSERT( !(uti596_softc.scb.status & SCB_STAT_FR),"FRAME RECEIVED INT COMING!\n"); 394 outport_byte(CHAN_ATTN, 0); 380 395 } 381 396 } 382 397 return; 383 398 384 399 } … … 399 414 } 400 415 401 void uti596rxStart(int cmd)402 {403 UTI_596_ASSERT(uti596_softc.pBeginRFA != I596_NULL, "rx start w/ NULL begin! \n");404 uti596_softc.scb.pRfd = uti596_softc.pBeginRFA;405 uti596_softc.scb.command = RX_START | cmd; /* Don't ack RNR! The receiver should be stopped in this case */406 UTI_596_ASSERT( !(uti596_softc.scb.status & SCB_STAT_FR),"FRAME RECEIVED INT COMING!\n");407 outport_byte(CHAN_ATTN, 0);408 }409 416 410 417 static void … … 442 449 443 450 /* change the scp address */ 444 451 #ifdef DBG_INIT 445 452 printf("Change the SCP address\n"); 453 #endif 446 454 447 455 /* … … 491 499 sc->irqInfo.name = UTI_596_IRQ; 492 500 sc->irqInfo.hdl = ( void * ) uti596DynamicInterruptHandler; 493 sc->irqInfo.on = nopOn;494 sc->irqInfo.off = nopOn;501 sc->irqInfo.on = uti596_maskOn; 502 sc->irqInfo.off = uti596_maskOff; 495 503 sc->irqInfo.isOn = uti596_isOn; 496 504 … … 503 511 uti596_initMem(sc); 504 512 505 /*506 * Create a semaphore to guard the critical sections within 596raw507 * IS THIS NEEDED W/ FreeBSD?508 */509 /* sc->semaphore_name = rtems_build_name('I','5','9','6');510 status_code = rtems_semaphore_create(sc->semaphore_name,511 UTI596_MUTEX,512 RTEMS_DEFAULT_ATTRIBUTES,513 RTEMS_NO_PRIORITY,514 &sc->semaphore_id);515 */516 513 #ifdef DBG_INIT 517 514 printf("After attach, status of board = 0x%x\n", sc->scb.status ); 518 515 #endif 516 outport_word(0x380, 0xf); /* reset the LED's */ 517 } 518 519 520 521 void 522 uti596_reset_hardware(struct uti596_softc *sc) 523 { 524 int boguscnt = 1000; 525 526 /* reset the board */ 527 outport_word( PORT_ADDR, 0 ); 528 outport_word( PORT_ADDR, 0 ); 529 530 #ifdef DBG_RESET 531 printf("reset_hardware:Scp address %p\n", sc->pScp); 532 #endif 533 sc->pScp = (struct i596_scp *) 534 ((((int)uti596_softc.pScp) + 0xf) & 0xfffffff0); 535 536 #ifdef DBG_RESET 537 printf("reset_hardware:change scp address to : %p\n",sc->pScp); 538 #endif 539 540 541 /* change the scp address */ 542 #ifdef DBG_RESET 543 printf("Change the SCP address\n"); 544 #endif 545 546 /* 547 * Set the DMA mode to enable the 82596 to become a bus-master 548 */ 549 outport_byte(DMA_MASK_REG,DMA_DISABLE); /* disable_dma */ 550 outport_byte(DMA_MODE_REG,DMA_MODE_CASCADE); /* set dma mode */ 551 outport_byte(DMA_MASK_REG,DMA_ENABLE); /* enable dma */ 552 553 /* reset the board */ 554 outport_word( PORT_ADDR, 0 ); 555 outport_word( PORT_ADDR, 0 ); 556 557 outport_word(PORT_ADDR, ((((int)uti596_softc.pScp) & 0xffff) | 2 )); 558 outport_word(PORT_ADDR, (( (int)uti596_softc.pScp) >> 16 ) & 0xffff ); 559 560 /* This is linear mode, LOCK function is disabled */ 561 562 sc->pScp->sysbus = 0x00540000; 563 sc->pScp->iscp = &sc->iscp; 564 sc->iscp.scb = &sc->scb; 565 sc->iscp.stat = 0x0001; 566 567 sc->pCmdHead = sc->scb.pCmd = I596_NULL; 568 569 #ifdef DBG_596 570 printf("reset_hardware: starting i82596.\n"); 571 #endif 572 573 /* Pass the scb address to the 596 */ 574 outport_word(CHAN_ATTN,0); 575 576 while (sc->iscp.stat) 577 if (--boguscnt == 0) 578 { 579 printf("reset_hardware: timed out with status %4.4lx\n", 580 sc->iscp.stat ); 581 break; 582 } 583 584 /* clear the command word */ 585 sc->scb.command = 0; 586 587 #ifdef DBG_RESET 588 printf("After reset_hardware, status of board = 0x%x\n", sc->scb.status ); 589 #endif 590 519 591 outport_word(0x380, 0xf); /* reset the LED's */ 520 592 } … … 706 778 struct i596_rfd *pRfd; 707 779 ISR_Level level; 708 int tid ,i;780 int tid; 709 781 rtems_event_set events; 710 782 struct ether_header *eh; … … 876 948 } 877 949 878 879 /* static inline */ void uti596reset_bit_test()880 {881 reset_bit_test = 1;882 }883 884 950 void uti596reset(void) 885 951 { 886 int i; 887 888 #ifdef DBG_596_RESET 889 printf ("i596reset\n"); 890 #endif 891 892 uti596_initialize_hardware(&uti596_softc); /* resets the ethernet hardware, now must re-config */ 893 uti596Diagnose(1); /* verbose diagnosis */ 894 895 uti596_softc.set_conf.cmd.command = CmdConfigure; 896 memcpy (uti596_softc.set_conf.data, uti596initSetup, 14); 897 uti596addPolledCmd( (struct i596_cmd *) &uti596_softc.set_conf); 898 899 while( !uti596_softc.set_conf.cmd.status & STAT_C ) 952 int i,count; 953 struct uti596_softc *sc = &uti596_softc; 954 /* struct i596_rfd * pRfd; */ 955 956 #ifdef DBG_RESET 957 printf ("reset: begins\n"); 958 #endif 959 960 sc->resetDone = 0; 961 sc->irqInfo.off(&sc->irqInfo); 962 963 UTI_WAIT_COMMAND_ACCEPTED(10000, "reset: wait for previous command complete"); 964 965 /* abort ALL of the current work */ 966 sc->scb.command = CUC_ABORT | RX_ABORT; 967 968 outport_word(CHAN_ATTN,0); 969 UTI_WAIT_COMMAND_ACCEPTED(4000, "reset: abort requested"); 970 971 uti596_reset_hardware(&uti596_softc); /* reset the ethernet hardware. must re-config */ 972 973 #ifdef DBG_RESET 974 uti596Diagnose(1); 975 #endif 976 977 sc->set_conf.cmd.command = CmdConfigure; 978 memcpy (sc->set_conf.data, uti596initSetup, 14); 979 uti596addPolledCmd( (struct i596_cmd *) &sc->set_conf); 980 981 /**** 982 * POLL 983 ****/ 984 985 count = 2000; 986 while( !( sc->set_conf.cmd.status & STAT_C ) && --count ) 900 987 printf("."); 901 902 printf("Configure completed\n"); 903 #ifdef DBG_596 904 printf("Setting Address\n"); 905 #endif 906 uti596_softc.set_add.cmd.command = CmdSASetup; 988 989 if ( count ) 990 printf("Configure OK, count = %d\n",count); 991 else 992 printf("***reset: Configure failed\n"); 993 994 /* 995 * Create the IA setup command 996 */ 997 998 #ifdef DBG_RESET 999 printf("reset: Setting Address\n"); 1000 #endif 1001 sc->set_add.cmd.command = CmdSASetup; 907 1002 for ( i=0; i<6; i++) 908 uti596_softc.set_add.data[i]= uti596_softc.arpcom.ac_enaddr[i]; 909 910 uti596_softc.cmdOk = 0; 911 uti596addCmd((struct i596_cmd *)&uti596_softc.set_add); 1003 sc->set_add.data[i]=sc->arpcom.ac_enaddr[i]; 1004 1005 sc->cmdOk = 0; 1006 uti596addPolledCmd((struct i596_cmd *)&sc->set_add); 1007 1008 count = 2000; 1009 while( !(sc->set_add.cmd.status & STAT_C ) && --count) 1010 printf("."); 1011 1012 if ( count ) 1013 printf ("Reset Set Address OK, count= %d\n",count); 1014 else 1015 printf("Reset Set Address Failed\n"); 912 1016 /*******/ 913 while( !uti596_softc.set_add.cmd.status & STAT_C ) 914 printf("."); 915 /*******/ 916 917 #ifdef DBG_596 918 printf( "After initialization, status and command: 0x%x, 0x%x\n", 919 uti596_softc.scb.status, uti596_softc.scb.status); 920 921 #endif 922 if ( uti596_softc.pLastUnkRFD != I596_NULL ) { 923 uti596_softc. pEndRFA = uti596_softc. pLastUnkRFD; /* The end position can be updated */ 924 uti596_softc. pLastUnkRFD = I596_NULL; 1017 1018 #ifdef DBG_RESET 1019 printf( "After reset, status and command: 0x%x, 0x%x\n", 1020 sc->scb.status, sc->scb.status); 1021 1022 #endif 1023 1024 1025 /* restore the RFA */ 1026 1027 dumpQ(); 1028 1029 if ( sc->pLastUnkRFD != I596_NULL ) { 1030 sc-> pEndRFA = sc->pLastUnkRFD; /* The end position can be updated */ 1031 sc-> pLastUnkRFD = I596_NULL; 925 1032 } 926 1033 927 /* clear status in RFA */ 928 uti596clearListStatus(uti596_softc.pBeginRFA ); 929 uti596clearListStatus(uti596_softc.pSavedRfdQueue ); 930 uti596_softc.scb.pRfd = uti596_softc.pBeginRFA; 931 932 uti596_softc.scb.command = RX_START; 1034 sc->pEndRFA->next = sc->pSavedRfdQueue; 1035 if ( sc->pSavedRfdQueue != I596_NULL ) { 1036 sc->pEndRFA = sc->pEndSavedQueue; 1037 sc->pSavedRfdQueue = sc->pEndSavedQueue = I596_NULL; 1038 sc -> countRFD = sc->rxBdCount ; 1039 } 1040 1041 /* if ( sc->pInboundFrameQueue != I596_NULL ){ 1042 do { 1043 pRfd = sc->pInboundFrameQueue->next; 1044 sc->pEndRFA -> next = sc->pInboundFrameQueue; 1045 sc->pInboundFrameQueue = pRfd; 1046 } while( pRfd != I596_NULL ) ; 1047 1048 } 1049 */ 1050 1051 sc->scb.pRfd = sc->pBeginRFA; /* readdress the head of the RFA in the SCB */ 1052 1053 uti596clearListStatus(sc->pBeginRFA ); 1054 1055 dumpQ(); /* purely for testing */ 1056 1057 sc->irqInfo.on(&sc->irqInfo); /* moved here. Was originally after command issued. */ 1058 sc->scb.command = RX_START; 1059 933 1060 outport_word(CHAN_ATTN,0 ); 934 UTI_WAIT_COMMAND_ACCEPTED(4000, "init"); 935 936 uti596_softc.started = 1; 1061 UTI_WAIT_COMMAND_ACCEPTED(4000, "reset"); 1062 1063 sc->resetDone = 1; 1064 1065 sc->started = 1; 1066 1067 /* uti596addCmd(&uti506_softc.nop); */ /* just for fun */ 1068 1069 #ifdef DBG_RESET 1070 printf("reset: complete\n"); 1071 #endif 937 1072 } 938 1073 … … 997 1132 pCmd->status = 0; 998 1133 pCmd->command |= (CMD_EOL | CMD_INTR ); /* all commands last in list & return an interrupt */ 999 if ( reset_bit_test ){1000 pCmd->command |= 0x0080;1001 printf("Issuing cmd: %#x\n", pCmd->command);1002 reset_bit_test = 0;1003 }1004 1134 1005 1135 pCmd->next = I596_NULL; … … 1157 1287 1158 1288 1289 /* 1290 * NIC reset daemon. 1291 */ 1292 void 1293 uti596_resetDaemon (void *arg) 1294 { 1295 struct uti596_softc *sc = (struct uti596_softc *)arg; 1296 rtems_event_set events; 1297 /* struct ifnet *ifp = &sc->arpcom.ac_if; */ 1298 1299 for (;;) { 1300 /* 1301 * Wait for reset event from ISR 1302 */ 1303 rtems_bsdnet_event_receive (NIC_RESET_EVENT, 1304 RTEMS_EVENT_ANY | RTEMS_WAIT, 1305 RTEMS_NO_TIMEOUT, &events); 1306 1307 printf("reset daemon: Resetting NIC\n"); 1308 1309 sc->stats.nic_reset_count++; 1310 /* 1311 * Reinitialize the network card 1312 */ 1313 rtems_bsdnet_semaphore_obtain (); 1314 uti596reset(); 1315 rtems_bsdnet_semaphore_release (); 1316 } 1317 } 1318 1319 1320 1159 1321 /*********************************************************************** 1160 1322 * Function: send_packet … … 1185 1347 rtems_event_set events; 1186 1348 1187 /*1188 * Block all competing threads. IS THIS NOW NEEDED? I THINK NOT1189 */1190 1191 /* while(1) {1192 #ifdef DBG_RAW1193 rtems_task_ident (0, 0, &tid);1194 printf("0x%x Waiting for semaphore\n", tid);1195 #endif1196 status = rtems_semaphore_obtain(sc->semaphore_id,1197 RTEMS_WAIT,1198 RTEMS_NO_TIMEOUT);1199 1200 if ( status == RTEMS_SUCCESSFUL ){1201 #ifdef DBG_RAW1202 printf("0x%x Got semaphore\n", tid);1203 #endif1204 break;1205 }1206 else1207 {1208 #ifdef DBG_RAW1209 printf("0x%x Waits on semaphore\n", tid);1210 #endif1211 sc->txRawWait++;1212 }1213 }1214 */1215 1349 /* 1216 1350 * For all mbufs in the chain, … … 1347 1481 } 1348 1482 1349 /* We have finished with this critical section */1350 /* rtems_semaphore_release(sc->semaphore_id); */1351 1483 1352 1484 } … … 1760 1892 } 1761 1893 1894 1762 1895 1763 1896 /*********************************************************************** … … 1792 1925 } 1793 1926 else { 1794 printk("\n***INFO:ISR won't wait\n");1927 printk("\n***INFO:ISR won't process now\n"); 1795 1928 return; 1796 1929 } 1797 1930 } 1798 1931 else { 1799 printk("\n***WARNING: Nothing to ACK\n"); 1932 printk("\n***ERROR: Spurious interrupt. Resetting...\n"); 1933 uti596_softc.nic_reset = 1; 1934 } 1935 1936 if ( (scbStatus & SCB_STAT_CX) && !(scbStatus & SCB_STAT_CNA) ){ 1937 printk("\n*****ERROR: Command Complete, and CNA available: 0x%x\nResetting...", scbStatus); 1938 uti596_softc.nic_reset = 1; 1800 1939 return; 1801 1940 } 1802 1803 if ( (scbStatus & SCB_STAT_CX) && !(scbStatus & SCB_STAT_CNA) ) 1804 printk("\n*****ERROR:Command Complete, CNA available: %#x\n", scbStatus); 1941 1942 if ( !(scbStatus & SCB_STAT_CX) && (scbStatus & SCB_STAT_CNA) ) { 1943 printk("\n*****ERROR: CNA, NO CX:0x%x\nResetting...",scbStatus); 1944 uti596_softc.nic_reset = 1; 1945 return; 1946 } 1947 1948 if ( scbStatus & SCB_CUS_SUSPENDED ) { 1949 printk("\n*****ERROR: Command unit suspended!:0x%x\nResetting...",scbStatus); 1950 uti596_softc.nic_reset = 1; 1951 return; 1952 } 1953 1954 if ( scbStatus & RU_SUSPENDED ) { 1955 printk("\n*****ERROR: Receive unit suspended!:0x%x\nResetting...",scbStatus); 1956 uti596_softc.nic_reset = 1; 1957 return; 1958 } 1805 1959 1806 if ( !(scbStatus & SCB_STAT_CX) && (scbStatus & SCB_STAT_CNA) ) 1807 printk("\n*****ERROR: CNA went unavailable, NO CX:%#x\n",scbStatus); 1808 1809 if ( scbStatus & SCB_STAT_RNR ) 1960 if ( scbStatus & SCB_STAT_RNR ) { 1810 1961 printk("\n*****WARNING: RNR %x\n",scbStatus); 1962 } 1811 1963 1812 1964 /* … … 1819 1971 printk("\nISR:FR\n"); 1820 1972 #endif 1821 if ( uti596_softc.pBeginRFA == I596_NULL || !( uti596_softc.pBeginRFA -> stat & STAT_C ) || 1822 forceResetRX ) { 1823 1824 /* if ( !forceResetRX ) 1825 printk("****ERROR: FR interrupt and NO complete FR!\n"); 1826 else 1827 printk("****INFO: RX reset requested\n"); 1828 */ 1829 forceResetRX = 0; 1830 printk("****INFO: Resetting board ( rx ) commented out\n"); 1973 if ( uti596_softc.pBeginRFA == I596_NULL || !( uti596_softc.pBeginRFA -> stat & STAT_C)){ 1831 1974 dump_scb(); 1832 /* uti596reset(); */1975 uti596_softc.nic_reset = 1; 1833 1976 } 1834 1977 else … … 1906 2049 * For ALL completed commands 1907 2050 */ 1908 if ( pIsrCmd != I596_NULL && pIsrCmd->status & STAT_C && !forceResetTX){2051 if ( pIsrCmd != I596_NULL && pIsrCmd->status & STAT_C ){ 1909 2052 1910 2053 #ifdef DBG_RAW_ISR … … 2022 2165 if ( pIsrCmd != I596_NULL ) 2023 2166 printk("****WARNING: more commands in list, but no start to NIC\n"); 2024 } /* end if completed*/2167 } /* end if pIsrCmd != NULL && pIsrCmd->stat & STAT_C */ 2025 2168 else { 2026 2169 2027 /* if ( !forceResetTX )2028 printk("*****ERROR:CX but no command is completed\n");2029 else2030 printk("*****INFO:forcing an ethernet card reset\n");2031 */2032 2170 /* Reset the ethernet card, and wake the transmitter (if necessary) */ 2033 2171 2034 2172 printk("****INFO: Resetting board ( tx )\n"); 2035 forceResetTX = 0; 2036 uti596reset(); 2173 uti596_softc.nic_reset = 1; 2037 2174 if ( uti596_softc.txDaemonTid){ /* Ensure that a transmitter is waiting */ 2038 2175 /* printk("*****INFO:Wake Transmitter\n"); */ … … 2207 2344 #endif 2208 2345 count_rx=0; 2346 2347 /* 2348 * Do this last, to ensure that the reset is called at the right time. 2349 */ 2350 if ( uti596_softc.nic_reset ){ 2351 uti596_softc.nic_reset = 0; 2352 sc = rtems_event_send(uti596_softc.resetDaemonTid, NIC_RESET_EVENT); 2353 if ( sc != RTEMS_SUCCESSFUL ) 2354 rtems_panic ("Can't notify resetDaemon: %s\n", rtems_status_text (sc)); 2355 } 2356 2209 2357 return; 2210 2358 } … … 2414 2562 printf ("Rx Framing Errors:%-8u", sc->stats.rx_frame_errors); 2415 2563 printf ("Rx crc errors:%-8u\n", sc->stats.rx_crc_errors); 2564 2416 2565 printf ("TX WAITS: %-8lu\n", sc->txRawWait); 2417 2566 2567 printf ("NIC resets: %-8u\n", sc->stats.nic_reset_count); 2568 2418 2569 printf("NIC reports\n"); 2570 2419 2571 dump_scb(); 2420 2572 } … … 2534 2686 */ 2535 2687 2536 sc->txDaemonTid = rtems_bsdnet_newproc ("UTtx", 4096, uti596_txDaemon, sc); 2537 sc->rxDaemonTid = rtems_bsdnet_newproc ("UTrx", 4096, uti596_rxDaemon, sc); 2538 2688 sc->txDaemonTid = rtems_bsdnet_newproc ("UTtx", 2*4096, uti596_txDaemon, sc); 2689 sc->rxDaemonTid = rtems_bsdnet_newproc ("UTrx", 2*4096, uti596_rxDaemon, sc); 2690 sc->resetDaemonTid = rtems_bsdnet_newproc ("UTrt", 2*4096, 2691 uti596_resetDaemon, sc); 2539 2692 } 2540 2693 /* -
c/src/lib/libbsp/i386/i386ex/network/uti596.h
rf91b8df1 rc27b2d0d 5 5 * EII: March 11: Created v. 0.0 6 6 * Jan 12/98 Added STAT bits, s11-=s5 and max_colls. 7 * 8 * $Id$ 7 9 */ 8 10 … … 49 51 int tx_heartbeat_errors; 50 52 int tx_window_errors; 53 54 /* NIC reset errors */ 55 int nic_reset_count; /* The number of times uti596reset() has been called. */ 51 56 }; 52 57 … … 79 84 #define SCB_STAT_RNR 0x1000 /* Receiver Not Ready */ 80 85 86 #define SCB_CUS_SUSPENDED 0x0100 87 #define SCB_CUS_ACTIVE 0x0200 88 89 81 90 #define STAT_C 0x8000 /* Set to 1 after execution */ 82 91 #define STAT_B 0x4000 /* 1 : Cmd being executed, 0 : Cmd done. */ … … 106 115 #define RX_ABORT 0x0040 107 116 108 #define RU_SUSPENDED 0x001 117 #define RU_SUSPENDED 0x0010 109 118 #define RU_NO_RESOURCES 0x0020 110 119 #define RU_READY 0x0040 111 120 112 113 121 114 122 #define IO_ADDR 0x360 … … 191 199 }; 192 200 193 201 struct i596_nop { 202 struct i596_cmd cmd; 203 }; 204 205 struct i596_tdr { 206 struct i596_cmd cmd; 207 unsigned int data; 208 }; 194 209 195 210 #define RX_RING_SIZE 8 … … 238 253 struct i596_set_add set_add; 239 254 struct i596_configure set_conf; 240 struct i596_cmd tdr; 255 struct i596_tdr tdr; 256 struct i596_nop nop; 241 257 unsigned long stat; 242 258 struct tx_cmd *pTxCmd; … … 255 271 rtems_id rxDaemonTid; 256 272 rtems_id txDaemonTid; 273 rtems_id resetDaemonTid; 257 274 258 275 struct enet_statistics stats; … … 273 290 char zeroes[64]; 274 291 unsigned long rawsndcnt; 292 int nic_reset; /* flag is for requesting that ISR issue a reset quest */ 275 293 } ; 276 294 #endif -
c/src/lib/libbsp/i386/i386ex/wrapup/Makefile.in
rf91b8df1 rc27b2d0d 12 12 GENERIC_PIECES= 13 13 14 # #We only build the Network library if HAS_NETWORKING was defined15 #NETWORK_yes_V = network16 #NETWORK = $(NETWORK_$(HAS_NETWORKING)_V)14 # We only build the Network library if HAS_NETWORKING was defined 15 NETWORK_yes_V = network 16 NETWORK = $(NETWORK_$(HAS_NETWORKING)_V) 17 17 18 18 # bummer; have to use $foreach since % pattern subst rules only replace 1x
Note: See TracChangeset
for help on using the changeset viewer.