ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Windows/ether_windows.cpp
(Generate patch)

Comparing BasiliskII/src/Windows/ether_windows.cpp (file contents):
Revision 1.1 by gbeauche, 2004-12-06T23:31:03Z vs.
Revision 1.3 by gbeauche, 2005-03-19T17:43:03Z

# Line 1 | Line 1
1   /*
2   *  ether_windows.cpp - Ethernet device driver
3   *
4 < *  Basilisk II (C) 1997-2004 Christian Bauer
4 > *  Basilisk II (C) 1997-2005 Christian Bauer
5   *
6   *  Windows platform specific code copyright (C) Lauri Pesonen
7   *
# Line 1037 | Line 1037 | static unsigned int ether_thread_feed_in
1037   void EtherInterrupt(void)
1038   {
1039          int length;
1040 <        static uint8 packet[1514];
1040 >        EthernetPacket ether_packet;
1041 >        uint32 packet = ether_packet.addr();
1042  
1043          D(bug("EtherIRQ\r\n"));
1044  
1045          // Call protocol handler for received packets
1046 <        while( (length = dequeue_packet(packet)) > 0 ) {
1046 >        while( (length = dequeue_packet(Mac2HostAddr(packet))) > 0 ) {
1047  
1048                  if (length < 14)
1049                          continue;
1050  
1051   #if MONITOR
1052                  bug("Receiving Ethernet packet (%d bytes):\n",(int)length);
1053 <                dump_packet( packet, length );
1053 >                dump_packet( Mac2HostAddr(packet), length );
1054   #endif
1055  
1056                  // Get packet type
1057 <                uint16 type = ntohs(*(uint16 *)(packet + 12));
1057 >                uint16 type = ReadMacInt16(packet + 12);
1058  
1059                  // Look for protocol
1060                  NetProtocol *prot = find_protocol(type);
# Line 1067 | Line 1068 | void EtherInterrupt(void)
1068                  // break;
1069  
1070                  // Copy header to RHA
1071 <                memcpy(Mac2HostAddr(ether_data + ed_RHA), packet, 14);
1071 >                Mac2Mac_memcpy(ether_data + ed_RHA, packet, 14);
1072                  D(bug(" header %08lx%04lx %08lx%04lx %04lx\r\n", ReadMacInt32(ether_data + ed_RHA), ReadMacInt16(ether_data + ed_RHA + 4), ReadMacInt32(ether_data + ed_RHA + 6), ReadMacInt16(ether_data + ed_RHA + 10), ReadMacInt16(ether_data + ed_RHA + 12)));
1073  
1074                  // Call protocol handler
# Line 1075 | Line 1076 | void EtherInterrupt(void)
1076                  r.d[0] = type;                  // Packet type
1077                  r.d[1] = length - 14;             // Remaining packet length (without header, for ReadPacket)
1078  
1079 <                r.a[0] = (uint32)packet + 14;         // Pointer to packet (host address, for ReadPacket)
1079 >                r.a[0] = packet + 14;                     // Pointer to packet (Mac address, for ReadPacket)
1080                  r.a[3] = ether_data + ed_RHA + 14;        // Pointer behind header in RHA
1081                  r.a[4] = ether_data + ed_ReadPacket;      // Pointer to ReadPacket/ReadRest routines
1082                  D(bug(" calling protocol handler %08lx, type %08lx, length %08lx, data %08lx, rha %08lx, read_packet %08lx\r\n", prot->handler, r.d[0], r.d[1], r.a[0], r.a[3], r.a[4]));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines