home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 377b.lha / libraries / expansion / findboards.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-02-03  |  3.6 KB  |  99 lines

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