> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/holoscan/sensor-bridge/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/holoscan/sensor-bridge/_mcp/server.

# hololink::emulation::HSBEmulatorCtxt

> Common, target-invariant per-HSBEmulator context.

Common, target-invariant per-HSBEmulator context.

Each platform defines its own extension struct (LinuxHSBEmulatorCtxt, STM32HSBEmulatorCtxt) with `struct ``HSBEmulatorCtxt`` base` as its first member. Standard-layout C++ guarantees `&ext->base == reinterpret_cast<HSBEmulatorCtxt*>(ext)`, so [HSBEmulator](../classes/hsbemulator) can hold a `HSBEmulatorCtxt*` without knowing the platform extension, and platform code can downcast back via `reinterpret_cast<LinuxHSBEmulatorCtxt*>` (or STM32 equivalent) to reach the platform extras.

Synchronization: `running` is a plain bool. On platforms where [HSBEmulator::start](../classes/hsbemulator#start)/ stop/is\_running may be called from concurrent threads (Linux), the platform extension supplies a mutex that the corresponding platform implementations acquire around every read/write of `running`. STM32 is single-threaded (cooperative loop in main()) so no mutex is needed there.

`AddressMap` capacities are macro-driven (HSB\_CP\_WRITE\_MAP\_SIZE, HSB\_CP\_READ\_MAP\_SIZE) so the same struct definition compiles into a vector-backed map on Linux and a fixed- capacity map on STM32. Defaults at the top of this header match Linux; the STM32 build overrides via CMake compile definitions.

```cpp showLineNumbers={false}
#include <hololink/emulation/hsb_emulator.hpp>
```

---

## Member variables

| Name               | Type                                                        | Description |
| ------------------ | ----------------------------------------------------------- | ----------- |
| `hsb_emulator`     | `HSBEmulator *`                                             |             |
| `register_memory`  | `RegisterMemory`                                            |             |
| `ptp_config`       | `struct PTPConfig`                                          |             |
| `async_event_ctxt` | `struct AsyncEventCtxt`                                     |             |
| `apb_ram_data`     | `uint32_t`                                                  |             |
| `cp_write_map`     | `AddressMap< ControlPlaneCallback, HSB_CP_WRITE_MAP_SIZE >` |             |
| `cp_read_map`      | `AddressMap< ControlPlaneCallback, HSB_CP_READ_MAP_SIZE >`  |             |
| `running`          | `bool`                                                      |             |