Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <html> |
2 | <head> | |
3 | <title>SPARC Architectural Model: Device and Utility API</title> | |
4 | </head> | |
5 | <body bgcolor="#FFFFFF" LANG="en-US"> | |
6 | | |
7 | <h2> | |
8 | mmi_get_interface</h2> | |
9 | ||
10 | <h4> | |
11 | NAME</h4> | |
12 | ||
13 | <ul>mmi_get_interface - Get interface pointer by name</ul> | |
14 | ||
15 | <h4> | |
16 | SYNOPSIS</h4> | |
17 | ||
18 | <ul><font color="#0000FF">#include "mmi.h"</font> | |
19 | <p>void * mmi_get_interface (module_t *<i>module</i>, const char *<i>interface_name</i>)</ul> | |
20 | ||
21 | <h4> | |
22 | DESCRIPTION</h4> | |
23 | ||
24 | <ul>Call the interface callback registered by <i>module</i>. | |
25 | If the instance did not register a callback, then call the function registered by its parent module.</ul> | |
26 | ||
27 | <ul>The definition of an interface is an agreement between clients of the interface and the provider. | |
28 | If storage is allocated, the interface must define when it is freed.</ul> | |
29 | ||
30 | <h4> | |
31 | RETURN VALUES</h4> | |
32 | ||
33 | <ul>Returns an interface pointer corresponding to <i>interface_name</i>.</ul> | |
34 | ||
35 | <ul>Returns NULL if: | |
36 | <ul>the <i>module</i> is invalid,</ul> | |
37 | <ul>the <i>module</i> does not support the interface,</ul> | |
38 | <ul>or, the <i>module</i> and its parent did not register a callback.</ul> | |
39 | </ul> | |
40 | ||
41 | <h4> | |
42 | ERRORS</h4> | |
43 | ||
44 | <h4> | |
45 | USAGE</h4> | |
46 | ||
47 | <ul> | |
48 | <pre> | |
49 | <tt> | |
50 | ||
51 | #include "mmi.h" | |
52 | #include "pci.h" | |
53 | ||
54 | // get interface to my PCI bus | |
55 | PciBusIf* | |
56 | ME::get_bus(const char *bus_name) | |
57 | { | |
58 | module_t *bus = mmi_get_module(bus_name); | |
59 | PciBusIf *busif = (PciBusIf*) mmi_get_interface(bus, PCI_BUS_INTERFACE); | |
60 | return busif; | |
61 | } | |
62 | ||
63 | ||
64 | </tt> | |
65 | </pre> | |
66 | </ul> | |
67 | ||
68 | <h4> | |
69 | SEE ALSO</h4> | |
70 | <a href="mmi_register_interface_cb.html">mmi_register_interface_cb</a> | |
71 | <h4> | |
72 | WARNINGS</h4> | |
73 | | |
74 | </body> | |
75 | </html> |