File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ public class ContextTask : IDisposable
7676 readonly string contextDriver = DefaultDriver ;
7777 readonly int contextIndex = DefaultIndex ;
7878
79+ private oni . Hub controllerHub ;
80+
7981 /// <summary>
8082 /// Initializes a new instance of the <see cref="ContextTask"/> class.
8183 /// </summary>
@@ -94,6 +96,15 @@ internal ContextTask(string driver, int index)
9496 contextIndex = index ;
9597 ctx = new oni . Context ( contextDriver , contextIndex ) ;
9698 Initialize ( ) ;
99+ controllerHub = GetHub ( 0 ) ;
100+ uint versionMajor ;
101+ GenericHelper . GetVersionComponents ( controllerHub . FirmwareVersion , out versionMajor , out _ ) ;
102+ if ( versionMajor != 2 )
103+ {
104+ throw new NotSupportedException ( "This library requires version 2.x of the ONIX firmware."
105+ + "Please update it. Instructions can be found in "
106+ + "https://open-ephys.github.io/onix-docs/Hardware%20Guide/PCIe%20Host/updating-firmware.html" ) ;
107+ }
97108 }
98109
99110 private void Initialize ( )
Original file line number Diff line number Diff line change @@ -6,5 +6,17 @@ public static uint GetHubAddressFromDeviceAddress(uint deviceAddress)
66 {
77 return ( deviceAddress & 0xFF00u ) ;
88 }
9+
10+ /// <summary>
11+ /// Gets the version components from a 16-bit version register value
12+ /// </summary>
13+ /// <param name="rawVersion">Raw 16-bit version</param>
14+ /// <param name="major">Contains the major component extracted from <paramref name="rawVersion"/></param>
15+ /// <param name="minor">Contains the minor component extracted from <paramref name="rawVersion"/></param>
16+ public static void GetVersionComponents ( uint rawVersion , out uint major , out uint minor )
17+ {
18+ major = ( rawVersion >> 8 ) & 0xFF ;
19+ minor = rawVersion & 0xFF ;
20+ }
921 }
1022}
You can’t perform that action at this time.
0 commit comments