Files
GenericTeProgramLibrary/Source/TSRealLib/Common/Raytheon.Common/FPGA/HssubNativeMethods.cs
2025-03-13 12:04:22 -07:00

126 lines
7.8 KiB
C#

// UNCLASSIFIED
/*-------------------------------------------------------------------------
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
COMPANY.
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
GOVERNMENT.
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
-------------------------------------------------------------------------*/
using System.Runtime.InteropServices;
using System.Text;
namespace FpgaMeasurementInstrumentsLib
{
/// <summary>
///
/// </summary>
public unsafe static class HssubNativeMethods
{
public const int TERHSI_FPGA_TEST_DEFINED = 1;
// timeouts
public const int TERHSS_TIMEOUT_INDEFINITE = 0;
public const int TERHSS_TIMEOUT_60SEC = 60;
public const int TERHSS_TIMEOUT_10SEC = 10;
//
public const int TERHSS_OPTION_ALLOW_OVERWRITE = 1;
public const int TERHSS_OPTION_NONE = 0;
// callback codes
public const int MESSAGE_CONTEXT_INIT_INSTRUMENT = 0;
public const int MESSAGE_CONTEXT_LOAD_INSTRUMENT = 1;
public const int MESSAGE_CONTEXT_LB_WRITE32 = 2;
public const int MESSAGE_CONTEXT_LB_READ32 = 3;
public const int MESSAGE_CONTEXT_PAM_BLOCK_CREATE = 4;
public const int MESSAGE_CONTEXT_PAM_BLOCK_READ = 5;
public const int MESSAGE_CONTEXT_NBLOCK_WRITE = 6;
public const int MESSAGE_CONTEXT_NBLOCK_READ = 7;
public const int MESSAGE_CONTEXT_RUN_EXE = 8;
public const int MESSAGE_CONTEXT_RUN_JTAG = 9;
public const int MESSAGE_CONTEXT_DMA_CREATE_PAM_BLOCK = 10;
public const int MESSAGE_CONTEXT_DMA_READ_PAM_BLOCK = 11;
public const int MESSAGE_CONTEXT_DMA_WRITE_PAM_BLOCK = 12;
public const int MESSAGE_CONTEXT_DMA_MEMORY_MOVE = 13;
public const int MESSAGE_CONTEXT_DMA_PAM_CLEAR = 14;
public const int MESSAGE_CONTEXT_UCLK_SET = 20;
// HSS imports (running on the remote test station)
public delegate void MessageCallbackDelagate(uint chassisHandle, int applicationHandle, int messageContext, uint messageSize, byte* message);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_error_message(uint chassisHandle, int errorCode, StringBuilder errorMessage);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_init(string resourceName, ushort idQuery, ushort reset, ref uint pdwVi);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_Application_CreateSyncObject(uint chassisHandle, string syncName, ref int syncObjectHandle);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_Application_RegisterMessageCallback(uint chassisHandle, MessageCallbackDelagate callback);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_Subsystem_SendFile(uint chassisHandle, string sourceFile, string destinationFile, int options);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_Application_Load(uint chassisHandle, string applicationName, string remotePath, ref int applicationHandle);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_Application_Start(uint chassisHandle, int applicationHandle, string cmdLineArgs, double timeout);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_Application_WaitForSyncObject(uint chassisHandle, int syncHandle, double timeout, ushort autoReset, ref int contextValue);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_Application_SendMessage(uint chassisHandle, int applicationHandle, int messageContext, int messageArraySize, byte[] message, double timeout);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_Subsystem_DeleteFile(uint chassisHandle, string file, int options);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_close(uint chassisHandle);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHss.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHss_self_test(uint chassisHandle, ref short result, StringBuilder message);
// HSI imports (running on the local sub system)
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHsi_error_message(uint chassisHandle, int errorCode, StringBuilder errorMessage);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHsi_init(string resourceName, ushort idQuery, ushort reset, ref uint pdwVi);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHsi_Firmware_Load(uint chassisHandle, int fpga, string fwFileName, ref ushort customerId, ref ushort applicationID, ref uint revisionID);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHsi_LB_Read32(uint chassisHandle, uint offset, ref uint data);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHsi_LB_ReadBlock32(uint chassisHandle, uint offset, uint numberWordsToRead, uint* data);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHsi_LB_Write32(uint chassisHandle, uint offset, uint data);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHsi_LB_WriteBlock32(uint chassisHandle, uint offset, uint numberWordsToWrite, uint[] data);
//public static extern int terHsi_LB_WriteBlock32(uint chassisHandle, uint offset, uint numberWordsToWrite, uint* data);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHsi_close(uint chassisHandle);
[DllImport("C:\\Program Files (x86)\\IVI Foundation\\IVI\\Bin\\terHsi_32.dll", CallingConvention = CallingConvention.StdCall)]
public static extern int terHsi_reset(uint chassisHandle);
}
}