2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: FindConfigDev() - Find a specific configurable device.
8 #include "expansion_intern.h"
10 /*****************************************************************************
13 #include <proto/expansion.h>
15 AROS_LH3(struct ConfigDev
*, FindConfigDev
,
18 AROS_LHA(struct ConfigDev
*, oldConfigDev
, A0
),
19 AROS_LHA(LONG
, manufacturer
, D0
),
20 AROS_LHA(LONG
, product
, D1
),
23 struct ExpansionBase
*, ExpansionBase
, 12, Expansion
)
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
36 oldConfigDev - The device to start the search after. If NULL
37 the search will start from the beginning of the
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.
45 The address of the first matching ConfigDev structure, or NULL if
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);
69 *****************************************************************************/
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
)->eb_BoardList
.lh_Head
;
82 cd
= (struct ConfigDev
*)(oldConfigDev
->cd_Node
.ln_Succ
);
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
))
95 cd
= (struct ConfigDev
*)cd
->cd_Node
.ln_Succ
;
97 if (cd
->cd_Node
.ln_Succ
== NULL
)
101 ReleaseConfigBinding();
105 } /* FindConfigDev */