Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / docs / mmi / mmi_get_interface.html
CommitLineData
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&nbsp;
7<h2>
8mmi_get_interface</h2>
9
10<h4>
11NAME</h4>
12
13<ul>mmi_get_interface - Get interface pointer by name</ul>
14
15<h4>
16SYNOPSIS</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>
22DESCRIPTION</h4>
23
24<ul>Call the interface callback registered by <i>module</i>.
25If 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.
28If storage is allocated, the interface must define when it is freed.</ul>
29
30<h4>
31RETURN 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>
42ERRORS</h4>
43
44<h4>
45USAGE</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
55PciBusIf*
56ME::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>
69SEE ALSO</h4>
70&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="mmi_register_interface_cb.html">mmi_register_interface_cb</a>
71<h4>
72WARNINGS</h4>
73&nbsp;
74</body>
75</html>