> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-lab-library/opsharedmemoryctrl.md).

# OpSharedMemoryCtrl

## Description

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-1c8786b61b6edae2bd0cb7eb4ea0857d6d8d4909%2FRTL_opshared_memory_ctrl_block.png?alt=media" alt=""><figcaption></figcaption></figure>

The **OpSharedMemoryCtrl** block, located in the **RT-LAB/Communication/SharedMemory** library, opens shared memory in a Master or Slave subsystem to enable communication via physical memory or between processes. Use the OpSharedMemoryRead and OpSharedMemoryWrite blocks to exchange data through the shared memory.

## Mask parameters

<figure><img src="https://96827845-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNRdpSk8kjn20gXAexnt6%2Fuploads%2Fgit-blob-f260f0fb32ebea30d7d554463ac9f7661a95350b%2FRTL_opshared_memory_ctrl_mask.png?alt=media" alt="" width="317"><figcaption></figcaption></figure>

<table><thead><tr><th width="267.39996337890625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><strong>Controller ID</strong></td><td>Specifies the controller ID associated with the read and write blocks.</td></tr><tr><td><strong>Shared memory base address</strong></td><td>Specifies the memory base address of a physical card (ISA, PCI, or internal onboard device). Available only when <em>Shared memory type</em> is set to Physical. Enter a hexadecimal value (e.g., 0xd4000).</td></tr><tr><td><strong>Shared memory range</strong></td><td>Specifies the size of the memory allocation on the computer. Enter a hexadecimal value (e.g., 0x1000). On Linux, the maximum is 0x400000.</td></tr><tr><td><strong>Shared memory offset</strong></td><td>Specifies the number of address locations added to the base address to obtain the actual starting memory address controlled by the block. Enter a hexadecimal value (e.g., 0x100).</td></tr><tr><td><strong>Shared memory type</strong></td><td>Select Physical to use a physical device such as a card (ISA, PCI, or internal onboard device). This option is used for dual-port memory devices and can be used to communicate with any card. Select Custom to communicate with other processes on the computer using shared memory. When Custom is selected, specify a <em>Shared memory object name</em>. If the object does not exist, select <em>Create object</em>.</td></tr><tr><td><strong>Create object</strong></td><td>Indicates whether this controller creates the shared memory object or only uses an existing one. Do not select this option if another process has already created the shared memory. Not available when using physical devices.</td></tr><tr><td><strong>Shared memory object name</strong></td><td>Specifies the name of the shared memory object to create or access (e.g., test). Not available when using physical devices.</td></tr><tr><td><strong>Memory byte ordering</strong></td><td>Specifies little-endian or big-endian compatibility with the physical device. The x86 architecture is little-endian.</td></tr><tr><td><strong>Medium type</strong></td><td>Select ISA, PCI, or Internal device. For PCI, also specify the Vendor ID, Device ID, PCI index, and base address register. The Internal option targets onboard devices. Not available when <em>Shared memory type</em> is set to Custom.</td></tr><tr><td><strong>PCI Vendor ID</strong></td><td>Specifies the vendor ID of the PCI card that holds the shared memory (e.g., 0x8086). On OPAL-RTLinux, use the command 'lspci -n' to identify the vendor ID.</td></tr><tr><td><strong>PCI Device ID</strong></td><td>Specifies the device ID of the PCI card that holds the shared memory (e.g., 0x7146). On OPAL-RTLinux, use the command 'lspci -n' to identify the device ID.</td></tr><tr><td><strong>PCI Index</strong></td><td>Specifies the PCI index of the card that holds the shared memory (e.g., 0).</td></tr><tr><td><strong>PCI Base Address Register</strong></td><td>Specifies the index of the PCI base address register to use (e.g., 0). This register holds the physical address of the card's I/O memory.</td></tr></tbody></table>

{% hint style="info" %}
PCI options are only valid when using a PCI medium type.
{% endhint %}

## Inputs

This block has no inputs.

## Outputs

This block has no outputs.

## Characteristics and limitations

<table><thead><tr><th width="241.7999267578125">Characteristic</th><th>Value</th></tr></thead><tbody><tr><td>DMA transfer</td><td>If this block is used with one VMIC 5565 card, DMA transfer is used unless the environment variable 'SHARE_MEM_NO_DMA' is set.</td></tr><tr><td>Direct Feedthrough</td><td>N/A</td></tr><tr><td>Discrete sample time</td><td>Yes</td></tr><tr><td>XHP support</td><td>Yes</td></tr><tr><td>Work offline</td><td>No</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.opal-rt.com/docs/rt-lab/simulink-blocks-reference/rt-lab-library/opsharedmemoryctrl.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
