Documented GVF_SAVE_VAR alongside other flags, and removed a query/doubt
[AROS.git] / rom / expansion / findconfigdev.c
blob9b2f354748888543c26ae5dbd5401fd52315b524
1 /*
2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: FindConfigDev() - Find a specific configurable device.
6 Lang: english
7 */
8 #include "expansion_intern.h"
10 /*****************************************************************************
12 NAME */
13 #include <proto/expansion.h>
15 AROS_LH3(struct ConfigDev *, FindConfigDev,
17 /* SYNOPSIS */
18 AROS_LHA(struct ConfigDev *, oldConfigDev, A0),
19 AROS_LHA(LONG , manufacturer, D0),
20 AROS_LHA(LONG , product, D1),
22 /* LOCATION */
23 struct ExpansionBase *, ExpansionBase, 12, Expansion)
25 /* FUNCTION
26 FindConfigDev() will search through the list of ConfigDevs and find
27 the one with the matching manufacturer and product identifiers.
29 The search will start with the ConfigDev after the oldConfigDev,
30 or at the beginning of oldConfigDev is NULL.
32 A manufacturer or product of -1 is treated as a wildcard and will
33 match any value.
35 INPUTS
36 oldConfigDev - The device to start the search after. If NULL
37 the search will start from the beginning of the
38 list.
39 manufacturer - The manufacturer id of the requested ConfigDev.
40 A value of -1 will match any device.
41 product - The product id of the ConfigDev. A value of -1
42 will match any device.
44 RESULT
45 The address of the first matching ConfigDev structure, or NULL if
46 none could be found.
48 NOTES
50 EXAMPLE
51 // Find all the config devs in the system
52 struct ConfigDev *cd = NULL;
54 while((cd = FindConfigDev(NULL, -1, -1)))
56 Printf("Found a device:\tMan = %5d\tProd = %d\n",
57 cd->cd_Rom.er_Manufacturer,
58 cd->cd_Rom.er_Product);
61 BUGS
63 SEE ALSO
65 INTERNALS
67 HISTORY
69 *****************************************************************************/
71 AROS_LIBFUNC_INIT
73 struct ConfigDev *cd = NULL;
75 /* Search through the list, we might as well lock it */
76 ObtainConfigBinding();
78 if( oldConfigDev == NULL )
79 cd = (struct ConfigDev *)
80 ((struct IntExpansionBase *)ExpansionBase)->BoardList.lh_Head;
81 else
82 cd = (struct ConfigDev *)(oldConfigDev->cd_Node.ln_Succ);
84 if (cd)
86 while( cd->cd_Node.ln_Succ != NULL )
90 ((manufacturer == -1) || (cd->cd_Rom.er_Manufacturer == manufacturer))
91 && ((product == -1) || (cd->cd_Rom.er_Product == product))
93 break;
95 cd = (struct ConfigDev *)cd->cd_Node.ln_Succ;
97 if (cd->cd_Node.ln_Succ == NULL)
98 cd = NULL;
101 ReleaseConfigBinding();
102 return cd;
104 AROS_LIBFUNC_EXIT
105 } /* FindConfigDev */