Skip to content

Commit 692e3e3

Browse files
authored
Merge pull request #464 from open-ephys/issue-447
Add version check for onix gateware v2.x
2 parents ffb42be + 3d13e3f commit 692e3e3

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

OpenEphys.Onix1/ContextTask.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ internal ContextTask(string driver, int index)
9494
contextIndex = index;
9595
ctx = new oni.Context(contextDriver, contextIndex);
9696
Initialize();
97+
var (major, _) = GenericHelper.GetFirmwareVersionComponents(GetHub(0).FirmwareVersion);
98+
if (major != 2)
99+
{
100+
throw new NotSupportedException("This library requires version 2.x of the ONIX firmware. "
101+
+ "Please perform a firmware update to use this library. Instructions can be found at "
102+
+ "https://open-ephys.github.io/onix-docs/Hardware%20Guide/PCIe%20Host/updating-firmware.html");
103+
}
97104
}
98105

99106
private void Initialize()

OpenEphys.Onix1/GenericHelper.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,15 @@ public static uint GetHubAddressFromDeviceAddress(uint deviceAddress)
66
{
77
return (deviceAddress & 0xFF00u);
88
}
9+
10+
/// <summary>
11+
/// Gets 8-bit version components from a 16-bit version register value
12+
/// </summary>
13+
/// <param name="version">Register value containing a 16-bit firmware version number.</param>
14+
/// <returns> A tuple containing the 8-bit major and minor version components.</returns>
15+
internal static (byte major, byte minor) GetFirmwareVersionComponents(uint version)
16+
{
17+
return ((byte)((version >> 8) & 0xFF), (byte)(version & 0xFF));
18+
}
919
}
1020
}

0 commit comments

Comments
 (0)