diff --git a/OpenEphys.Onix1/ConfigurePortController.cs b/OpenEphys.Onix1/ConfigurePortController.cs index faf60bc..8add928 100644 --- a/OpenEphys.Onix1/ConfigurePortController.cs +++ b/OpenEphys.Onix1/ConfigurePortController.cs @@ -53,7 +53,7 @@ public override IObservable Process(IObservable source context.HubState = (PassthroughState)(((int)context.HubState & ~(1 << portShift)) | passthroughState); // leave in standard mode when finished - return Disposable.Create(() => context.HubState = (PassthroughState)((int)context.HubState & ~(1 << portShift))); + return Disposable.Create(() => context.HubState = (PassthroughState)((int)context.HubState & ~(1 << portShift))); }) .ConfigureLink(context => { @@ -76,7 +76,7 @@ public override IObservable Process(IObservable source } return Disposable.Create(dispose); }) - .ConfigureDevice(context => + .ConfigureDevice(context => { var deviceInfo = new DeviceInfo(context, DeviceType, deviceAddress); return DeviceManager.RegisterDevice(deviceName, deviceInfo); @@ -117,36 +117,50 @@ internal enum HubConfiguration /// Specifies the headstage port status codes. /// [Flags] - public enum PortStatusCode : byte + public enum PortStatusCode : ushort { /// - /// Specifies that the status code should be disregarded. + /// Specifies the SERDES forward channel lock status. /// - Invalid = 0x0, + SerdesLock = 0x0001, + /// - /// Specifies a cyclic redundancy check failure. + /// Specifies the SERDES on-chip parity check status. /// - CrcError = 0x1, + SerdesParityPass = 0x0002, + + /// + /// Specifies a cyclic redundancy check failure during data transmission. + /// + CrcError = 0x0100, + /// /// Specifies that too many devices were indicated in the hub device table. /// - TooManyDevices = 0x2, + TooManyDevices = 0x0200, + /// /// Specifies a hub initialization error. /// - InitializationError = 0x4, + InitializationError = 0x0400, + /// /// Specifies the receipt of a badly formatted data packet. /// - BadPacketFormat = 0x8, + BadPacketFormat = 0x0800, + + /// + /// Specifies the a cyclic redundancy check failure during hub initialization. + /// + InitializationCrcError = 0x1000, } /// /// Specifies the physical port that a headstage is plugged into. /// /// - /// ONIX uses a common protocol to communicate with a variety of devices using the same physical connection. For this reason - /// lots of different headstage types can be plugged into a headstage port. + /// ONIX uses a common protocol to communicate with a variety of devices using the same physical + /// connection. For this reason lots of different headstage types can be plugged into a headstage port. /// public enum PortName { diff --git a/OpenEphys.Onix1/PortStatusFrame.cs b/OpenEphys.Onix1/PortStatusFrame.cs index 6afa0c3..08cc29a 100644 --- a/OpenEphys.Onix1/PortStatusFrame.cs +++ b/OpenEphys.Onix1/PortStatusFrame.cs @@ -16,26 +16,13 @@ public unsafe PortStatusFrame(oni.Frame frame) { var payload = (PortStatusPayload*)frame.Data.ToPointer(); HubClock = payload->HubClock; - var statusCodeValid = (payload->SerdesStatus & 0x0004) == 4; - StatusCode = statusCodeValid ? payload->Code : PortStatusCode.Invalid; - SerdesLocked = (payload->SerdesStatus & 0x0001) == 1; - SerdesPass = (payload->SerdesStatus & 0x0002) == 2; + StatusCode = payload->Code; } /// /// Gets the port status code. /// public PortStatusCode StatusCode { get; } - - /// - /// Gets the SERDES forward channel lock status. - /// - public bool SerdesLocked { get; } - - /// - /// Gets the SERDES on-chip parity check status. - /// - public bool SerdesPass { get; } } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -43,6 +30,5 @@ struct PortStatusPayload { public ulong HubClock; public PortStatusCode Code; - public byte SerdesStatus; } }