<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.sub2r.com/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://wiki.sub2r.com/feed.php">
        <title>SUB2r - code</title>
        <description></description>
        <link>https://wiki.sub2r.com/</link>
        <image rdf:resource="https://wiki.sub2r.com/lib/exe/fetch.php/wiki:dokuwiki.svg" />
       <dc:date>2026-05-13T16:06:27+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:cachedglobalstatus_v0x01?rev=1649115121&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:cachedglobalstatus_v0x02?rev=1649115121&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:code?rev=1717772414&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:firmware_versioning_evolution?rev=1712048246&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:fpga_map_gen3_and_4?rev=1708186793&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:fpga_map_gen5?rev=1740453064&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:fpga_registers_map?rev=1708183003&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:fx3_api?rev=1721369471&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:fx3_fpga_api_spec_rex?rev=1708221786&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:fx3_hvci_and_fpga_i_c_commands?rev=1708184986&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:numberformats?rev=1649115122&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:sub2r-lib-2019-04-29?rev=1649115122&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:sub2r-lib-2020-10-08?rev=1649115123&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:sub2r-lib?rev=1662842344&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:sysinfov1?rev=1649115122&amp;do=diff"/>
                <rdf:li rdf:resource="https://wiki.sub2r.com/doku.php/code:sysinfov2?rev=1649115123&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://wiki.sub2r.com/lib/exe/fetch.php/wiki:dokuwiki.svg">
        <title>SUB2r</title>
        <link>https://wiki.sub2r.com/</link>
        <url>https://wiki.sub2r.com/lib/exe/fetch.php/wiki:dokuwiki.svg</url>
    </image>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:cachedglobalstatus_v0x01?rev=1649115121&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-04-04T23:32:01+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>cachedglobalstatus_v0x01</title>
        <link>https://wiki.sub2r.com/doku.php/code:cachedglobalstatus_v0x01?rev=1649115121&amp;do=diff</link>
        <description>CachedGlobalStatus definition for FX3 v.59

// --------------------------------------------
#pragma pack(push, 1)
// --------------------------------------------

typedef struct UvcSelectedMode{
    float           fps;
    UvcFrameGeom    geometry: 2; // just an enum
    UvcFrameFmt     format: 2;   // just an enum
    uint8_t         reserved: 4;
} UvcMode;
C_ASSERT(sizeof(UvcMode) == 5);

typedef union FpgaCtrlReg{
    uint8_t bm;
    struct{
        uint8_t video_en : 1;
        uint8_t audi…</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:cachedglobalstatus_v0x02?rev=1649115121&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-04-04T23:32:01+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>cachedglobalstatus_v0x02</title>
        <link>https://wiki.sub2r.com/doku.php/code:cachedglobalstatus_v0x02?rev=1649115121&amp;do=diff</link>
        <description>CachedGlobalStatus definition for FX3 v.60

// --------------------------------------------
#pragma pack(push, 1)
// --------------------------------------------

// global state of periferals cached in a single place for convenient access from everywhere
// this also allows us to implement API access to &quot;internals&quot; for debugging and monitoring
struct CachedGlobalState{
    uint16_t last_usb_log_idx;          // for drainig the logs out
    bool     force_fan_on_aux_pwr  :1;  // automatically tu…</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:code?rev=1717772414&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-06-07T15:00:14+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>code</title>
        <link>https://wiki.sub2r.com/doku.php/code:code?rev=1717772414&amp;do=diff</link>
        <description>Preface

Controlling the camera is done via writing “registers” - think of them as address locations. There are generally 4 ways to interface with the camera from a host:

	*  standard UVC - this one is automagically supported by any UVC 1.1 compliant OS, which in the year 2017 would be</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:firmware_versioning_evolution?rev=1712048246&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-04-02T08:57:26+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>firmware_versioning_evolution</title>
        <link>https://wiki.sub2r.com/doku.php/code:firmware_versioning_evolution?rev=1712048246&amp;do=diff</link>
        <description>Firmware Versioning evolution

FX3 Version Info

The version id is also encoded into the firmware image file name as:

&lt;VendorID&gt;_&lt;HardwareID&gt;_&lt;ProductID&gt;_&lt;ReleaseType&gt;_&lt;BuildNumber&gt;

FX3 version info C/C++-struct

The FX3 version structure is as follows (little-endian memory layout):</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:fpga_map_gen3_and_4?rev=1708186793&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-02-17T16:19:53+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>fpga_map_gen3_and_4</title>
        <link>https://wiki.sub2r.com/doku.php/code:fpga_map_gen3_and_4?rev=1708186793&amp;do=diff</link>
        <description>FPGA I²C bridge (registers&#039; map)

The following tables provide information on how to access the camera&#039;s functionality for an FPGA I²C bridge.

Here&#039;s a sample code (skipping all error checking) that sets the LED to bright-yellow color:

S2R::FX3 dev; // auto-open device #0
using S2R::FX3;
dev.vrCmd(FX3Cmd::i2c_bridge, VrCmdOpType::write, 255, 0x08); // red
dev.vrCmd(FX3Cmd::i2c_bridge, VrCmdOpType::write, 255, 0x0A); // green
dev.vrCmd(FX3Cmd::i2c_bridge, VrCmdOpType::write, 0, 0x0C);   // blue…</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:fpga_map_gen5?rev=1740453064&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2025-02-25T03:11:04+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>fpga_map_gen5</title>
        <link>https://wiki.sub2r.com/doku.php/code:fpga_map_gen5?rev=1740453064&amp;do=diff</link>
        <description>FPGA I²C bridge (registers&#039; map)

The following tables provide information on how to access the camera&#039;s functionality for an FPGA I²C bridge.

Intel-based FPGA utilizes an Avalon interface bus to facilitate access to FPGA&#039;s “registers”. We have reserved addresses beginning with \(0x5000&#039;0000\)\[
C_{out} = [(C_{in} - {black \space level})] \times Mult + Add \\
\text{where the result of} \space
[(C_{in} - {black \space level})] \space
\text{is 0 if negative}
\]\([0..4095]\)\(1200\)\(1200\)\(1200\…</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:fpga_registers_map?rev=1708183003&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-02-17T15:16:43+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>fpga_registers_map</title>
        <link>https://wiki.sub2r.com/doku.php/code:fpga_registers_map?rev=1708183003&amp;do=diff</link>
        <description>To control FPGA&#039;s functionality a whole lot of registers are defined which are accessible via I2C bus but the method differs drastically in address/data width. Both Xilinx-based Gen 3 and Gen 4 FPGAs are using 8-bit address and data whereas Gen 5 is using Intel&#039;s Avalon bus which is based on 32 bit address and data. The</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:fx3_api?rev=1721369471&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-07-19T06:11:11+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>fx3_api</title>
        <link>https://wiki.sub2r.com/doku.php/code:fx3_api?rev=1721369471&amp;do=diff</link>
        <description>FX3/FPGA API spec

This page describes FX3 API for Frankie (gen3), Rex (gen4), Square1 and Studio (gen5) products.

For gen4 and earlier API see FX3/FPGA API spec up to REX.

FX3 API Reference

The following tables provide information on how to access the camera&#039;s functionality for \(3:0\)\(174\)\(4\)\(7\)\(8\)\(0..4095\)\(0\)\(1\)\(7:0\)\(8\)\(15:0\)\(0\)\(1\)\(7:0\)\(16\)\(8\)\(0\)\(8\)\(8\)\(15:8\)\(8\)\(7:6\)\(5:3\)\(7:0\)\(8\)\(16\)\(32\)\(0\)\(1\)\(2\)\(0x80\)\(0\)\(3\)\(8\)\(0\)\(0\)\(8\)…</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:fx3_fpga_api_spec_rex?rev=1708221786&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-02-18T02:03:06+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>fx3_fpga_api_spec_rex</title>
        <link>https://wiki.sub2r.com/doku.php/code:fx3_fpga_api_spec_rex?rev=1708221786&amp;do=diff</link>
        <description>FX3 API Reference

The following tables provide information on how to access the camera&#039;s functionality for FX3 Host Vendor Command Interface. The address space is split into smaller chunks, grouped by common functionality:

0x00-0x9F
Name Offset wIndex</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:fx3_hvci_and_fpga_i_c_commands?rev=1708184986&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2024-02-17T15:49:46+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>fx3_hvci_and_fpga_i_c_commands</title>
        <link>https://wiki.sub2r.com/doku.php/code:fx3_hvci_and_fpga_i_c_commands?rev=1708184986&amp;do=diff</link>
        <description>FX3/FPGA API spec

FX3 API specification has been moved to this location

FPGA register map specifications have been moved to this location</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:numberformats?rev=1649115122&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-04-04T23:32:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>numberformats</title>
        <link>https://wiki.sub2r.com/doku.php/code:numberformats?rev=1649115122&amp;do=diff</link>
        <description>Number formats used in API

Many numbers do not fit into a single byte [0..255] range and for those there are conventions throughout our API on how to encode them.

BYTE

An 8-bit unsigned or signed value representing a decimal range of [0..255] or [-128..127]</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:sub2r-lib-2019-04-29?rev=1649115122&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-04-04T23:32:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>sub2r-lib-2019-04-29</title>
        <link>https://wiki.sub2r.com/doku.php/code:sub2r-lib-2019-04-29?rev=1649115122&amp;do=diff</link>
        <description>Windows

You can download the library from this location. What you get in this package is:

	*  A header file FX3.h - the only include you need besides the standard headers
	*  Both Release and Debug libraries with full symbol files (.pdb) and support for edit and continue (</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:sub2r-lib-2020-10-08?rev=1649115123&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-04-04T23:32:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>sub2r-lib-2020-10-08</title>
        <link>https://wiki.sub2r.com/doku.php/code:sub2r-lib-2020-10-08?rev=1649115123&amp;do=diff</link>
        <description>Windows

You can download the library from this location. What you get in this package is:

	*  A header file FX3.h - the only include you need besides the standard headers
	*  Both Release and Debug libraries with full symbol files (.pdb) and support for edit and continue (</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:sub2r-lib?rev=1662842344&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-09-10T20:39:04+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>sub2r-lib</title>
        <link>https://wiki.sub2r.com/doku.php/code:sub2r-lib?rev=1662842344&amp;do=diff</link>
        <description>Windows

You can download the library from this location. What you get in this package is:

	*  A header file FX3.h - the only include you need besides the standard headers
	*  Both Release and Debug libraries with full symbol files (.pdb) and support for edit and continue (</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:sysinfov1?rev=1649115122&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-04-04T23:32:02+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>sysinfov1</title>
        <link>https://wiki.sub2r.com/doku.php/code:sysinfov1?rev=1649115122&amp;do=diff</link>
        <description>SysInfo definition for FX3 v.52

// --------------------------------------------
#pragma pack(push, 1)
// --------------------------------------------

struct SysInfoV1{
    struct Sig {
        uint16_t size = {};
        uint8_t maj : 6 = {}; // the size has changed (members added or removed)
        uint8_t min : 2 = {}; // only some bitfields were added that used to be reserved
        uint8_t res : 8 = {};
    };
    struct Supp {
        bool usb3 : 1 = {};   // CyFx3DevIsUsb3Supported();
…</description>
    </item>
    <item rdf:about="https://wiki.sub2r.com/doku.php/code:sysinfov2?rev=1649115123&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-04-04T23:32:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>sysinfov2</title>
        <link>https://wiki.sub2r.com/doku.php/code:sysinfov2?rev=1649115123&amp;do=diff</link>
        <description>SysInfo definition for FX3 v.60

// --------------------------------------------
#pragma pack(push, 1)
// --------------------------------------------

struct SysInfoV2{
    struct Sig {
        uint16_t size = {};
        uint8_t maj : 6 = {}; // the size has changed (members added or removed)
        uint8_t min : 2 = {}; // only some bitfields were added that used to be reserved
        uint8_t res : 8 = {};
    };
    struct Supp {
        bool usb3 : 1 = {};   // CyFx3DevIsUsb3Supported();
…</description>
    </item>
</rdf:RDF>
