slau358q.pdf - 第80页
MSP-GANG.dll Description www.ti.com 80 SLAU358Q – September 2011 – Revised October 2019 Submit Documentation Feedback Copyright © 2011–2019, Texas Instruments Incorporated Dynamic Link Library for MSP-GANG Programmer BYT…

www.ti.com
MSP-GANG.dll Description
79
SLAU358Q–September 2011–Revised October 2019
Submit Documentation Feedback
Copyright © 2011–2019, Texas Instruments Incorporated
Dynamic Link Library for MSP-GANG Programmer
extern DATA_BUFFERS dat;
Syntax
LONG MSPGANG_GetDataBuffers_ptr(void ** x)
In the application software, the pointer to the data buffer can be initialized as follows.
DATA_BUFFERS *DBuf;
void *temp;
MSPGANG_GetDataBuffers_ptr((&temp));
DBuf = (DATA_BUFFERS *)temp;
Example
Check if the code contents is specified at the MCU location and get the code contents at that location.
int get_code_content( long MCU_addr, BYTE *data )
{
long baddr, MCU_addr;
BYTE data, used_code;
baddr = MSPGANG_Convert_Address( MCU_TO_DATABUF, MCU_addr );
if( baddr >= 0 )
{
if( DBuf->Flag_ScrCode[ baddr ] )
{
*data = DBuf->SourceCode[ baddr ];
return(SUCCESS):
}
else
return(EMPTY_DATA):
}
return(WRONG_MCV_ADDR);
}
4.2.2 MSPGANG_SetGangBuffer, MSPGANG_GetGangBuffer
The MSP-GANG Programmer contains a temporary data buffer that can be used for writing and reading
data to each target device. Buffer size is 128 bytes for each target device when used it for data and 16
bytes when used for serialization.
Buffer[8] [128];
MSPGANG_SetGangBuffer writes data to selected Buffer. MSPGANG_GetGangBuffer reads contents
from the selected buffer.
Syntax
LONG MSPGANG_SetGangBuffer(BYTE target, BYTE size, BYTE *data)
LONG MSPGANG_GetGangBuffer(BYTE target, BYTE size, BYTE *data)
Arguments
#define GANG_DATA_BUF_SIZE 128
#define SN_GANG_BUF_SIZE SN_DATA_MAX_SIZE
#define TARGET_MASK 0x1F
#define SN_DATA_FLAG 0x40
If used for data:
BYTE target Target number (1 to 8)
BYTE size Size of data (1 to 128)
If used for serialization:

MSP-GANG.dll Description
www.ti.com
80
SLAU358Q–September 2011–Revised October 2019
Submit Documentation Feedback
Copyright © 2011–2019, Texas Instruments Incorporated
Dynamic Link Library for MSP-GANG Programmer
BYTE target Target number (1 to 8) ORed with SN_DATA_FLAG (SN_DATA_FLAG | Target_Number)
BYTE size Size of data (1 to 16)
BYTE *data Pointer to data buffer from where data is taken or to where the data should be saved
Result
LONG Error code
Example
Write unique 16 bytes of data to RAM or Flash
BYTE data[16];
MSPGANG_Interactive_Open_Target_Device( "test" );
for(target=1; target<=8; target++)
{
for(k=0; k<16; k++)
data[k] = enter_desired_data_per_target...
MSPGANG_SetGangBuffer( target, 16, data );
}
MSPGANG_Interactive_Copy_GANG_Buffer_to_RAM( MC_addr, 16 ); //copy unique data to
RAM
//or
MSPGANG_Interactive_Copy_GANG_Buffer_to_FLASH( MC_addr, 16 ); //copy unique data to
FLASH

www.ti.com
MSP-GANG.dll Description
81
SLAU358Q–September 2011–Revised October 2019
Submit Documentation Feedback
Copyright © 2011–2019, Texas Instruments Incorporated
Dynamic Link Library for MSP-GANG Programmer
4.2.3 MSPGANG_GetDevice
Reads all specific parameters of a device type from the internal MSP-GANG .DLL table and returns data
related to the selected device.
Syntax
LONG WINAPI MSPGANG_GetDevice(LPTSTR lpszDeviceName, void **lpData)
Arguments
LPTSTR lpszDeviceName MCU name. The device name; for example, 'MSP430F5438A' for desired MCU or (blank) for
currently selected MCU
void *lpData Pointer to internal structure
Result
LONG Error code
Data Format
typedef struct
{
long Group;
long IsFRAM;
long RAM_size;
long no_of_info_segm;
long info_segm_size;
long info_start_addr;
long info_end_addr;
long info_A_locked;
long MainMem_start_addr;
long MainMem_end_addr;
long no_of_BSL_segm;
long BSL_segm_size;
long BSL_start_addr;
long BSL_end_addr;
long Vcc_prg_min;
long Vcc_run_min;
long BSL_passw_size;
long family_index;
long has_JTAG_password;
long has_unlockable_JTAG;
long has_SBW;
long has_4wire_JTAG;
long has_BSL;
long no_of_DCO_constants;
long RAM_start_addr;
long MCU_ID;
long Clk_Type;
long uses_SUC;
long MCU_Type;
long MCU_Type_index;
long ARM_FW_Type;
long MAC_RegAddr;
long MPU_Type;
long spare[11];
} DEVICE_INFO;
In the application software, the pointer to the device info structure can be initialized as follows.
DEVICE_INFO *Device;
void *temp;
MSPGANG_GetDevice(" ", &temp);