VB Generic DLL code example
This example is found in the Generic-FPA-DLLs (x86) and Generic-FPA-DLLs (x64) packages in the installation directory. The source code is in the Generic-FPA-VB-Demo subdirectory. This example starts with the configuration of two adapters with a specified serial number and type:
result = F_OpenInstancesAndFPAs("*# FPA-1 20204004 TYPE-MSP FPA-2 20183001 TYPE-ARM")
The string passed to the initialization function specified the adapters and their types to be initialized. The type information is described in more detail in this article in the this wiki:
Generic DLL CLI: Getting Started
The below example, after initialization of the adapters, will load a different configuration file for each adapter, perform AutoProgram, read the report message from each adapter (same as GUI), and finally offer the option to read current/voltage measurement values from a single adapter. The power measurement feature is for XStream-Iso and XStreamPro-Iso adapters only.
Imports System.Runtime.InteropServices
Imports System.Text
Module Module1
Const XS_ADC_NUM_MEMBERS As Integer = 15
Const DEFAULT_JTAG_3ST As Integer = 0
Const DEFAULT_RESET_3ST As Integer = 2
Const MODE_XS_IO_CLR_FLAGS As Integer = 19
Const IO_PULLUP_EN As Integer = 1
' Function to build the message
Function GetFullMessage() As String
Dim message As New StringBuilder()
Dim index As Integer = 0
Dim charByte As Byte
' Loop until we get the null-terminating character
Do
charByte = F_GetReportMessageChar(index)
If charByte = 0 Then ' Null-terminating character
Exit Do
End If
message.Append(Chr(charByte)) ' Append the character to the message
index += 1
Loop
' Return the complete message
Return message.ToString()
End Function
Sub ProcessADCData()
' Call initialization functions
Dim response As Integer
Dim data_block(XS_ADC_NUM_MEMBERS) As Double
Dim data_block_ptr As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(GetType(Double)) * data_block.Length)
Try
' Infinite loop to get power results and print them
While True
' Call the F_Get_Power_Results function with the pointer
response = F_Get_Power_Results(data_block_ptr)
' Print the values
Console.WriteLine("ExtVcc= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 0 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" Vcc= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 1 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" Vpp= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 2 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" ExtVccMin= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 3 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" ExtVccMax= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 4 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" VccMin= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 5 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" VccMax= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 6 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" Icc_mA= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 7 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" Icc_mA_av4= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 8 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" Icc_mA_av16= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 9 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" Icc_mA_min= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 10 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" Icc_mA_max= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 11 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" Temperature= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 12 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" Icc_mA_av64= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 13 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine(" Icc_mA_av= " & Marshal.PtrToStructure(Of Double)(data_block_ptr + 14 * Marshal.SizeOf(GetType(Double))))
Console.WriteLine()
Console.WriteLine("Press any button to get another sample: ")
Console.ReadLine()
End While
Catch ex As Exception
Console.WriteLine("Exception: " & ex.Message)
Finally
' Free the unmanaged memory
Marshal.FreeHGlobal(data_block_ptr)
End Try
End Sub
Sub Main()
' Open adapters - this binds adapter(s) to this application.
' Any adapters not opened here could potentially be opened by another application in parallel.
Dim result As Integer
' result = F_OpenInstancesAndFPAs("FPAs-setup.ini") ' Read configuration from file
result = F_OpenInstancesAndFPAs("*# FPA-1 20204004 TYPE-MSP FPA-2 20183001 TYPE-ARM")
' result = F_OpenInstancesAndFPAs("*# FPA-1 20171645 TYPE-MSP FPA-2 20210120 TYPE-ARM") ' Open two adapters over USB
' result = F_OpenInstancesAndFPAs("*# FPAETH-IP-1 192.168.0.101 TYPE-MSP FPAETH-IP-2 192.168.0.102 TYPE-ARM") ' Open two adapters over LAN (XStreamPro-Iso only)
' result = F_OpenInstancesAndFPAs("<path to FPAs-setup.ini file>") ' Read configuration from file
' Select adapter index for accepting commands
result = F_Set_FPA_index(0) ' Select all opened adapters for sending commands
' result = F_Set_FPA_index(1) ' Select only adapter 1 for sending commands
' result = F_Set_FPA_index(2) ' Select only adapter 2 for sending commands
result = F_Initialization() ' Initialize selected adapter(s)
result = F_Set_FPA_index(1) 'MSP
result = F_ConfigFileLoad("MSP430-F169.cfg")
result = F_Set_FPA_index(2) 'ARM
result = F_ConfigFileLoad("STM32H750VB-Issi-ext.cfg") ' Config file can be easily created in the GUI, or parameters can be set using F_Set_Config_Value_By_Name
' If the configuration file above already has a valid code path, the following function(s) is(are) not necessary
' result = F_ReadCodeFile("<path to code file>") ' Flush code buffer, read first code file. Can be used for *.hex, *.txt, *.srec, *.sxx etc.
' result = F_ReadCodeFile_BaseAddr("<path to code file>", baseAddr) ' Same as above but designed for *.bin files. Function will add baseAddr to code address. Can also be used to shift regular code files.
' result = F_AppendCodeFile("<path to code file>") ' Append code file, does not flush code buffer.
' result = F_AppendCodeFile_BaseAddr("<path to code file>", baseAddr) ' Same as F_ReadCodeFile_BaseAddr but used for appending
' Factory erase target (optional)
' result = F_Clear_Locked_Device()
' Erase, Blank Check, Write and Verify code programmed to target(s)
result = F_Set_FPA_index(0) ' All adapters
result = F_AutoProgram(0)
Try
' Loop to set FPA index and retrieve messages
Dim indices() As Integer = {1, 2}
For Each index As Integer In indices
result = F_Set_FPA_index(index)
'Dim messagePtr As IntPtr = F_Report_Message()
'Dim message As String = Marshal.PtrToStringAnsi(messagePtr)
'Console.WriteLine(message)
'Get message one character at a time
Dim completeMessage As String = GetFullMessage()
Console.WriteLine(completeMessage)
Console.WriteLine("Press any button to get another message:")
Console.ReadLine()
Next
Catch ex As Exception
Console.WriteLine("Exception: " & ex.Message)
End Try
'Get power samples
result = F_Set_FPA_index(1) 'Select FPA 1
ProcessADCData() 'Measure current for MSP
End Sub
End Module
The target DLL in this case is the Generic-FPA.dll, however, the user can also target MSP430, ARM, M, 2000, CC, or iMOTION only by changing the referenced DLL in the GenericFPAModule.vb file:
Generic-FPA.dll (unified DLL for all API-DLL types)
MSP430FPA.dll, or GangPro430FPA.dll (DLL for FlashPro/GangPro-430 only)
FlashProARM-FPAsel.dll, or GangProARM-FPAsel.dll (DLL for FlashPro/GangPro-ARM only)
FlashProM-FPAsel.dll, or GangProM-FPAsel.dll (DLL for FlashPro/GangPro-M only)
FlashPro2000-FPAsel.dll (DLL for FlashPro-2000 only)
FlashProCC-FPAsel.dll, or GangProCC-FPAsel.dll (DLL for FlashPro/GangPro-CC only)
FlashProiMOTION-FPAsel.dll, or GangProiMOTION-FPAsel.dll (DLL for FlashPro/GangPro-iMOTION only)
The notable difference is that when using the Generic-FPA.dll, when specifying the adapter list, the extra TYPE-xxx strings are required. If targeting the MSP430FPA.dll for example, the TYPE-MSP would be omitted.
The VB DLL wrapper is shown below:
Module GenericFPAModule
' Communication Functions
Declare Function F_Open_Comm Lib "Generic-FPA.dll" (ByVal activeReset As Integer) As Integer
Declare Function F_Soft_Reset_Target Lib "Generic-FPA.dll" () As Integer
Declare Function F_SetBoot0 Lib "Generic-FPA.dll" (ByVal BOOT0_override As Integer, ByVal BOOT0_value As Integer) As Integer
' Instance Functions
Declare Function F_OpenInstancesAndFPAs Lib "Generic-FPA.dll" (ByVal FileName As String) As Integer
Declare Function F_DiscoverFPAs Lib "Generic-FPA.dll" (ByVal type As String) As IntPtr
Declare Function F_CloseInstances Lib "Generic-FPA.dll" () As Integer
' FPA Index Functions
Declare Function F_Set_FPA_index Lib "Generic-FPA.dll" (ByVal fpa As Byte) As Integer
Declare Function F_Get_FPA_index Lib "Generic-FPA.dll" () As Byte
Declare Function F_Check_FPA_access Lib "Generic-FPA.dll" (ByVal index As Integer) As Integer
Declare Sub F_Enable_FPA_index Lib "Generic-FPA.dll" (ByVal fpa As Byte)
Declare Sub F_Disable_FPA_index Lib "Generic-FPA.dll" (ByVal fpa As Byte)
Declare Function F_LastStatus Lib "Generic-FPA.dll" (ByVal fpa As Byte) As Integer
Declare Function F_GenericDLLVer Lib "Generic-FPA.dll" () As Integer
Declare Function F_GenericTSDLLVer Lib "Generic-FPA.dll" () As Integer
Declare Function F_Get_FPA_SN Lib "Generic-FPA.dll" (ByVal fpa As Byte) As Integer
' Label and Power Functions
Declare Function F_Get_FPA_Label Lib "Generic-FPA.dll" (ByVal fpa As Byte, ByRef label As Byte) As Integer
Declare Function F_Get_Power_Results Lib "Generic-FPA.dll" (ByVal xs_adc As IntPtr) As Integer
Declare Function F_Get_Last_Power_Results_data Lib "Generic-FPA.dll" (ByVal xs_adc As IntPtr) As Integer
Declare Function F_XS_Current_zeroing Lib "Generic-FPA.dll" (ByVal state As Integer, ByVal txt As String) As Integer
Declare Function F_XS_Update_HW_State Lib "Generic-FPA.dll" (ByVal mode As Byte, ByVal data As Integer) As Integer
Declare Function F_XS_Clr_ADC_av_history Lib "Generic-FPA.dll" () As Integer
' Progress and Operation Functions
Declare Function F_GetProgressBar Lib "Generic-FPA.dll" (ByVal fpa As Byte) As Integer
Declare Function F_GetLastOpCode Lib "Generic-FPA.dll" (ByVal fpa As Byte) As Integer
Declare Function F_CancelAction Lib "Generic-FPA.dll" (ByVal fpa As Byte) As Integer
Declare Sub F_Trace_ON Lib "Generic-FPA.dll" ()
Declare Sub F_Trace_OFF Lib "Generic-FPA.dll" ()
Declare Function F_Set_Timeout_Short Lib "Generic-FPA.dll" (ByVal new_short_timeout As Integer) As Integer
Declare Function F_Set_Timeout_Long Lib "Generic-FPA.dll" (ByVal new_long_timeout As Integer) As Integer
' FPA Type and Debug Functions
Declare Function F_Get_FPA_type Lib "Generic-FPA.dll" (ByVal fpa As Byte) As IntPtr
Declare Function F_Debug_Enable Lib "Generic-FPA.dll" () As Integer
Declare Function F_Debug_Disable Lib "Generic-FPA.dll" () As Integer
' Generic Functions
Declare Function F_Initialization Lib "Generic-FPA.dll" () As Integer
Declare Function F_Use_Config_INI Lib "Generic-FPA.dll" (ByVal use As Byte) As Integer
Declare Function F_Get_Config_Name_List Lib "Generic-FPA.dll" (ByVal index As Integer) As IntPtr
Declare Function F_Get_Config_Value_By_Name Lib "Generic-FPA.dll" (ByVal name As String, ByVal type As Integer) As UInteger
Declare Function F_Set_Config_Value_By_Name Lib "Generic-FPA.dll" (ByVal name As String, ByVal newValue As UInteger) As Integer
Declare Function F_SetConfig Lib "Generic-FPA.dll" (ByVal index As Integer, ByVal data As Integer) As Integer
Declare Function F_GetConfig Lib "Generic-FPA.dll" (ByVal index As Integer) As Integer
Declare Sub F_Reset_Config Lib "Generic-FPA.dll" ()
' Device Info Functions
Declare Function F_Get_Device_Info Lib "Generic-FPA.dll" (ByVal index As Integer) As Integer
Declare Function F_Set_MCU_Name Lib "Generic-FPA.dll" (ByVal MCU_name As String) As Integer
Declare Function F_Search_MCU_Name Lib "Generic-FPA.dll" (ByVal MCU_name_regex As String, ByVal Vendor_filter As String, ByVal mode As Integer, ByVal flags As Integer) As IntPtr
Declare Function F_ARM_Get_MCU_Name_list Lib "Generic-FPA.dll" (ByVal type As Integer, ByVal index As Integer) As IntPtr
Declare Function F_ARM_Set_MCU_Family_Group Lib "Generic-FPA.dll" (ByVal type As Integer, ByVal index As Integer) As Integer
Declare Sub F_ReportMessage Lib "Generic-FPA.dll" (ByVal text As String)
Declare Function F_Report_Message Lib "Generic-FPA.dll" () As IntPtr
Declare Function F_GetReportMessageChar Lib "Generic-FPA.dll" (ByVal index As Integer) As Byte
Declare Function F_DLLTypeVer Lib "Generic-FPA.dll" () As Integer
Declare Function F_ConfigFileLoad Lib "Generic-FPA.dll" (ByVal filename As String) As Integer
Declare Function F_LoadFromImage Lib "Generic-FPA.dll" (ByVal fullPath As String, ByVal password As String) As Integer
Declare Function F_Power_Target Lib "Generic-FPA.dll" (ByVal OnOff As Integer) As Integer
Declare Function F_Reset_Target Lib "Generic-FPA.dll" () As Integer
Declare Function F_Get_Targets_Vcc Lib "Generic-FPA.dll" () As Integer
Declare Function F_Set_fpa_io_state Lib "Generic-FPA.dll" (ByVal debug As Byte, ByVal reset As Byte, ByVal VccOn As Byte) As Integer
Declare Function F_Set_fpa_IO Lib "Generic-FPA.dll" (ByVal jtag As Byte, ByVal jtag_reset As Byte, ByVal EMU0 As Byte, ByVal EMU1 As Byte) As Integer
Declare Function F_Get_Sector_Size Lib "Generic-FPA.dll" (ByVal address As Integer) As Integer
Declare Function F_Get_Lock_Bits Lib "Generic-FPA.dll" (ByVal target_no As Byte) As Integer
' Data Buffer Functions
Declare Function F_ReadCodeFile Lib "Generic-FPA.dll" (ByVal FileName As String) As Integer
Declare Function F_MSP_ReadCodeFile Lib "Generic-FPA.dll" (ByVal file_format As Integer, ByVal FileName As String) As Integer
Declare Function F_CC_ReadCodeFile Lib "Generic-FPA.dll" (ByVal file_format As Integer, ByVal FileName As String) As Integer
Declare Function F_AppendCodeFile Lib "Generic-FPA.dll" (ByVal FileName As String) As Integer
Declare Function F_Get_CodeCS Lib "Generic-FPA.dll" (ByVal dest As Integer) As Integer
Declare Function F_ReadPasswFile Lib "Generic-FPA.dll" (ByVal FileName As String) As Integer
Declare Function F_MSP_ReadPasswFile Lib "Generic-FPA.dll" (ByVal file_format As Integer, ByVal FileName As String) As Integer
Declare Function F_Clr_Code_Buffer Lib "Generic-FPA.dll" () As Integer
Declare Function F_Put_Byte_to_Password_Buffer Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Byte) As Integer
Declare Function F_Get_Byte_from_Password_Buffer Lib "Generic-FPA.dll" (ByVal addr As Integer) As Integer
Declare Function F_Put_Byte_to_Buffer Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Byte) As Integer
Declare Function F_Get_Byte_from_Buffer Lib "Generic-FPA.dll" (ByVal addr As Integer) As Byte
Declare Function F_Put_Word_to_Buffer Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Integer) As Integer
Declare Function F_Get_Word_from_Buffer Lib "Generic-FPA.dll" (ByVal addr As Integer) As Integer
Declare Sub F_Put_IEEEAddr64_to_Buffer Lib "Generic-FPA.dll" (ByVal IEEEAddr As ULong)
Declare Function F_Get_IEEEAddr64_from_Buffer Lib "Generic-FPA.dll" () As ULong
Declare Function F_Put_IEEEAddr_Byte_to_Buffer Lib "Generic-FPA.dll" (ByVal no As Byte, ByVal IEEEAddr As Byte) As Integer
Declare Function F_Get_IEEEAddr_Byte_from_Buffer Lib "Generic-FPA.dll" (ByVal no As Byte) As Byte
Declare Function F_Copy_Buffer_to_direct_RAM Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_direct_RAM_to_Buffer Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Put_Byte_to_Code_Buffer Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Byte) As Integer
Declare Function F_Get_Byte_from_Code_Buffer Lib "Generic-FPA.dll" (ByVal addr As Integer) As Integer
Declare Function F_Put_Word_to_Code_Buffer Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Integer) As Integer
Declare Function F_Get_Word_from_Code_Buffer Lib "Generic-FPA.dll" (ByVal addr As Integer) As Integer
Declare Function F_Put_Word_to_CSM_Buffer Lib "Generic-FPA.dll" (ByVal dest As Integer, ByVal addr As Integer, ByVal data As Integer) As Integer
Declare Function F_Get_Word_from_CSM_Buffer Lib "Generic-FPA.dll" (ByVal dest As Integer, ByVal addr As Integer) As Integer
Declare Function F_Put_Byte_to_Gang_Buffer Lib "Generic-FPA.dll" (ByVal target_no As Byte, ByVal addr As Integer, ByVal data As Byte) As Integer
Declare Function F_Get_Byte_from_Gang_Buffer Lib "Generic-FPA.dll" (ByVal target_no As Byte, ByVal addr As Integer) As Byte
Declare Sub F_Put_IEEEAddr64_to_Gang_Buffer Lib "Generic-FPA.dll" (ByVal target_no As Byte, ByVal IEEEAddr As ULong)
Declare Function F_Get_IEEEAddr64_from_Gang_Buffer Lib "Generic-FPA.dll" (ByVal target_no As Byte) As ULong
Declare Function F_Put_IEEEAddr_Byte_to_Gang_Buffer Lib "Generic-FPA.dll" (ByVal target_no As Byte, ByVal no As Byte, ByVal IEEEAddr As Byte) As Integer
Declare Function F_Get_IEEEAddr_Byte_from_Gang_Buffer Lib "Generic-FPA.dll" (ByVal target_no As Byte, ByVal no As Byte) As Byte
' Encapsulated Functions
Declare Function F_AutoProgram Lib "Generic-FPA.dll" (ByVal mode As Integer) As Integer
Declare Function F_Get_Error_No Lib "Generic-FPA.dll" (ByVal fpa As Byte) As Integer
Declare Function F_Verify_Lock_Bits Lib "Generic-FPA.dll" () As Integer
Declare Function F_Verify_Access_to_MCU Lib "Generic-FPA.dll" () As Integer
Declare Function F_Verify_CSM_Password Lib "Generic-FPA.dll" () As Integer
Declare Function F_VerifyFuseOrPassword Lib "Generic-FPA.dll" () As Integer
Declare Function F_Memory_Erase Lib "Generic-FPA.dll" (ByVal mode As Integer) As Integer
Declare Function F_Memory_Blank_Check Lib "Generic-FPA.dll" () As Integer
Declare Function F_Memory_Write Lib "Generic-FPA.dll" (ByVal mode As Integer) As Integer
Declare Function F_Memory_Verify Lib "Generic-FPA.dll" (ByVal mode As Integer) As Integer
Declare Function F_MSP_Memory_Read Lib "Generic-FPA.dll" (ByRef data As Byte) As Integer
Declare Function F_Memory_Read Lib "Generic-FPA.dll" () As Integer
Declare Function F_Gang_Flash_Read Lib "Generic-FPA.dll" () As Integer
Declare Function F_Write_IEEE_Address Lib "Generic-FPA.dll" () As Integer
Declare Function F_Read_IEEE_Address Lib "Generic-FPA.dll" () As Integer
Declare Function F_Copy_All_Flash_to_Buffer Lib "Generic-FPA.dll" () As Integer
Declare Function F_Restore_JTAG_Security_Fuse Lib "Generic-FPA.dll" () As Integer
Declare Function F_Clear_Locked_Device Lib "Generic-FPA.dll" () As Integer
Declare Function F_Lock_MCU Lib "Generic-FPA.dll" () As Integer
Declare Function F_Write_CSM_Password Lib "Generic-FPA.dll" () As Integer
Declare Function F_Write_Lock_Bits Lib "Generic-FPA.dll" () As Integer
' Sequential Functions
Declare Function F_Open_Target_Device Lib "Generic-FPA.dll" () As Integer
Declare Function F_Close_Target_Device Lib "Generic-FPA.dll" () As Integer
Declare Function F_Segment_Erase Lib "Generic-FPA.dll" (ByVal address As Integer) As Integer
Declare Function F_Sectors_Blank_Check Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal stop_addr As Integer) As Integer
Declare Function F_Copy_Buffer_to_Flash Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_Flash_to_Buffer Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Set_PC_and_RUN Lib "Generic-FPA.dll" (ByVal PC_addr As Integer) As Integer
Declare Function F_CC_Set_PC_and_RUN Lib "Generic-FPA.dll" (ByVal xram_en As Integer, ByVal PC_addr As Integer) As Integer
Declare Function F_ARM_Write_Byte_to_RAM Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Byte) As Integer
Declare Function F_ARM_Write_Word16_to_RAM Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Integer) As Integer
Declare Function F_ARM_Write_Word32_to_RAM Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Integer) As Integer
Declare Function F_ARM_Write_Bytes_Block_to_RAM Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer, ByRef data As Byte) As Integer
Declare Function F_ARM_Read_Byte Lib "Generic-FPA.dll" (ByVal addr As Integer) As Integer
Declare Function F_ARM_Read_Word16 Lib "Generic-FPA.dll" (ByVal addr As Integer) As Integer
Declare Function F_ARM_Read_Word32 Lib "Generic-FPA.dll" (ByVal addr As Integer) As Integer
Declare Function F_ARM_Read_Bytes_Block Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer, ByRef data As Byte) As Integer
Declare Function F_Write_Debug_Register Lib "Generic-FPA.dll" () As Integer
Declare Function F_Write_Locking_Registers Lib "Generic-FPA.dll" () As Integer
Declare Function F_Blow_Fuse Lib "Generic-FPA.dll" () As Integer
Declare Function F_Adj_DCO_Frequency Lib "Generic-FPA.dll" (ByVal freq_Hz As Integer) As Integer
Declare Function F_Test_DCO_Frequency Lib "Generic-FPA.dll" (ByVal DCO_constant As Integer) As Integer
Declare Function F_Get_DCO_constant Lib "Generic-FPA.dll" (ByVal target_no As Byte) As Integer
Declare Function F_Set_DCO_constant Lib "Generic-FPA.dll" (ByVal target_no As Byte) As Integer
Declare Function F_GP_Test_DCO_Frequency Lib "Generic-FPA.dll" () As Integer
Declare Function F_Get_DCO_Freq_result Lib "Generic-FPA.dll" (ByVal target_no As Byte) As Integer
' RAM Functions
Declare Function F_Write_Byte_to_XRAM Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Byte) As Integer
Declare Function F_Read_Byte_from_XRAM Lib "Generic-FPA.dll" (ByVal addr As Integer) As Integer
Declare Function F_Write_Byte_to_direct_RAM Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Byte) As Integer
Declare Function F_Read_Byte_from_direct_RAM Lib "Generic-FPA.dll" (ByVal addr As Integer) As Integer
Declare Function F_Copy_Buffer_to_XRAM Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_XRAM_to_Buffer Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Write_Word Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Integer) As Integer
Declare Function F_Read_Word Lib "Generic-FPA.dll" (ByVal addr As Integer) As Integer
Declare Function F_Write_Byte Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Byte) As Integer
Declare Function F_Read_Byte Lib "Generic-FPA.dll" (ByVal addr As Integer) As Byte
Declare Function F_Memory_Write_Data Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer, ByRef data As Byte) As Integer
Declare Function F_Memory_Read_Data Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer, ByRef data As Byte) As Integer
Declare Function F_Copy_Buffer_to_RAM Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_RAM_to_Buffer Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Write_Word_to_RAM Lib "Generic-FPA.dll" (ByVal addr As Integer, ByVal data As Integer) As Integer
' MCU Data Functions
Declare Function F_Get_MCU_Data Lib "Generic-FPA.dll" (ByVal Type As Integer) As Integer
Declare Function F_Capture_PC_Addr Lib "Generic-FPA.dll" () As Integer
Declare Function F_GP_Capture_PC_Addr Lib "Generic-FPA.dll" (ByVal target_no As Byte) As Integer
Declare Function F_Synch_CPU_JTAG Lib "Generic-FPA.dll" () As Integer
' Gang Buffer Functions
Declare Function F_Copy_Gang_Buffer_to_XRAM Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_XRAM_to_Gang_Buffer Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_Gang_Buffer_to_direct_RAM Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_direct_RAM_to_Gang_Buffer Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_Gang_Buffer_to_Flash Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_Flash_to_Gang_Buffer Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_Gang_Buffer_to_RAM Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Copy_RAM_to_Gang_Buffer Lib "Generic-FPA.dll" (ByVal start_addr As Integer, ByVal size As Integer) As Integer
Declare Function F_Gang_Read_Byte Lib "Generic-FPA.dll" (ByVal target_no As Byte, ByVal addr As Integer) As Integer
Declare Function F_Gang_Read_Word16 Lib "Generic-FPA.dll" (ByVal target_no As Byte, ByVal addr As Integer) As Integer
Declare Function F_Gang_Read_Word32 Lib "Generic-FPA.dll" (ByVal target_no As Byte, ByVal addr As Integer) As Integer
Declare Function F_Copy_MCU_Data_to_Buffer Lib "Generic-FPA.dll" (ByVal Type As Integer) As Integer
Declare Function F_Get_MCU_Data_from_Buffer Lib "Generic-FPA.dll" (ByVal target_no As Byte) As Integer
Declare Function F_Get_Targets_Result Lib "Generic-FPA.dll" () As Integer
Declare Function F_Get_Active_Targets_Mask Lib "Generic-FPA.dll" () As Integer
' Customized JTAG Instruction Functions
Declare Sub F_init_custom_jtag Lib "Generic-FPA.dll" (ByVal state As Integer, ByVal Vcc_index As Integer)
Declare Function F_custom_jtag_stream Lib "Generic-FPA.dll" (ByVal mode As Integer, ByVal size As Integer, ByRef data_out As Byte, ByRef data_in As Byte) As Integer
' UART Functions
Declare Function F_Customize Lib "Generic-FPA.dll" (ByVal dest As Integer, ByVal data As Integer) As Integer
Declare Function F_Custom_Function Lib "Generic-FPA.dll" (ByVal type As Integer) As Integer
End Module