...
Table of Contents | ||||
---|---|---|---|---|
|
1. F_OpenInstancesAndFPAs
Anchor | ||||
---|---|---|---|---|
|
General Description
Multi API-DLL scans USB ports or LAN for connected FPAs listed in the setup file, or input string. When an FPA listed in the setup file is found, the corresponding API-DLL is copied on disk if necessary, and loaded. F_Initialization should be called for each FPA after this function succeeds.
...
In both cases, for the setup file and the input string, if a specied specified FPA is missing then it will not
affect subsequent entries. Therefore, a setup file with these contents:
...
Code Block |
---|
FPA-1 20090123 FPA-2 20090346 FPA-3 empty FPA-4 20090245 |
Output
INT_X : number of instances opened successfully
...
All FPAs terminate communication with target devices and close target devices according to configuration settings (power setting, adapter line states, etc.). Finally, the USB/Ethernet connections to the FPAs are terminated and API-DLL instances are freed. The Multi API-DLL can now be used to open a new set of FPAs using the function F_OpenInstancesAndFPAs.
Syntax
Code Block | ||
---|---|---|
| ||
INT_X F_CloseInstances ( void ); |
Input
none.
Output
INT_X : success or failed
TRUE (1) - success
FALSE (0) - failed
3. F_Set_FPA_index
Anchor | ||||
---|---|---|---|---|
|
General Description
Select desired FPA index to perform specific tasks (access specific API-DLL instance).
...
BYTE fpa : desired FPA index, 1 to 64, or 0 for all
Output
INT_X : success or error
TRUE (1), used FPA index is valid
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
IMPORTANT
...
BYTE : current FPA index as set using F_Set_FPA_index
5. F_Check_FPA_index
Anchor | ||||
---|---|---|---|---|
|
General Description
Get current FPA index and check if index is valid. A valid index corresponds to an individual FPA that has been opened with F_OpenInstancesAndFPAs. If FPA index was set to 0 (all), then this function will only return 0, even if no FPAs are open. Does not indicate whether FPA index is enabled or disabled.
...
Code Block | ||
---|---|---|
| ||
INT_X F_Check_FPA_index ( void ); |
Input
none.
Output
INT_X : current fpa index if valid
current FPA index as entered using F_Set_FPA_index if selected FPA has been opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
6. F_Enable_FPA_index
...
BYTE fpa : desired FPA index, 1 to 64
Output
none.
8. F_LastStatus
Anchor | ||||
---|---|---|---|---|
|
General Description
Return value from the last function call issued to the specified FPA (API-DLL instance). This function is useful when multiple FPAs are being programmed using FPA index 0 (all), but the return value was not the same for all FPAs (i.e. 4 FPAs succeeded, 1 FPA failed). When the return value is not the same for all FPAs then, then the actual return value from the Multi API-DLL will be FPA_UNMATCHED_RESULTS. To find out per FPA return values, select each FPA index individually using F_Set_FPA_index, and call F_LastStatus for each index.
...
BYTE fpa : desired FPA index, 1 to 64.
Output
INT_X : Last return value from the selected FPA (API-DLL instance).
INT_X type return value from last function call on selected FPA
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
9. F_Multi_DLLTypeVer
...
Code Block // return Type + Version // Type 0x6000 - Multi-FPA FlashPro430 // 0x7000 - Multi-FPA GangPro430 // 0x8000 - Multi-FPA FlashPro-CC // 0x9000 - Multi-FPA GangPro-CC // 0xC000 - Multi-FPA FlashPro2000 // 0xD000 - Multi-FPA GangPro2000 // 0x10000 - Multi-FPA FlashPro-ARM // 0x11000 - Multi-FPA GangPro-ARM // 0x17000 - Multi-FPA FlashPro-M // 0x18000 - Multi-FPA GangPro-M // Version = 0x0FFF & version
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
10. F_Get_FPA_SN
...
BYTE fpa : desired FPA index, 1 to 64
Output
INT_X : serial number
SN of selected FPA
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
11. F_Get_FPA_Label
...
Code Block | ||
---|---|---|
| ||
#define ADAPTER_HARDWARE_PN_SIZE 16 #define ADAPTER_DESCRIPTION_SIZE 32 #define FPA_LABEL_SIZE ((ADAPTER_HARDWARE_PN_SIZE + ADAPTER_DESCRIPTION_SIZE)*sizeof(char) + 12*sizeof(BYTE) + sizeof(long)) union FPA_LABEL { BYTE bytes[ FPA_LABEL_SIZE ]; struct { long SN; BYTE hardware_ID; BYTE hardware_SubID; BYTE full_access; BYTE Interface_Type; BYTE Valid_access_key; BYTE spare3; BYTE spare4; BYTE spare5; BYTE spare6; BYTE spare7; BYTE spare8; BYTE spare9; char adapter_hardware_PN[ ADAPTER_HARDWARE_PN_SIZE ]; char adapter_description[ ADAPTER_DESCRIPTION_SIZE ]; }x; }; |
Output
INT_X : serial number, hardware ID, meta-data
updated FPA_LABEL structure pointed to by label input parameter
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example of printing FPA_LABEL:
...
Code Block | ||
---|---|---|
| ||
#define MAX_ID_DESC 15 #define MAX_ACCESS_DESC 32 typedef struct { UINT32 active; UINT32 SN; UINT32 CommType; UINT32 HW_ID; UINT32 HW_rev; char text[MAX_ID_DESC+1]; char access_text[MAX_ACCESS_DESC+1]; } ALL_FPA_LIST; //i.e.: ALL_FPA_LIST FPA_List[MAX_USB_DEV_NUMBER]; //F_Get_FPA_List(FPA_List); INT_X MSPPRG_API F_Get_FPA_List( ALL_FPA_LIST * FPA_List ); // FPA_List -> size MAX_USB_DEV_NUMBER |
Output
INT_X : number of active adapters
...
BYTE fpa : desired FPA index, 1 to 64.
Output
INT_X : progress indicator
value between 0 and 100
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example
Refer to GetLastOpCode.
...
14. F_GetLastOpCode
Anchor | ||||
---|---|---|---|---|
|
General Description
Read internal opcode value for sub-operations done inside Encapsulated Functions. When used in conjunction with F_GetProgressBar it allows the user application to keep track of progress in the same way that the FlashPro-ARM/GangPro-ARM GUI does.
...
BYTE fpa : desired FPA index, 1 to 64.
Output
INT_X : opcode of currently running sub-operation
PROG_OPCODE_VERIFY_ACCESS (1) : FPA is attempting to perform action described in F_Verify_Access to MCU.
PROG_OPCODE_FLASH_ERASE (2) : FPA is attempting to perform action described in F_Memory_Erase.
PROG_OPCODE_FLASH_BLANK_CHECK (3) : FPA is attempting to perform action described in F_Memory_Blank_Check.
PROG_OPCODE_FLASH_SELECTED_BLANK_CHECK (4) : FPA is attempting to perform action described in F_Memory_Blank_Check when a subset of the memory space is selected in configuration settings.
PROG_OPCODE_FLASH_WRITE (5) : FPA is attempting to perform action described in F_Memory_Write.
PROG_OPCODE_FLASH_VERIFY (6) : FPA is attempting to perform action described in F_Memory_Verify.
PROG_OPCODE_FLASH_READ (7) : FPA is attempting to perform action described in F_Memory_Read.
PROG_OPCODE_LOCK_MCU (8) : FPA is attempting to perform action described in F_Lock_MCU.
PROG_OPCODE_UNLOCK_MCU (9) : FPA is attempting to perform action described in F_Clear_Locked_Device.
PROG_OPCODE_START_APP (10) : FPA is attempting to run application programmed onto target device (if enabled to be ran after F_AutoProgram in configuration settings).
FPA_INVALID_NO (-2 or 0xFFFFFFFE) : FPA not opened with Multi API-DLL Functions | F_OpenInstancesAndFPAs or index out of range
Example
Code Block | ||
---|---|---|
| ||
void UpdateProgress(BYTE fpa, INT_X &progValue, INT_X &lastOpCode, CString &opCodeUpdate)
{
if(fpa == 0)
{
//invalid index
return;
}
progValue = F_GetProgressBar(fpa);
lastOpCode = F_GetLastOpCode(fpa);
opCodeUpdate = "Unknown";
switch(lastOpCode)
{
case PROG_OPCODE_VERIFY_ACCESS:
opCodeUpdate = "Verify Access To MCU";
break;
case PROG_OPCODE_FLASH_ERASE:
opCodeUpdate = "Flash Erase";
break;
case PROG_OPCODE_FLASH_BLANK_CHECK:
opCodeUpdate = "Flash Blank Check";
break;
case PROG_OPCODE_FLASH_SELECTED_BLANK_CHECK:
opCodeUpdate = "Selected Memory Blank Check";
break;
case PROG_OPCODE_FLASH_WRITE:
opCodeUpdate = "Flash Write";
break;
case PROG_OPCODE_FLASH_VERIFY:
opCodeUpdate = "Flash Verify";
break;
case PROG_OPCODE_FLASH_READ:
opCodeUpdate = "Flash Read";
break;
case PROG_OPCODE_LOCK_MCU:
opCodeUpdate = "Lock MCU";
break;
case PROG_OPCODE_UNLOCK_MCU:
opCodeUpdate = "Unlock MCU";
break;
case PROG_OPCODE_START_APP:
opCodeUpdate = "Start Application";
break;
}
} |
...
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|
15. F_CancelAction
General Description
Function that will attempt to cancel any running Encapsulated Functions , like the GUI Cancel button. This function is thread-safe. One thread can call F_AutoProgram (for example) and another thread can call F_CancelAction to stop the first. A reinitialization is recommended using F_OpenInstancesAndFPAs after calling this function.
Syntax
Code Block | ||
---|---|---|
| ||
INT_X MSPPRG_API F_CancelAction( BYTE fpa ); |
Input
BYTE fpa : desired FPA index, 1 to 64.
Output
INT_X : success or failed
TRUE (1) - success
FALSE (0) - failed
16. F_Trace_File
General Description
Set custom FileName for trace (used with Trace_ON). Set append flag true to keep previous contents.
Syntax
Code Block | ||
---|---|---|
| ||
INT_X F_Trace_File( char *FileName, bool append = false ); |
Input
char *FileName : path to new trace file.
bool append : append to file if it already exists.
Output
INT_X : success or failed in opening file
TRUE (1) - success
FALSE (0) - failed
17. F_Trace_Comment
General Description
Append a custom comment to current trace file.
Syntax
Code Block | ||
---|---|---|
| ||
void MSPPRG_API F_Trace_Comment(char *comment); |
Input
char *comment : comment to be added to trace file at current location in the trace.
Output
none.
18. F_Trace_ON
General Description
Activate tracing for subsequent calls to the Multi API-DLL. Log is saved in DLLtrace.txt located in the Multi API-DLL directory, or custom file if F_Trace_File function was called. When activated, records all API-DLL function calls from the application software invoked via the Multi API-DLL. The DLLtrace.txt trace file is overwritten for each new session, unless the F_Trace_File append flag is true.
Syntax
Code Block | ||
---|---|---|
| ||
void F_Trace_ON( void ); |
Input
none.
Output
none.
...
19. F_Trace_OFF
General Description
Disable tracing.
Syntax
Code Block | ||
---|---|---|
| ||
void F_Trace_OFF( void ); |
Input
none.
Output
none.