Ticket #1833: ne2000_bc_and_endian_fix.diff

File ne2000_bc_and_endian_fix.diff, 2.4 KB (added by strauman, on Jul 14, 2011 at 1:19:01 AM)

fix bug that disabled broadcast reception; also fix another (endianness) bug

Line 
1Index: ne2000.c
2===================================================================
3RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/i386/pc386/ne2000/ne2000.c,v
4retrieving revision 1.23.2.1
5diff -c -r1.23.2.1 ne2000.c
6*** ne2000.c    11 Apr 2011 17:27:57 -0000      1.23.2.1
7--- ne2000.c    14 Jul 2011 02:09:18 -0000
8***************
9*** 205,211 ****
10  {
11        unsigned char rsr;    /* receiver status */
12        unsigned char next;   /* pointer to next packet */
13!       unsigned short count; /* bytes in packet (length + 4)   */
14  };
15 
16  /* Forward declarations to avoid warnings */
17--- 205,212 ----
18  {
19        unsigned char rsr;    /* receiver status */
20        unsigned char next;   /* pointer to next packet */
21!       unsigned char cnt_lo; /* bytes in packet (length + 4)   */
22!       unsigned char cnt_hi; /* 16-bit, little-endian value    */
23  };
24 
25  /* Forward declarations to avoid warnings */
26***************
27*** 502,512 ****
28    /* Set page 0 registers */
29    outport_byte (port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STP);
30 
31!   /* accept broadcast */
32!   outport_byte (port + RCR, (sc->accept_broadcasts ? MSK_AB : 0));
33!
34!   /* accept multicast */
35!   outport_byte (port + RCR, MSK_AM);
36 
37    /* Start interface */
38    outport_byte (port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STA);
39--- 503,510 ----
40    /* Set page 0 registers */
41    outport_byte (port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STP);
42 
43!   /* accept broadcast + multicast */
44!   outport_byte (port + RCR, (sc->accept_broadcasts ? MSK_AB : 0) | MSK_AM);
45 
46    /* Start interface */
47    outport_byte (port + CMDR, MSK_PG0 | MSK_RD2 | MSK_STA);
48***************
49*** 605,611 ****
50          next = NE_FIRST_RX_PAGE;
51 
52        /* check packet length */
53!       len = hdr.count;
54        if (currpage < startpage)
55          cnt1 = currpage + (NE_STOP_PAGE - NE_FIRST_RX_PAGE) - startpage;
56        else
57--- 603,609 ----
58          next = NE_FIRST_RX_PAGE;
59 
60        /* check packet length */
61!       len = ( hdr.cnt_hi << 8 ) | hdr.cnt_lo;
62        if (currpage < startpage)
63          cnt1 = currpage + (NE_STOP_PAGE - NE_FIRST_RX_PAGE) - startpage;
64        else
65***************
66*** 684,690 ****
67        m->m_data += sizeof (struct ether_header);
68 
69  #ifdef DEBUG_NE
70!   /* printk("[r%d]", hdr.count - sizeof(hdr)); */
71    printk("<");
72  #endif
73        ether_input (ifp, eh, m);
74--- 682,688 ----
75        m->m_data += sizeof (struct ether_header);
76 
77  #ifdef DEBUG_NE
78!   /* printk("[r%d]", ((hdr.cnt_hi<<8) + hdr.cnt_lo - sizeof(hdr))); */
79    printk("<");
80  #endif
81        ether_input (ifp, eh, m);