Changeset a43ad5cd in rtems
- Timestamp:
- 03/30/99 15:54:37 (25 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- eacc8e3
- Parents:
- 6a4096b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c
r6a4096b ra43ad5cd 51 51 #include <irq.h> 52 52 53 /* Define this to force byte-wide data transfers with the NIC. This 54 is needed for boards like the TS-1325 386EX PC, which support only 55 an 8-bit PC/104 bus. Undefine this on a normal PC.*/ 56 57 /* #define NE2000_BYTE_TRANSFERS */ 58 53 59 /* Define this to print debugging messages with printk. */ 54 60 … … 132 138 /* The thread ID of the receive task. */ 133 139 rtems_id rx_daemon_tid; 140 141 /* Whether we use byte-transfers with the device. */ 142 rtems_boolean byte_transfers; 134 143 135 144 /* The number of memory buffers which the transmit daemon has loaded … … 212 221 outport_byte (port + CMDR, MSK_PG0 | MSK_RRE | MSK_STA); 213 222 214 while (len > 0) { 215 unsigned short d; 216 217 inport_word (dport, d); 218 *p++ = d; 219 *p++ = d >> 8; 220 len -= 2; 221 } 223 if (sc->byte_transfers) 224 while (len > 0) { 225 unsigned char d; 226 227 inport_byte (dport, d); 228 *p++ = d; 229 len--; 230 } 231 else /* word transfers */ 232 while (len > 0) { 233 unsigned short d; 234 235 inport_word (dport, d); 236 *p++ = d; 237 *p++ = d >> 8; 238 len -= 2; 239 } 222 240 223 241 outport_byte (port + ISR, MSK_RDC); … … 376 394 377 395 outport_byte (port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STP); 378 outport_byte (port + DCR, MSK_FT10 | MSK_BMS | MSK_WTS); 396 397 if (sc->byte_transfers) { 398 outport_byte (port + DCR, MSK_FT10 | MSK_BMS); 399 } 400 else { 401 outport_byte (port + DCR, MSK_FT10 | MSK_BMS | MSK_WTS); 402 } 403 379 404 outport_byte (port + RBCR0, 0); 380 405 outport_byte (port + RBCR1, 0); … … 393 418 outport_byte (port + PAR + i, sc->arpcom.ac_enaddr[i]); 394 419 420 #ifdef DEBUG_NE2000 421 printk ("Using ethernet address: "); 422 for (i = 0; i < ETHER_ADDR_LEN; ++i) 423 printk("%x ",sc->arpcom.ac_enaddr[i]); 424 printk ("\n"); 425 #endif 426 395 427 /* Clear the multicast address. */ 396 428 for (i = 0; i < MARsize; ++i) … … 483 515 outport_byte (port + CMDR, MSK_PG0 | MSK_RRE | MSK_STA); 484 516 485 inport_word (dport, statnext); 486 inport_word (dport, len); 517 if (sc->byte_transfers) { 518 unsigned char data; 519 520 inport_byte (dport, data); /* Throw away status */ 521 inport_byte (dport, data); 522 next = data; 523 524 inport_byte (dport, data); 525 len = data; 526 inport_byte (dport, data); 527 len |= data << 8; 528 } 529 else { /* Word transfers */ 530 inport_word (dport, statnext); 531 inport_word (dport, len); 532 533 next = statnext >> 8; 534 } 487 535 488 536 outport_byte (port + ISR, MSK_RDC); 489 537 490 next = statnext >> 8;491 538 if (next >= NE_STOP_PAGE) 492 539 next = NE_FIRST_RX_PAGE; … … 572 619 /* Transfer the mbuf chain to device memory. NE2000 devices require 573 620 that the data be transferred as words, so we need to handle odd 574 length mbufs. */621 length mbufs. Never occurs if we force byte transfers. */ 575 622 576 623 leftover = 0; … … 597 644 } 598 645 599 while (len > 1) { 600 outport_word (dport, data[0] | (data[1] << 8)); 601 data += 2; 602 len -= 2; 603 } 646 /* If using byte transfers, len always ends up as zero so 647 there are no leftovers. */ 648 649 if (sc->byte_transfers) 650 while (len > 0) { 651 outport_byte (dport, *data++); 652 len--; 653 } 654 else 655 while (len > 1) { 656 outport_word (dport, data[0] | (data[1] << 8)); 657 data += 2; 658 len -= 2; 659 } 604 660 605 661 if (len > 0) … … 898 954 memset (sc, 0, sizeof *sc); 899 955 956 /* Check whether we do byte-wide or word-wide transfers. */ 957 958 #ifdef NE2000_BYTE_TRANSFERS 959 sc->byte_transfers = TRUE; 960 #else 961 sc->byte_transfers = FALSE; 962 #endif 963 900 964 /* Handle the options passed in by the caller. */ 901 965 … … 932 996 933 997 outport_byte (sc->port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STP); 934 outport_byte (sc->port + DCR, MSK_FT10 | MSK_BMS | MSK_WTS); 998 999 if (sc->byte_transfers) { 1000 outport_byte (sc->port + DCR, MSK_FT10 | MSK_BMS); 1001 } 1002 else { 1003 outport_byte (sc->port + DCR, MSK_FT10 | MSK_BMS | MSK_WTS); 1004 } 1005 935 1006 outport_byte (sc->port + RBCR0, 0); 936 1007 outport_byte (sc->port + RBCR1, 0);
Note: See TracChangeset
for help on using the changeset viewer.