| 1 | <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> |
| 2 | <html> |
| 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>mmi_map_physio</h2> |
| 10 | |
| 11 | <h4>NAME</h4> |
| 12 | |
| 13 | <ul><i>mmi_map_physio()</i> - Add mapping for module in I/O space</ul> |
| 14 | |
| 15 | <h4>SYNOPSIS</h4> |
| 16 | |
| 17 | <ul><tt> |
| 18 | <font color="#0000FF">#include "mmi.h"</font> |
| 19 | <p>typedef int (*<i>mmi_access</i>) |
| 20 | <br> |
| 21 | (uint32_t <i>cpu_id</i>, void* <i>obj</i>, uint64_t <i>paddr</i>, |
| 22 | bool_t <i>wr</i>, uint32_t <i>size</i>, uint64_t* <i>buf</i>, uint8_t <i>bytemask</i>) |
| 23 | <p>int mmi_map_physio (uint64_t <i>base</i>, uint64_t <i>size</i>, void* <i>obj</i>, mmi_access <i>access</i>) |
| 24 | </tt></ul> |
| 25 | |
| 26 | <h4> |
| 27 | DESCRIPTION</h4> |
| 28 | |
| 29 | <ul>Creates a mapping for <i>obj</i> at <i>base</i> for <i>size</i> bytes.</ul> |
| 30 | <ul>CPU I/O space accesses in this range call <i>access</i>, with <i>obj</i> and parameters for the I/O access.</ul> |
| 31 | |
| 32 | <h4>RETURN VALUES</h4> |
| 33 | |
| 34 | <ul>Returns true if successful.</ul> |
| 35 | |
| 36 | |
| 37 | <h4> USAGE EXAMPLE</h4> |
| 38 | <ul> |
| 39 | <pre> |
| 40 | static int |
| 41 | sgc_access(uint32_t cpu_id, void* obj, uint64_t paddr, bool_t wr, uint32_t size, uint64_t* buf) |
| 42 | { |
| 43 | SerengetiConsole* s = (SerengetiConsole*) obj; |
| 44 | return s->access(cpu_id, obj, paddr, wr, size, buf); |
| 45 | } |
| 46 | |
| 47 | SerengetiConsole::SerengetiConsole() |
| 48 | { |
| 49 | mmi_map_physio(0x7fff0000000ULL, 0x10000000ULL, this, sgc_access); |
| 50 | } |
| 51 | |
| 52 | </pre> |
| 53 | </ul> |
| 54 | |
| 55 | <h4>SEE ALSO</h4> |
| 56 | <ul><a href="intro.html">Introduction</a></ul> |
| 57 | |
| 58 | <p> |
| 59 | <hr> |
| 60 | |
| 61 | |
| 62 | </body> |
| 63 | </html> |