public static bool VLFD_AppFIFOReadData(int iBoard, Span <ushort> Buffer) { var p = Marshal.AllocHGlobal(Marshal.SizeOf <ushort>() * Buffer.Length); var r = NativeExtension.Get().NativeMethods.VLFD_AppFIFOReadData_init(iBoard, p, (uint)Buffer.Length); unsafe { var buf = new Span <ushort>(p.ToPointer(), Buffer.Length); buf.CopyTo(Buffer); } Marshal.FreeHGlobal(p); return(r); }
/// <summary> /// Gets singleton instance of this class. /// The native extension is loaded when called for the first time. /// </summary> public static NativeExtension Get() { if (instance == null) { lock (staticLock) { if (instance == null) { instance = new NativeExtension(); } } } return(instance); }
public static bool VLFD_IO_WriteReadData(int iBoard, Span <ushort> WriteBuffer, Span <ushort> ReadBuffer) { var writebufpointer = Marshal.AllocHGlobal(Marshal.SizeOf <ushort>() * WriteBuffer.Length); var readbufpointer = Marshal.AllocHGlobal(Marshal.SizeOf <ushort>() * ReadBuffer.Length); unsafe { var writebuf = new Span <ushort>(writebufpointer.ToPointer(), WriteBuffer.Length); WriteBuffer.CopyTo(writebuf); var readbuf = new Span <ushort>(readbufpointer.ToPointer(), ReadBuffer.Length); var r = NativeExtension.Get().NativeMethods.VLFD_IO_WriteReadData_init(iBoard, writebufpointer, readbufpointer, (uint)ReadBuffer.Length); readbuf.CopyTo(ReadBuffer); Marshal.FreeHGlobal(writebufpointer); Marshal.FreeHGlobal(readbufpointer); return(r); } }
// Signatures of native methods are generated from a template // and can be found in NativeMethods.Generated.cs /// <summary> /// Gets singleton instance of this class. /// </summary> public static NativeMethods Get() { return(NativeExtension.Get().NativeMethods); }
public static string VLFD_GetLastErrorMsg(int iBoard) { var p = NativeExtension.Get().NativeMethods.VLFD_GetLastErrorMsg_init(iBoard); return(Marshal.PtrToStringAnsi(p)); }
public static bool VLFD_IO_Close(int iBoard) => NativeExtension.Get().NativeMethods.VLFD_IO_Close_init(iBoard);
public static bool VLFD_AppChannelSelector(int iBoard, byte channel) => NativeExtension.Get().NativeMethods.VLFD_AppChannelSelector_init(iBoard, channel);
public static bool VLFD_IO_Open(int iBoard, string SerialNO) => NativeExtension.Get().NativeMethods.VLFD_IO_Open_init(iBoard, SerialNO);
public static bool VLFD_ProgramFPGA(int iBoard, string BitFile) => NativeExtension.Get().NativeMethods.VLFD_ProgramFPGA_init(iBoard, BitFile);