home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / networking / misc / sana2.lha / sana2 / examples / devquery / devquery.c next >
Encoding:
C/C++ Source or Header  |  1991-11-18  |  1.5 KB  |  56 lines

  1. /*
  2. **  $Id: devquery.c,v 1.1 91/11/13 11:07:16 dlarson Exp $
  3. **
  4. **  SANA-II driver device query example.
  5. **
  6. **  Copyright 1991 Commodore-Amiga, Inc.
  7. **
  8. **  This code may be modified and used freely on Amiga computers.
  9. **
  10. */
  11.  
  12. #define NOBUFFS
  13. #include "/skeleton/skeleton.h"
  14.  
  15. struct MsgPort   *DevPort = NULL;
  16. struct IOSana2Req *IOB1   = NULL;
  17.  
  18. int    DeviceOpen = 0;
  19. long   DevBits;
  20.  
  21.  
  22. main(int argc, char *argv[])
  23. {
  24. struct Sana2DeviceQuery query;
  25.  
  26.     if(!initdev())
  27.     {
  28.         printf("Open Failed\n");
  29.         goto bottom;
  30.     }
  31.         printf("About to Query the device.\n");
  32.     query.SizeAvailable = sizeof(query);
  33.         IOB1->ios2_Req.io_Error   = 0;
  34.         IOB1->ios2_Req.io_Flags   = IOF_QUICK;
  35.         IOB1->ios2_Req.io_Command = S2_DEVICEQUERY;
  36.         IOB1->ios2_StatData = &query;
  37.         DoIO((struct IORequest *)IOB1);
  38.         IOB1->ios2_StatData = NULL;
  39.     if(IOB1->ios2_Req.io_Error)
  40.     {
  41.                 printf("ERROR RETURNED:%ld  WERR:%ld\n",
  42.                        (long)IOB1->ios2_Req.io_Error,
  43.                        (long)IOB1->ios2_WireError);
  44.         goto bottom;
  45.          }
  46.     printf("Query results:\n");
  47.     printf("Size available:%ld  Size Supplied:%ld  DevQueryFormat:%ld\n",
  48.            query.SizeAvailable, query.SizeSupplied, query.DevQueryFormat);
  49.     printf("DeviceLevel:%ld\n", query.DeviceLevel);
  50.     printf("Number of bits in address:%ld\n", (long)query.AddrFieldSize);
  51.     printf("Maximum Transmition Unit: %ld\n", query.MTU);
  52.     printf("Bits Per Second:          %ld\n", query.BPS);
  53.     printf("HardwareType:             %ld\n", query.HardwareType);
  54. bottom:    closedev();
  55. }
  56.