# analogdevicesinc/pyadi-iio architecture

> Architecture diagram of the GitHub repository analogdevicesinc/pyadi-iio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/analogdevicesinc/pyadi-iio
- Repository: https://github.com/analogdevicesinc/pyadi-iio

## Overview

#### Purpose and Public Entry Point
PyADI-IIO is a Python library that simplifies control and data capture for Analog Devices hardware exposed through Industrial I/O (IIO) drivers. Users import `adi` and instantiate a device class with a libiio URI, then use device-specific properties plus RX/TX methods. Package entry surface: `adi/__init__.py`; representative device APIs: `adi/ad936x.py`, `adi/ad9081.py`, `adi/adrv9002.py`.

#### Transport and Context Boundary
libiio and its Python bindings are the fundamental external runtime dependency; NumPy carries sample arrays. Device instances obtain an IIO context from a URI (local, network, or other libiio-supported transport), isolating hardware discovery and connection lifecycle from device-facing APIs. Context reuse/lifecycle infrastructure is centered in `adi/context_manager.py` and `adi/device_base.py`; compatibility handling is in `adi/compat.py`.

#### Shared Device Abstractions
`adi/device_base.py` is the common layer beneath part-specific classes, providing the foundation for IIO device/channel lookup and configuration. `adi/attribute.py` maps Python properties to IIO attributes, creating the principal control-plane boundary: Python property reads/writes become libiio attribute operations. `adi/rx_tx.py` supplies common streaming behavior for devices that acquire or transmit samples.

#### Device and Board Facades
The `adi/` package contains the primary implementation: per-part classes expose hardware-specific configuration while composing shared abstractions. This covers converters, RF transceivers, sensors, clocks, and complete development platforms. Board/system facades coordinate multiple underlying IIO devices, for example `adi/daq3.py`, `adi/fmcomms5.py`, and `adi/QuadMxFE_multi.py`. The public class layer is intentionally hardware-oriented rather than a generic service or web API.

#### Streaming, FPGA, and Synchronization Features
Data-plane operations flow from configured IIO channels through libiio buffers into NumPy arrays, and reverse for transmission. Advanced FPGA-connected systems add DMA, DDS, JESD, triggering, timing, and synchronized start controls. Core modules are `adi/dsp.py`, `adi/dds.py`, `adi/jesd.py`, `adi/sync_start.py`, `adi/tdd.py`, and `adi/axi_aion_trig.py`. These form a higher-level coordination layer over IIO-exposed FPGA IP and device channels.

#### Optional Integrations and Runtime Services
The package includes utilities for remote mounting and device-adjacent control (`adi/sshfs.py`, `adi/obs.py`) plus an MCP server integration (`adi/mcp_server.py`). JESD debugging is an optional package extra. Example programs are executable consumer entry points demonstrating connection, configuration, and capture workflows, e.g. `examples/ad9361_example.py`, `examples/ad9081_dma_example.py`, and `examples/adrv9002_example.py`.

#### Verification and Delivery Boundaries
Most verification can run against libiio emulator device descriptions, separating interface behavior from physical hardware: `test/emu/devices/`, `test/conftest.py`, and `test/attr_tests.py`. A separate physical-board smoke-test tier exists under `test/hw/`, driven by hardware CI workflows such as `.github/workflows/hardware-test.yml`; board inventory is maintained in `.github/supported-boards.yml`. Packaging is Python/PyPI-oriented through `pyproject.toml` and `setup.cfg`; Sphinx documentation is sourced from `doc/source/`.

Main entry points: [`adi/ad936x.py`](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/ad936x.py) (Part-specific devices), [`adi/__init__.py`](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/__init__.py) (adi package entry), [`adi/rx_tx.py`](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/rx_tx.py) (RX/TX streaming), [`adi/device_base.py`](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/device_base.py) (Device base)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Python API"]
  node_public["adi package entry<br/>public API<br/>[__init__.py]"]
  node_device_classes["Part-specific devices<br/>device APIs<br/>[ad936x.py]"]
  node_board_facades["Board/system facades<br/>multi-device APIs<br/>[daq3.py]"]
  node_examples["Example programs<br/>consumer entry points<br/>[ad9361_example.py]"]
end

subgraph group_core["Shared runtime"]
  node_device_base["Device base<br/>shared abstraction<br/>[device_base.py]"]
  node_context["Context manager<br/>connection lifecycle<br/>[context_manager.py]"]
  node_attributes["Attribute mapping<br/>control plane<br/>[attribute.py]"]
  node_streaming["RX/TX streaming<br/>data plane<br/>[rx_tx.py]"]
  node_compat["Compatibility layer<br/>runtime compatibility<br/>[compat.py]"]
end

subgraph group_hardware["IIO hardware boundary"]
  node_libiio{{"libiio context &amp; buffers<br/>external dependency"}}
  node_numpy{{"NumPy arrays<br/>external dependency"}}
  node_iio_devices{{"IIO devices &amp; FPGA IP<br/>hardware endpoint"}}
end

subgraph group_advanced["FPGA coordination"]
  node_fpga_controls["FPGA control modules<br/>coordination layer<br/>[dsp.py]"]
  node_remote_services["Remote &amp; MCP services<br/>optional integrations<br/>[mcp_server.py]"]
end

subgraph group_quality["Verification &amp; delivery"]
  node_emulator_tests["Emulator tests<br/>verification tier<br/>[adrv9361-z7035.xml]"]
  node_hardware_tests["Physical-board smoke tests<br/>verification tier"]
  node_hardware_ci["Hardware CI workflow<br/>automation<br/>[hardware-test.yml]"]
  node_packaging["PyPI packaging<br/>delivery<br/>[pyproject.toml]"]
  node_documentation["Sphinx documentation<br/>[index.rst]"]
end

node_public -->|"exports"| node_device_classes
node_public -->|"exports"| node_board_facades
node_examples -->|"imports"| node_public
node_device_classes -->|"extends"| node_device_base
node_board_facades -->|"composes"| node_device_classes
node_device_base -->|"uses"| node_context
node_device_classes -->|"configures through"| node_attributes
node_device_classes -->|"uses"| node_streaming
node_context -->|"opens URI context"| node_libiio
node_attributes -->|"attribute I/O"| node_libiio
node_streaming -->|"buffer I/O"| node_libiio
node_streaming -->|"reads/writes"| node_numpy
node_libiio -->|"connects to"| node_iio_devices
node_fpga_controls -->|"builds on"| node_device_base
node_fpga_controls -->|"coordinates"| node_iio_devices
node_remote_services -.->|"integrates with"| node_device_classes
node_emulator_tests -->|"verifies"| node_device_classes
node_emulator_tests -->|"uses emulator"| node_libiio
node_hardware_tests -->|"smoke tests"| node_iio_devices
node_hardware_ci -->|"runs"| node_hardware_tests
node_packaging -->|"packages"| node_public
node_documentation -.->|"documents"| node_public

click node_public "https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/__init__.py"
click node_device_classes "https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/ad936x.py"
click node_board_facades "https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/daq3.py"
click node_examples "https://github.com/analogdevicesinc/pyadi-iio/blob/main/examples/ad9361_example.py"
click node_device_base "https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/device_base.py"
click node_context "https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/context_manager.py"
click node_attributes "https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/attribute.py"
click node_streaming "https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/rx_tx.py"
click node_compat "https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/compat.py"
click node_fpga_controls "https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/dsp.py"
click node_remote_services "https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/mcp_server.py"
click node_emulator_tests "https://github.com/analogdevicesinc/pyadi-iio/blob/main/test/emu/devices/adrv9361-z7035.xml"
click node_hardware_tests "https://github.com/analogdevicesinc/pyadi-iio/blob/main/test/hw/test_ad9081_smoke.py"
click node_hardware_ci "https://github.com/analogdevicesinc/pyadi-iio/blob/main/.github/workflows/hardware-test.yml"
click node_packaging "https://github.com/analogdevicesinc/pyadi-iio/blob/main/pyproject.toml"
click node_documentation "https://github.com/analogdevicesinc/pyadi-iio/blob/main/doc/source/index.rst"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_public,node_device_classes,node_board_facades,node_examples toneBlue
class node_device_base,node_context,node_attributes,node_streaming,node_compat toneAmber
class node_libiio,node_numpy,node_iio_devices toneMint
class node_fpga_controls,node_remote_services toneRose
class node_emulator_tests,node_hardware_tests,node_hardware_ci,node_packaging,node_documentation toneIndigo
```

## Components

### Python API

- [adi package entry](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/__init__.py): public API · Users import device classes from this package. · `adi/__init__.py`
- [Part-specific devices](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/ad936x.py): device APIs · Hardware-oriented configuration and RX/TX facades. · `adi/ad936x.py`
- [Board/system facades](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/daq3.py): multi-device APIs · Coordinate multiple underlying IIO devices. · `adi/daq3.py`
- [Example programs](https://github.com/analogdevicesinc/pyadi-iio/blob/main/examples/ad9361_example.py): consumer entry points · Demonstrate connection, configuration, and capture. · `examples/ad9361_example.py`

### Shared runtime

- [Device base](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/device_base.py): shared abstraction · Provides IIO device and channel lookup foundations. · `adi/device_base.py`
- [Context manager](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/context_manager.py): connection lifecycle · Creates and reuses IIO contexts from URIs. · `adi/context_manager.py`
- [Attribute mapping](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/attribute.py): control plane · Maps Python properties to IIO attribute operations. · `adi/attribute.py`
- [RX/TX streaming](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/rx_tx.py): data plane · Common sample acquisition and transmission behavior. · `adi/rx_tx.py`
- [Compatibility layer](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/compat.py): runtime compatibility · `adi/compat.py`

### IIO hardware boundary

- **libiio context & buffers**: external dependency · Discovers hardware, performs attribute I/O, and moves stream buffers.
- **NumPy arrays**: external dependency · Carries received and transmitted sample arrays.
- **IIO devices & FPGA IP**: hardware endpoint · IIO drivers expose converter channels and FPGA controls.

### FPGA coordination

- [FPGA control modules](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/dsp.py): coordination layer · DMA, DDS, JESD, triggering, timing, and synchronized start controls. · `adi/dsp.py`
- [Remote & MCP services](https://github.com/analogdevicesinc/pyadi-iio/blob/main/adi/mcp_server.py): optional integrations · Remote mounting, device-adjacent control, and MCP integration. · `adi/mcp_server.py`

### Verification & delivery

- [Emulator tests](https://github.com/analogdevicesinc/pyadi-iio/blob/main/test/emu/devices/adrv9361-z7035.xml): verification tier · Validate interfaces against libiio emulator descriptions. · `test/emu/devices/adrv9361-z7035.xml`
- [Physical-board smoke tests](https://github.com/analogdevicesinc/pyadi-iio/blob/main/test/hw/test_ad9081_smoke.py): verification tier · Exercise supported boards through hardware CI. · `test/hw/test_ad9081_smoke.py`
- [Hardware CI workflow](https://github.com/analogdevicesinc/pyadi-iio/blob/main/.github/workflows/hardware-test.yml): automation · `.github/workflows/hardware-test.yml`
- [PyPI packaging](https://github.com/analogdevicesinc/pyadi-iio/blob/main/pyproject.toml): delivery · `pyproject.toml`
- [Sphinx documentation](https://github.com/analogdevicesinc/pyadi-iio/blob/main/doc/source/index.rst): documentation · `doc/source/index.rst`

## Connections

- adi package entry → Part-specific devices: exports
- adi package entry → Board/system facades: exports
- Example programs → adi package entry: imports
- Part-specific devices → Device base: extends
- Board/system facades → Part-specific devices: composes
- Device base → Context manager: uses
- Part-specific devices → Attribute mapping: configures through
- Part-specific devices → RX/TX streaming: uses
- Context manager → libiio context & buffers: opens URI context
- Attribute mapping → libiio context & buffers: attribute I/O
- RX/TX streaming → libiio context & buffers: buffer I/O
- RX/TX streaming → NumPy arrays: reads/writes
- libiio context & buffers → IIO devices & FPGA IP: connects to
- FPGA control modules → Device base: builds on
- FPGA control modules → IIO devices & FPGA IP: coordinates
- Remote & MCP services → Part-specific devices: integrates with
- Emulator tests → Part-specific devices: verifies
- Emulator tests → libiio context & buffers: uses emulator
- Physical-board smoke tests → IIO devices & FPGA IP: smoke tests
- Hardware CI workflow → Physical-board smoke tests: runs
- PyPI packaging → adi package entry: packages
- Sphinx documentation → adi package entry: documents
