home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / useful / dev / c / rkrm / expansion / findboards.c < prev   
C/C++ Source or Header  |  1992-09-03  |  4KB  |  108 lines

  1. ;/* findboards.c - Execute me to compile me with SAS C 5.10
  2. LC -b1 -cfistq -v -y -j73 findboards.c
  3. Blink FROM LIB:c.o,findboards.o TO findboards LIBRARY LIB:LC.lib,LIB:Amiga.lib
  4. quit
  5. */
  6.  
  7. /*
  8. Copyright (c) 1992 Commodore-Amiga, Inc.
  9.  
  10. This example is provided in electronic form by Commodore-Amiga, Inc. for
  11. use with the "Amiga ROM Kernel Reference Manual: Libraries", 3rd Edition,
  12. published by Addison-Wesley (ISBN 0-201-56774-1).
  13.  
  14. The "Amiga ROM Kernel Reference Manual: Libraries" contains additional
  15. information on the correct usage of the techniques and operating system
  16. functions presented in these examples.  The source and executable code
  17. of these examples may only be distributed in free electronic form, via
  18. bulletin board or as part of a fully non-commercial and freely
  19. redistributable diskette.  Both the source and executable code (including
  20. comments) must be included, without modification, in any copy.  This
  21. example may not be published in printed form or distributed with any
  22. commercial product.  However, the programming techniques and support
  23. routines set forth in these examples may be used in the development
  24. of original executable software products for Commodore Amiga computers.
  25.  
  26. All other rights reserved.
  27.  
  28. This example is provided "as-is" and is subject to change; no
  29. warranties are made.  All use is at your own risk. No liability or
  30. responsibility is assumed.
  31. */
  32.  
  33. #include <exec/types.h>
  34. #include <exec/memory.h>
  35. #include <libraries/dos.h>
  36. #include <libraries/configvars.h>
  37.  
  38. #include <clib/exec_protos.h>
  39. #include <clib/expansion_protos.h>
  40. #include <stdlib.h>
  41. #include <stdio.h>
  42. #include <string.h>
  43.  
  44. #ifdef LATTICE
  45. int CXBRK(void) { return(0); }  /* Disable Lattice CTRL/C handling */
  46. int chkabort(void) { return(0); }  /* really */
  47. #endif
  48.  
  49. struct Library   *ExpansionBase = NULL;
  50.  
  51. void main(int argc, char **argv)
  52. {
  53.     struct ConfigDev *myCD;
  54.     UWORD m,i;
  55.     UBYTE p,f,t;
  56.  
  57.     if((ExpansionBase=OpenLibrary("expansion.library",0L))==NULL)
  58.     exit(RETURN_FAIL);
  59.  
  60.     /*--------------------------------------------------*/
  61.     /* FindConfigDev(oldConfigDev,manufacturer,product) */
  62.     /* oldConfigDev = NULL for the top of the list      */
  63.     /* manufacturer = -1 for any manufacturer           */
  64.     /* product      = -1 for any product                */
  65.     /*--------------------------------------------------*/
  66.  
  67.     myCD = NULL;
  68.     while(myCD=FindConfigDev(myCD,-1L,-1L)) /* search for all ConfigDevs */
  69.     {
  70.     printf("\n---ConfigDev structure found at location $%lx---\n",myCD);
  71.  
  72.     /* These values were read directly from the board at expansion time */
  73.     printf("Board ID (ExpansionRom) information:\n");
  74.  
  75.     t = myCD->cd_Rom.er_Type;
  76.     m = myCD->cd_Rom.er_Manufacturer;
  77.     p = myCD->cd_Rom.er_Product;
  78.     f = myCD->cd_Rom.er_Flags;
  79.     i = myCD->cd_Rom.er_InitDiagVec;
  80.  
  81.     printf("er_Manufacturer         =%d=$%04x=(~$%4x)\n",m,m,(UWORD)~m);
  82.     printf("er_Product              =%d=$%02x=(~$%2x)\n",p,p,(UBYTE)~p);
  83.  
  84.     printf("er_Type                 =$%02x",myCD->cd_Rom.er_Type);
  85.     if(myCD->cd_Rom.er_Type & ERTF_MEMLIST)
  86.         printf("  (Adds memory to free list)\n");
  87.     else printf("\n");
  88.  
  89.     printf("er_Flags                =$%02x=(~$%2x)\n",f,(UBYTE)~f);
  90.     printf("er_InitDiagVec          =$%04x=(~$%4x)\n",i,(UWORD)~i);
  91.  
  92.  
  93.     /* These values are generated when the AUTOCONFIG(tm) software
  94.      * relocates the board
  95.      */
  96.     printf("Configuration (ConfigDev) information:\n");
  97.     printf("cd_BoardAddr            =$%lx\n",myCD->cd_BoardAddr);
  98.     printf("cd_BoardSize            =$%lx (%ldK)\n",
  99.            myCD->cd_BoardSize,((ULONG)myCD->cd_BoardSize)/1024);
  100.  
  101.     printf("cd_Flags                =$%x",myCD->cd_Flags);
  102.     if(myCD->cd_Flags & CDF_CONFIGME)
  103.         printf("\n");
  104.     else printf("  (driver clears CONFIGME bit)\n");
  105.     }
  106.     CloseLibrary(ExpansionBase);
  107. }
  108.