Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oni v2 #68

Draft
wants to merge 50 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
92b97cd
Draft for version 2 of the ONI spec
aacuevas Nov 8, 2024
82ebd1f
Fix titles
aacuevas Nov 11, 2024
df3f95f
Add address space overview
aacuevas Nov 11, 2024
bf79fac
Merge pull request #32 from open-ephys/oni-v2-draft
aacuevas Nov 15, 2024
4b832f5
Rewrite channel access concurrency description
aacuevas Nov 18, 2024
b6d1a3e
Split device page
aacuevas Nov 18, 2024
b5d42eb
Remove grammatically erroneous commas
aacuevas Nov 18, 2024
8cff1f1
Merge pull request #45 from open-ephys/issue-35
aacuevas Nov 18, 2024
ac96c87
Remove special devices section from hubs
aacuevas Nov 18, 2024
d66d17e
Fix duplicate sections and text
jonnew Nov 18, 2024
64c6d2d
Merge branch 'oni-v2' into remove-duplate-special-devs
aacuevas Nov 18, 2024
b513c8f
Merge pull request #48 from open-ephys/remove-duplate-special-devs
aacuevas Nov 18, 2024
d1deb05
Clarify text for hub clocks
aacuevas Nov 19, 2024
f73121d
Update text related to hub clocks
aacuevas Nov 19, 2024
6c83557
Update device sample definitions
aacuevas Nov 19, 2024
4a5951f
Clarify text for concurrent access
aacuevas Nov 19, 2024
7649f1d
Merge pull request #43 from open-ephys/issue-41
aacuevas Nov 19, 2024
ab049f4
Manually "rebase" branches issue-1 and issue-3 on oni-v2
jonnew Nov 19, 2024
36293e5
Merge pull request #50 from open-ephys/issue-37
aacuevas Nov 19, 2024
6e71677
Address review comments
jonnew Nov 20, 2024
e4c3b1f
Merge branch 'oni-v2' into issue-1-and-3
aacuevas Nov 21, 2024
5817cd1
Merge pull request #54 from open-ephys/issue-1-and-3
aacuevas Nov 21, 2024
3ccb538
Merge branch 'oni-v2' into issue-51
aacuevas Nov 21, 2024
f360f38
Merge branch 'oni-v2' into issue-51
aacuevas Nov 21, 2024
fe8d932
Address review comments
aacuevas Nov 21, 2024
d4a3505
Update data frame format to C-style
aacuevas Nov 21, 2024
1205c60
Clarify acquisition counter definition
aacuevas Nov 21, 2024
64db2cd
Merge pull request #53 from open-ephys/issue-51
jonnew Nov 21, 2024
47e6316
Reference network topology on hierarchy page
jonnew Nov 21, 2024
578bbed
Merge pull request #58 from open-ephys/issue-34
aacuevas Nov 21, 2024
09f0b1c
Address review comments
aacuevas Nov 21, 2024
4c629d5
Clarify the meaning of the Trigger register
jonnew Nov 21, 2024
3cb24c0
Merge pull request #57 from open-ephys/issues-55-and-56
jonnew Nov 22, 2024
67c64ac
Improve register maps
aacuevas Nov 22, 2024
b2790f4
Merge branch 'oni-v2' into issues-40-42
aacuevas Nov 22, 2024
a936555
Add link to latency register in acquisition counter admonition
aacuevas Nov 22, 2024
2f54f2b
Reword device channel list
aacuevas Nov 22, 2024
05d507c
Clarify register description
aacuevas Nov 22, 2024
242e21c
Address review on addresses.rst
aacuevas Nov 22, 2024
b5f21e1
Address review comments
jonnew Nov 25, 2024
e7c838f
Merge pull request #59 from open-ephys/issue-52
jonnew Nov 25, 2024
693b0c9
Address further reviews to issues-40-42
aacuevas Nov 25, 2024
3420184
Merge pull request #63 from open-ephys/issue-46
aacuevas Nov 25, 2024
b423c29
Address reviews in issue 39
aacuevas Nov 25, 2024
abb34ad
Merge pull request #64 from open-ephys/issue-39
aacuevas Nov 25, 2024
d581dda
Merge pull request #61 from open-ephys/issues-40-42
aacuevas Nov 25, 2024
2e981eb
Merge branch 'main' into oni-v2
bparks13 Jan 13, 2025
8e54020
Style pass: All titles must be camel case
bparks13 Jan 21, 2025
bb277b4
Style pass: read/write
bparks13 Jan 21, 2025
f7b42a3
Style pass: grammar, spelling, formatting, etc.
bparks13 Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@
<parametername><ref refid="classoni_1_1_o_n_i_exception" kindref="compound">ONIException</ref></parametername>
</parameternamelist>
<parameterdescription>
<para>Thrown when there is an error during hardware initialization (e.g. an invalid device table).</para>
<para>Thrown when there is an error during hardware initialization (e.g., an invalid device table).</para>
</parameterdescription>
</parameteritem>
</parameterlist>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<argsstring></argsstring>
<name>HardwareID</name>
<briefdescription>
<para>ONIX hub hardware ID (e.g. host or headstage type). </para>
<para>ONIX hub hardware ID (e.g., host or headstage type). </para>
</briefdescription>
<detaileddescription>
</detaileddescription>
Expand Down
34 changes: 17 additions & 17 deletions source/api/liboni/liboni-example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ bandwidths, and required response latencies. The buffer sizes default to the
minimum size for a given device table (the maximum frame read and write sizes
across devices in the table aligned to the bus width of hardware communication
link). This provides the lowest latency, but is optimal only for very low
bandwidth acquisition and deterministic and low-latency threads (e.g. those
bandwidth acquisition and deterministic and low-latency threads (e.g., those
found on real-time operating system). On a normal computer, these buffers can
be set manually to optimize the bandwidth/latency trade off. For example, to
set the buffer read and write sizes to 1024 and 8192 bytes respectively, use
Expand Down Expand Up @@ -255,23 +255,23 @@ Reading Data Frames
********************************************
:struct:`oni_frame_t`'s are minimal packets containing metadata and raw binary
data blocks from a single device within the device table. A
:struct:`oni_size_t` is defined as
:struct:`oni_frame_t` is defined as

.. code-block:: c

struct oni_frame {
const uint64_t dev_idx; // Device index that produced or accepts the frame
const uint32_t data_sz; // Size in bytes of data buffer
const uint64_t time; // Frame time (ACQCLKHZ)
uint8_t *data; // Raw data block
struct oni_frame_t {
const oni_size_t dev_idx; // Device index that produced or accepts the frame
const oni_size_t data_sz; // Size in bytes of data buffer
const oni_counter_t acqclk_cnt; // Acquisition clock (ACQCLKHZ) count at frame creation
uint8_t *data; // Raw data block
};

where ``dev_idx`` is the fully qualified device index within the device table
(hub.index), ``data_sz`` is the size in bytes of the raw data block, ``time``
is the system clock count that indicates the frame creation time, and, ``data``
is a pointer to the raw data block. A single frame can be read from an
acquisition context after it is started (see :ref:`start_ctx`) using repeated
calls to ``oni_read_frame`` as follows:
(hub.index), ``data_sz`` is the size in bytes of the raw data block,
``acqclk_cnt`` is the acquisition clock count that indicates the frame creation
time, and, ``data`` is a pointer to the raw data block. A single frame can be
read from an acquisition context after it is started (see :ref:`start_ctx`)
using repeated calls to ``oni_read_frame`` as follows:

.. code-block:: c

Expand Down Expand Up @@ -310,9 +310,9 @@ steps to reading frames.

// Required elements to create frame
oni_frame_t *frame = NULL;
size_t dev_idx = 256;
size_t data_sz = 8; // or 16, 24, 32, etc
char data[] = {0, 1, 2, 3, 4, 5, 6, 7};
const size_t dev_idx = 256;
const size_t data_sz = 8; // Multiple of write size presented in device table
char data[] = {0, 1, 2, 3, 4, 5, 6, 7}; // Must be data_sz bytes long

// Create a frame
oni_create_frame(ctx, &frame, dev_idx, data, data_sz);
Expand All @@ -324,8 +324,8 @@ steps to reading frames.
oni_destroy_frame(frame);

First, a frame is created using a call to ``oni_create_frame`` (analogous to
``oni_read_frame``, except that frame data is provided by the user instead of
the hardware). In the preceding example, it is assumed that the user has
``oni_read_frame``, except that frame data is provided by the caller instead of
the hardware). In the preceding example, it is assumed that the caller has
queried the device table to ensure that the device with qualified index 256 is
writable and has a write size of 8 bytes. If the device at ``dev_idx`` does not
accept writes or ``data``/``data_sz`` are not a multiple of the device write
Expand Down
21 changes: 10 additions & 11 deletions source/api/liboni/oni.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,23 @@ Frame
---------------------------------------
.. struct:: oni_frame_t

.. member:: const oni_fifo_time_t time

Frame time (:macro:`ONI_OPT_ACQCLKHZ` host clock counter).

.. member:: const oni_fifo_dat_t dev_idx
.. member:: const oni_size_t dev_idx

Device index that produced or accepts the frame.

.. member:: const oni_counter_t acqclk_cnt

Acquisition clock (:macro:`ONI_OPT_ACQCLKHZ`) count at the time
of frame creation.

.. member:: const oni_fifo_dat_t data_sz

Size of data in bytes.

.. member:: uint8_t *data

Raw data block. This pointer is a zero-copy "view" into a private,
referenced-counted buffer managed by the acquisition context. The
handle to this buffer is hidden by the API using some C ``union``
magic.
Pointer to a ``data_sz``-byte continuous data block.

An ONI-compliant data frame implementation. :struct:`oni_frame_t`'s are
produced by calls to :func:`oni_read_frame` and consumed by calls to
Expand Down Expand Up @@ -324,7 +323,7 @@ needed during the development of user-facing software.

Change the value of a configuration register from specific devices within
the current device table. This can be used to change the functionality of
devices, e.g. set filter bandwidth, select active channels, or change
devices, e.g., set filter bandwidth, select active channels, or change
stimulation parameters. Register specifications (addresses, read- and
write-access, acceptable values, and descriptions) are provided on the
:ref:`ONI-device datasheet <dev-datasheet>`.
Expand All @@ -346,7 +345,7 @@ needed during the development of user-facing software.
:ref:`liboni_example_set_buffers`). :struct:`oni_frame_t`'s created during
calls to :func:`oni_read_frame` are zero-copy views into this buffer.

.. attention:: It is the user's responsibility to free the resources allocated by
.. attention:: It is the caller's responsibility to free the resources allocated by
this call by passing the resulting frame pointer to
:func:`oni_destroy_frame`.

Expand All @@ -360,7 +359,7 @@ needed during the development of user-facing software.

Create an :struct:`oni_frame_t` for consumption by :func:`oni_write_frame`.

.. attention:: It is the user's responsibility to free the resources allocated by
.. attention:: It is the caller's responsibility to free the resources allocated by
this call by passing the resulting frame pointer to
:func:`oni_destroy_frame`

Expand Down
11 changes: 2 additions & 9 deletions source/api/liboni/onidefs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ Macro and constant definitions common to both :ref:`oni.h` and :ref:`onidriver.h
Integer Types
---------------------------------------

.. warning:: All of these types will be almost certainly be deprecated in
future API revisions to handle drivers with different channel bit widths.

.. type:: uint32_t oni_size_t

Data sizes are 32-bit uints.
Expand All @@ -33,13 +30,9 @@ Integer Types

Registers have 32-bit values.

.. type:: uint32_t oni_fifo_dat_t

FIFOs use 32-bit words.

.. type:: uint64_t oni_fifo_time_t
.. type:: uint64_t oni_counter_t

FIFO bound timers use 64-bit words.
Counters use 64-bit words.

.. _onidef_context_options:

Expand Down
4 changes: 2 additions & 2 deletions source/api/liboni/onix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ ONI specification and are not required to use the API.
.. attention:: Many of the devices in this enumeration have no ready-made route
to use in high-level software. This is true for a variety of reasons. For
instance, they may be prototype hardware or test fixture that we wish to
maintain for backward compatibility (e.g. :macro:`ONIX_TESTREG0`). Or, they
may be a low level device (e.g. :macro:`ONIX_AD7617`) that is used in the
maintain for backward compatibility (e.g., :macro:`ONIX_TESTREG0`). Or, they
may be a low level device (e.g., :macro:`ONIX_AD7617`) that is used in the
background by other, higher order devices in the list (e.g.
:macro:`ONIX_FMCANALOG1R3`).

Expand Down
15 changes: 10 additions & 5 deletions source/hw-spec/comm_channels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ the system:
:Write: Streams that transmit data to a device from the host computer.

Register Channel
A synchronous, bidirectional, N-bit, addressed digital bus. Each address is
a 32-bit value. Registers can be Read-only, Write-only or Read-Write. This
channel also has signals to indicate a successful or failed completion of a
register access operation. (e.g., An access to an non-existent address or a
non-allowed operation will return an error.)
A synchronous, bidirectional, addressed digital bus to access :term:`registers<Register>`.
Registers can be Read-only, Write-only or Read/Write. Channels of this type
MUST indicate a successful or failed completion of a register access operation.
(e.g., an access to a non-existent address or a non-allowed operation will signal an error.)

.. note:: Both the controller and the devices can hold registers. Controller registers are
arranged in a fixed :ref:`address map<addresses>` and accessed through the
:ref:`configuration channel<conf-chan>`. :ref:`Device registers<dev-register>`
follow the address map defined on each device :ref:`datasheet<dev-datasheet>`
and are accessed through the :ref:`device register interface<register_interface>`.

Loading