Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <html> |
2 | ||
3 | <head> | |
4 | <title>SPARC Architectural Model: Device and Utility API</title> | |
5 | </head> | |
6 | ||
7 | <body bgcolor="#FFFFFF" LANG="en-US"> | |
8 | ||
9 | <h2>Introduction</h2> | |
10 | This document describes the MMI (Module Model Interface) device-model API | |
11 | for the SPARC Architectural Model (SAM). A SAM device model is built as a | |
12 | shared library (loadable module) which is dynamically loaded into SAM during | |
13 | initialization. | |
14 | <p> | |
15 | The <tt>sysconf</tt> directives in the input configuration file specify the device module, instance name and its associated properties. | |
16 | <p> | |
17 | API function and type names are prefixed with <tt>mmi_</tt>. | |
18 | <p> | |
19 | <h4>Attaching Modules</h4> | |
20 | ||
21 | <li> A device-model is typically contained within a shared object (.so file). A shared object typically has only one visible module that plugs into SAM. | |
22 | Internally within the device model, there can be a hierarchy of components (for example, Niagara ethernet module).</li><br> | |
23 | ||
24 | <li>An <i>instance</i> is what actually represents a device in SAM. There are generally multiple instances of a given device module.</li><br> | |
25 | ||
26 | <li> <a href="sysconf.html">The <tt><b>sysconf</b></tt> directive</a> | |
27 | <p><ul> | |
28 | <tt>sysconf</tt> directives are specified in the simulation configuration file. Each sysconf line specifies | |
29 | the module to be loaded if necessary, and the name of the device node to be instantiated. To properly instantiate the device node, | |
30 | SAM calls the instance creator function registered from within the module. | |
31 | </ul> </li> | |
32 | </ul> | |
33 | ||
34 | <h4> The <tt>mmi_instance_t</tt> handle</h4> | |
35 | ||
36 | Each instance can be referred to using an opaque <tt>mmi_instance_t</tt> handle. This includes code referring to its own instance (eg to register certain callback functions) as well as other instances (eg to get an exported interface) | |
37 | ||
38 | <h4>Threading Model </h4> | |
39 | ||
40 | SAM can be run in multi-threaded mode. It is recommended that module developers for SAM | |
41 | assume that simulated SPARCv9 CPUs may be bound to separate host threads, running on different | |
42 | processors on the host machine running the simulation. | |
43 | <p> | |
44 | A strand, however, is never simulated by more than one simulation thread, and | |
45 | when a strand performs a callback to the module it may be assumed that strand | |
46 | execution is stopped at the point of callback. | |
47 | ||
48 | <h4>Module to Module Interaction </h4> | |
49 | ||
50 | Modules may be loaded in any order (as specified in the sysconf file). In some cases, modules may be unloaded at any time. | |
51 | The SAM sysconf mechanism does not allow for device modules to be unloaded but the older <tt>ldm</tt> UI command does allow this. | |
52 | <p> | |
53 | Each module is notified when another module changes status | |
54 | (<a href="mmi_register_config_cb.html">mmi_register_config_cb</a>). | |
55 | <p> | |
56 | Modules may call each other by getting pointers to their interfaces | |
57 | (<a href=" mmi_get_interface.html">mmi_get_interface</a>). | |
58 | When a module is unloaded, other modules should receive the corresponding config change notification | |
59 | and remove their interface pointers to the unloaded module. | |
60 | ||
61 | <p> | |
62 | <hr> | |
63 | </body> | |
64 | ||
65 | </html> |