示例#1
0
        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);
        }
示例#2
0
        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);
            }
        }
示例#3
0
        // 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);
        }
示例#4
0
        public static string VLFD_GetLastErrorMsg(int iBoard)
        {
            var p = NativeExtension.Get().NativeMethods.VLFD_GetLastErrorMsg_init(iBoard);

            return(Marshal.PtrToStringAnsi(p));
        }
示例#5
0
 public static bool VLFD_IO_Close(int iBoard) => NativeExtension.Get().NativeMethods.VLFD_IO_Close_init(iBoard);
示例#6
0
 public static bool VLFD_AppChannelSelector(int iBoard, byte channel) => NativeExtension.Get().NativeMethods.VLFD_AppChannelSelector_init(iBoard, channel);
示例#7
0
 public static bool VLFD_IO_Open(int iBoard, string SerialNO) => NativeExtension.Get().NativeMethods.VLFD_IO_Open_init(iBoard, SerialNO);
示例#8
0
 public static bool VLFD_ProgramFPGA(int iBoard, string BitFile) => NativeExtension.Get().NativeMethods.VLFD_ProgramFPGA_init(iBoard, BitFile);