Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / docs / mmi / mmi_get_interface.html
<html>
<head>
<title>SPARC Architectural Model: Device and Utility API</title>
</head>
<body bgcolor="#FFFFFF" LANG="en-US">
&nbsp;
<h2>
mmi_get_interface</h2>
<h4>
NAME</h4>
<ul>mmi_get_interface - Get interface pointer by name</ul>
<h4>
SYNOPSIS</h4>
<ul><font color="#0000FF">#include "mmi.h"</font>
<p>void * mmi_get_interface (module_t *<i>module</i>, const char *<i>interface_name</i>)</ul>
<h4>
DESCRIPTION</h4>
<ul>Call the interface callback registered by <i>module</i>.
If the instance did not register a callback, then call the function registered by its parent module.</ul>
<ul>The definition of an interface is an agreement between clients of the interface and the provider.
If storage is allocated, the interface must define when it is freed.</ul>
<h4>
RETURN VALUES</h4>
<ul>Returns an interface pointer corresponding to <i>interface_name</i>.</ul>
<ul>Returns NULL if:
<ul>the <i>module</i> is invalid,</ul>
<ul>the <i>module</i> does not support the interface,</ul>
<ul>or, the <i>module</i> and its parent did not register a callback.</ul>
</ul>
<h4>
ERRORS</h4>
<h4>
USAGE</h4>
<ul>
<pre>
<tt>
#include "mmi.h"
#include "pci.h"
// get interface to my PCI bus
PciBusIf*
ME::get_bus(const char *bus_name)
{
module_t *bus = mmi_get_module(bus_name);
PciBusIf *busif = (PciBusIf*) mmi_get_interface(bus, PCI_BUS_INTERFACE);
return busif;
}
</tt>
</pre>
</ul>
<h4>
SEE ALSO</h4>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="mmi_register_interface_cb.html">mmi_register_interface_cb</a>
<h4>
WARNINGS</h4>
&nbsp;
</body>
</html>