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

Comparing BasiliskII/src/AmigaOS/ether_amiga.cpp (file contents):
Revision 1.8 by cebix, 2001-07-13T15:39:22Z vs.
Revision 1.12 by jlachmann, 2002-06-23T08:27:05Z

# Line 25 | Line 25
25   #include <dos/dosextens.h>
26   #include <dos/dostags.h>
27   #include <devices/sana2.h>
28 + #define __USE_SYSBASE
29   #include <proto/exec.h>
30   #include <proto/dos.h>
31 + #include <inline/exec.h>
32 + #include <inline/dos.h>
33 + #include <clib/alib_protos.h>
34  
35   #include "sysdeps.h"
36   #include "cpu_emulation.h"
# Line 392 | Line 396 | static __saveds void net_func(void)
396          ULONG dev_unit;
397  
398          str = PrefsFindString("ether");
399 <        if (str)
396 <                {
399 >        if (str) {
400                  const char *FirstSlash = strchr(str, '/');
401                  const char *LastSlash = strrchr(str, '/');
402  
403 <                if (FirstSlash && FirstSlash && FirstSlash != LastSlash)
404 <                        {
403 >                if (FirstSlash && FirstSlash && FirstSlash != LastSlash) {
404 >
405                          // Device name contains path, i.e. "Networks/xyzzy.device"
406                          const char *lp = str;
407                          char *dp = dev_name;
# Line 410 | Line 413 | static __saveds void net_func(void)
413                          if (strlen(dev_name) < 1)
414                                  goto quit;
415  
416 <                        if (1 != sscanf(LastSlash, "/%ld", &dev_unit))
416 >                        if (sscanf(LastSlash, "/%ld", &dev_unit) != 1)
417                                  goto quit;
418 <
419 < //                      printf("dev=<%s> unit=%d\n", dev_name, dev_unit);
417 <                        }
418 <                else
419 <                        {
420 <                        if (2 != sscanf(str, "%[^/]/%ld", dev_name, &dev_unit))
418 >                } else {
419 >                        if (sscanf(str, "%[^/]/%ld", dev_name, &dev_unit) != 2)
420                                  goto quit;
422                        }
421                  }
422 <        else
422 >        } else
423                  goto quit;
424  
425          // Open device
426          control_io->ios2_BufferManagement = buffer_tags;
427 <        od_error = OpenDevice((UBYTE *)dev_name, dev_unit, (struct IORequest *)control_io, 0);
428 <        if (0 != od_error || control_io->ios2_Req.io_Device == 0)
431 <                {
427 >        od_error = OpenDevice((UBYTE *) dev_name, dev_unit, (struct IORequest *)control_io, 0);
428 >        if (od_error != 0 || control_io->ios2_Req.io_Device == 0) {
429                  printf("WARNING: OpenDevice(<%s>, unit=%d) returned error %d)\n", (UBYTE *)dev_name, dev_unit, od_error);
430                  goto quit;
431 <                }
431 >        }
432          opened = true;
433  
434          // Is it Ethernet?
# Line 585 | Line 582 | static __saveds void net_func(void)
582                                                  }
583                                                  write_io->ios2_DataLength = len;
584  
585 <                                                // Get destination address, set source address
585 >                                                // Get destination address
586                                                  uint32 hdr = ReadMacInt32(wds + 2);
587                                                  Mac2Host_memcpy(write_io->ios2_DstAddr, hdr, 6);
591                                                Host2Mac_memcpy(hdr + 6, ether_addr, 6);
588  
589                                                  // Get packet type
590                                                  uint32 type = ReadMacInt16(hdr + 12);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines