This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

使用MSP-Gang.dll下载时,如何配置Secure Device?

Other Parts Discussed in Thread: MSP-GANG

如题,请问使用MSP-Gang.dll进行下载时,如何配置Secure Device?需要使用哪个指令?

  • 关于Secure Device您可以看一下

    的 2.1.6 Secure Device Setup and Memory Protection 以及第4章内dll文件的描述

    在MSP-GANG.h内可以查看相关的定义

    #define SECURE_DEV_EN               0xA9

    具体文件如下

    /*
    * Copyright (c) 2003 - 2015 Texas Instruments Incorporated
    *
    * All rights reserved not granted herein.
    * Limited License.  
    *
    * Texas Instruments Incorporated grants a world-wide, royalty-free, 
    * non-exclusive license under copyrights and patents it now or hereafter 
    * owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
    * this software subject to the terms herein.  With respect to the foregoing patent 
    *license, such license is granted  solely to the extent that any such patent is necessary 
    * to Utilize the software alone.  The patent license shall not apply to any combinations which 
    * include this software, other than combinations with devices manufactured by or for TI ("TI Devices").  
    * No hardware patent is licensed hereunder.
    *
    * Redistributions must preserve existing copyright notices and reproduce this license (including the 
    * above copyright notice and the disclaimer and (if applicable) source code license limitations below) 
    * in the documentation and/or other materials provided with the distribution
    *
    * Redistribution and use in binary form, without modification, are permitted provided that the following
    * conditions are met:
    *
    *             * No reverse engineering, decompilation, or disassembly of this software is permitted with respect 
    *               to any software provided in binary form.
    *             * any redistribution and use are licensed by TI for use only with TI Devices.
    *             * Nothing shall obligate TI to provide you with source code for the software licensed and provided 
    *               to you in object code.
    * If software source code is provided to you, modification and redistribution of the source code are permitted 
    * provided that the following conditions are met:
    *
    *   * any redistribution and use of the source code, including any resulting derivative works, are licensed by 
    *     TI for use only with TI Devices.
    *   * any redistribution and use of any object code compiled from the source code and any resulting derivative 
    *     works, are licensed by TI for use only with TI Devices.
    *
    * Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or 
    * promote products derived from this software without specific prior written permission.
    *
    * DISCLAIMER.
    *
    * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
    * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
    * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
    * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
    * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
    * POSSIBILITY OF SUCH DAMAGE.
    */
    //*****************************************************************
    /*========================================================================*\
    |                                                                          |
    | MSP-GANG.h                                                               |
    |                                                                          |
    | Definitions for MSP-GANG.DLL                                             |
    |--------------------------------------------------------------------------|
    | Project:          MSP-GANG Programmer                                    |
    | Developed using:  MS Visual Studio C++ 8.0 (2005)                        |
    |--------------------------------------------------------------------------|
    | Author:           GCZA                                                   |
    | Version:          1.00                                                   |
    | Initial Version:  10/2010                                                |
    |--------------------------------------------------------------------------|
    | Version history:                                                         |
    | 1.0.0.0  10/2010     GCZA  Initial Version                               |
    | 1.0.3.0  09/2011     GCZA  Release version                               |
    | 1.0.8.0  05/2012     GCZA  Release version                               |
    | 1.1.3.0  15/2013     GCZA  Release version                               |
    |--------------------------------------------------------------------------|
    | Designed 2010 by Elprotronic Canada                                      |
    \*========================================================================*/
    
    /*------------------------------------------------------------------------*\
    | Remarks:                                                                 |
    |                                                                          |
    \*------------------------------------------------------------------------*/
    
    #pragma once
    
    #define	 GUI_SW_PN      "MSP-Gang-GUI"
    #define	 GUI_SW_REV     "G430:  01.03.01.00"
    #define	 GUI_SW_DATE    "Feb.22.2019"
    
    #define  DLL_ID         0xD430              //DLL for MSP-GANG
    #define  DLL_REV        0x01030100          //rev 1.03.01.00
    #define  DLL_REL_DATE   "Feb.22.2019"
    #define  DLL_NAME       "MSP-Gang-DLL"
    
    #define	 IMAGE_TYPE_MSPGANG_ID         0xA430
    #define  IMAGE_TYPE_MSPGANG_ID_REV     0x0100
                            //              123456789abcde  
    #define	 IMAGE_TYPE_MSPGANG_ID_TXT     "MSP-GANG"      //do not modify TYPE description, as long as type is the same
    #define  LABEL_SIZE_IN_BYTES            256			
    
    
    // Error Codes reported by MSP-GANG.DLL and MSP-GANG programmer's firmware functions
    #define  ERR_NONE                     0    // Operation successful *** must be the first entry ***
    // errors reported by MSP-GANG adapter
    //    -errors 1..9 - reserved for BOOT errors
    //
    #define  ERR_NO_FIRMWARE               1
    #define	 ERR_FW_NO_CRC                 2
    #define	 ERR_FW_CRC_ERR                3
    #define	 ERR_BOOT_CRC_ERR              4
    //    -errors 1..9 - reserved for BOOT errors
    
    #define  ERR_ACCESS_KEY_CRC            10
    #define  ERR_INVALID_ACCESS_KEY        11
    #define  ERR_UNKNOWN_INTERFACE         12
    #define  ERR_VCC_TOO_LOW               13   
    #define  ERR_VCC_TOO_HIGH              14 
    #define  ERR_VTIO_TOO_LOW              15 
    #define  ERR_VTIO_TOO_HIGH             16       
    #define  ERR_HEADER_PSA                17
    #define  ERR_SCRIPT_PSA                18
    #define  ERR_EXCEED_SCRIPT_NO          19
    #define  ERR_UNKNOWN_SCRIPT_CMD        20
    #define  ERR_FETCH_SYNCH               21
    #define  ERR_CPU_JTAG_SYNCH            22
    #define  ERR_TARGET_DEV_INIT_ERR       23
    #define  ERR_RAM_FW_DOWNLOAD           24
    #define  ERR_BLANK_CHECK               25
    #define  ERR_RD_VERIFY                 26
    #define  ERR_FLASH_WRITE               27
    #define  ERR_FLASH_WR_INIT             28
    #define  ERR_FLASH_BP_LOCKED           29
    #define  ERR_INVALID_SCRIPT_TYPE       30
    #define  ERR_SIZE_TOO_HIGH             31
    #define  ERR_TARGET_DEV_ID_ERR         32
    #define  ERR_TARGET_IR_INTERRUPTED     33	
    #define  ERR_WRONG_INFO_PAGE           34
    #define  ERR_ADDR_TOO_HIGH             35
    #define  ERR_INVALID_TARGET_NO         36
    #define  ERR_ADDRESS_NOT_EVEN          37
    #define  ERR_SIZE_NOT_EVEN             38
    #define  ERR_DCO_FREQ_OUT_OF_RANGE     39
    #define  ERR_DCO_CALIBRATION_FAILED    40
    #define  ERR_GANG_FLASH_WRITE          41
    #define  ERR_SD_READ_INVALID_RESPONSE  42
    #define  ERR_SD_BOUNDARY_ADDRESS       43  
    #define  ERR_SD_INIT_TIMEOUT           44  
    #define  ERR_SD_READ_TIMEOUT           45        
    #define  ERR_SD_INIT                   46  
    #define  ERR_SD_CRC7                   47        
    #define  ERR_SD_CRC16                  48
    #define  ERR_SD_WRITE_CRC              49
    #define  ERR_SD_DATA_WRITE             50
    #define  ERR_SD_WRITE_TIMEOUT          51
    #define  ERR_SD_READ_MBR               52
    #define  ERR_SD_VOLUME                 53
    #define  ERR_ADDR_IN_FILE              54
    #define  ERR_READ_FILE                 55
    #define  ERR_FILE_NOT_FOUND            56
    #define  ERR_NOT_SUPPORTED_REV0        57
    #define  ERR_VERIFY                    58  
    #define  ERR_INTERACTIVE_RX_DATA       59    
    #define  ERR_SECURE_VPP_TOO_LOW        60
    #define  ERR_SECURE_KEY                61  
    #define  ERR_SECURE_DEVICE             62
    #define  ERR_TARGET_NOT_OPEN           63 
    #define  ERR_WRONG_INDEX               64  
    #define  ERR_BSL_RX_TIMEOUT            65
    #define  ERR_FBSL_FW_LOAD              66
    #define  ERR_WRONG_COMMAND             67
    #define  ERR_FBSL_INIT                 68  
    #define  ERR_TOTAL_CURRENT_OVERLOAD    69
    #define  ERR_WRONG_BSL_PASSWORD        70
    #define  ERR_NOT_SUPPORTED_BY_BSL      71
    #define  ERR_CLR_LOCKED_MCU            72
    
    #define  TASK_IN_PROGRESS              0xB0	
    
    //errors from MSP-GANG DLL
    #define  ERR_COMM_START                301
    #define  ERR_COMM                      301  // Communication - Frame has errors
    #define  ERR_OPEN_COMM                 302  // Unable to open COM port - already in use?
    #define  ERR_CLOSE_COMM                303  // Unable to close COM port
    #define  ERR_SET_COMM_STATE            304  // Unable to modify COM port state
    #define  ERR_SYNC					   305  // Synchronization failed. Programmer connected?
    #define  ERR_RX_HDR_TIMEOUT            306  // Timeout during operation - Correct COM port selected?
    #define  ERR_WRONG_BAUDRATE            307  // Wrong baud rate specified
    #define  ERR_COMM_BAUDRATE_CHANGE      308  // Comm port baud rate change error
    #define  ERR_COMM_DIAGNOSTIC_RESPONSE  309  // Comm port - diagnostic response error	
    #define  ERR_OPEN_COMM_INVALID_HANDLE  310  // Open Comm port - invalid handle va;ue
    #define  ERR_OPEN_SETUP_COMM           311  // Invalid Comm Port Setup
    #define  ERR_OPEN_COMM_TIMEOUT         312  // Open Comm Port timeout
    #define  ERR_GET_COMM_STATE            313  // Get Comm Port state error
     //from 301-320 - communication errors that can reinitialize communication in GUI
    #define  ERR_COMM_END                  320
    
    // Error Codes reported additionally by GangGetResult() function
    
    #define  ERR_CMD_NOT_COMPLETED         321  // Command did not complete correctly
    #define  ERR_CMD_FAILED                322  // Command failed, is not defined, or is not allowed
    #define  ERR_READ_INI                  323  // Could not read default.mspgangcfg
    #define  ERR_BAD_RECORD                324  // File contains invalid record
    #define  ERR_FILE_END                  325  // Unexpected end of file
    #define  ERR_FILE_IO                   326  // Error during file I/O
    #define  ERR_FILE_DETECT               327  // Selected file is of unrecognizable format
    #define  ERR_FILE_OPEN                 328  // Unable to open file
    #define	 ERR_ARGUMENT                  329  // Function argument(s) out of range
    #define  NOTE_BOOT_DOWNLOADED          330  // Note: Boot downloaded
    #define	 ERR_BUSY_USED_POLLING         331  // Temporary function blocked, due to used main polling
    #define	 ERR_IMAGE_CORRUPTED           332  // Image Memory corrupted or erased
    #define	 ERR_TARGET_NOACCESS           333  // Target not accessible
    #define	 ERR_VERIFY_FAILED             334  // Verification failed
    #define	 ERR_NO_PARMS                  335  // Main Process Parameters not yet set
    #define	 ERR_IMAGE_ERASE               336  // Could not erase Image Buffer
    #define	 ERR_IMAGE_LOAD                337  // Could not load Image Buffer
    #define	 ERR_PARMS_LOAD                338  // Could not load Main Process Parameters
    #define	 ERR_SEL_BAUDRATE              339  // Could not select Baud Rate
    #define	 ERR_SET_VCC                   340  // Could not set target voltage - Short circuitry or settling time too small
    #define	 ERR_WRONG_CMD                 341  // Invalid firmware command
    #define	 ERR_POWER_SUPPLY              342  // Power supply voltage too low
    #define	 ERR_EXT_VCC_IN                343  // Sense voltage out of range - Check pin MSP_VCC_IN of target connector
    #define  ERR_WRONG_DEVICE              344  // Wrong target device connected (the ID of device dosn't match)
    #define  ERR_NO_DEVICE                 345  // No target device connected to MSP-GANG
    #define  ERR_IMAGE_OVERWRITTEN         346  // Code data saved to already used location (overwritten)
    #define	 ERR_IMAGE_NO                  347
    #define	 ERR_CFG_FILE_OPEN_ERR         348  //Config file open error
    #define	 ERR_SCRIPT_HEADER_SIZE_ERR    349
    #define	 ERR_IMAGE_ID                  350
    #define	 ERR_IMAGE_CONTENTS            351
    #define	 ERR_IMAGE_VERIFICATION        352
    #define	 ERR_CODE_OVERWRITTEN          353
    #define	 ERR_CODE_FILE_CONTENTS        354
    #define	 ERR_OPEN_FILE                 355
    #define	 ERR_FILE_NAME                 356
    #define	 ERR_IMAGE_FILE_PASSWORD       357
    #define	 ERR_IMAGE_FILE_PCHW           358
    #define	 ERR_IMAGE_FILE_ID             359
    #define	 ERR_IMAGE_FILE_CS             360
    #define	 ERR_IMAGE_FILE_HEADER         361
    #define	 ERR_IMAGE_FILE_NOT_MSPGANG    362
    #define	 ERR_IMAGE_FILE_CONTENTS       363
    #define	 ERR_IMAGE_FILE_MODE           364
    #define	 ERR_IMAGE_FILE_OFFSET         365
    #define	 ERR_IMAGE_FILE_HEX            366
    #define	 ERR_IMAGE_FILE_CORRUPTED      367
    #define	 ERR_IMAGE_FILE_UNLOCK         368
    #define  ERR_CUSTOMIZED_MCU_LICENSE_FILE_OPEN   369
    #define  ERR_BSL_CODE_WITHIN_BSL_DISABLED       370	
    #define  ERR_INFO_PAGE_OUT_OF_RANGE             371	
    #define  ERR_COM_PORT_SCAN_SIZE                 372
    #define  ERR_SELFTEST_SIZE                      373
    #define  ERR_DATA_SIZE_TOO_HIGH                 374
    #define  ERR_DATA_SIZE_TOO_LOW                  375
    #define  ERR_SIZE_DEFINITION                    376
    #define  ERR_GANG_MASK_ZERO                     377
    #define  ERR_ADDRESS_DEFINITION                 378
    #define  ERR_DATA_SIZE_ZERO                     379
    #define  ERR_DCO_NO_OUT_OF_RANGE                380
    #define  ERR_CODE_NOT_IMPLEMENTED               381
    #define  ERR_TARGET_NO                          382
    #define  ERR_CODE_FILE_ERR                      383
    #define  ERR_PASSWORD_FILE_ERR                  384
    #define  ERR_NOTHING_TO_PROGRAM                 385
    #define  ERR_CODE_OUT_OF_RANGE                  386
    #define  ERR_INVALID_NAME_INDEX                 387
    #define  ERR_IGNORED_PART_OF_THE_CODE           388
    #define  ERR_SCRIPT_SIZE_TOO_HIGH               389
    #define  ERR_BSL_NOT_SUPPORTED                  390
    #define  ERR_IMAGE_DATA_TOO_HIGH				391
    #define  ERR_TERMINATED_BY_USER					392
    #define  ERR_CODE_WITHIN_RETAIN_DATA_SPACE      393
    #define  ERR_NO_OF_TASKS_OUT_OF_RANGE           394
    #define  ERR_TASK_DATA_SIZE_OUT_OF_RANGE        395
    #define  ERR_CODE_OUT_OF_SPACE					396
    #define  ERR_NOT_SUPPORTED_FOR_SELECTED_MCU		397
    #define  ERR_DESTINATION_DEF					398
    #define  ERR_LOCKING_OPTIONS_OUT_OF_SPACE		399
    #define	 ERR_EMPTY_DATA							400
    #define	 ERR_INVALID_PARAMETER					401
    #define	 ERR_IMAGE_READONLY						402
    #define  ERR_CODE_WITHIN_SN_DATA_SPACE          403
    #define  ERR_SIZE_SN_NUMBER						404
    #define  ERR_NOT_DATA_IN_SN						405
    #define  ERR_SN_ADDR_SIZE_DEFINITION			406
    #define  ERR_CODE_WITHIN_MPU_IPE				407
    #define  ERR_EXTERNAL_POWER_RQ					408
    
    #define  ERR_INVALID_NUMBER                     999
    
    // Filetypes
    #define  FILETYPE_AUTO          0      // filetype auto detect (obsolete)
    #define  FILETYPE_TI_TXT        1      // filetype ti text
    #define  FILETYPE_INTEL_HEX     2      // filetype intel hex
    
    #define  SECURE_EN_KEY1         0xA951
    #define  SECURE_EN_KEY2         0xA639
    
    // Remote Command definitions for MSP-GANG
    // ==  commands used in the BOOT - do not use these opcodes
    
    //#define	C_NOCOMMAND             0      // Not a command
    #define	C_CR                    0x0D   // "Hello" commands (two bytes ->  ">\r" without CS )
    #define	C_BOOTCMDDIS            0x2A   // Disable boot commands
    #define	C_BOOTCMDEN             0x2B   // Enable boot commands
    #define	C_DIAGNOSTIC            0x32   // Send errors to Host			
    #define C_SELECTBAUD            0x38   // Select one of five baud rates
    #define	C_ERASEFIRM             0x39   // Erase Firmware in master
    #define	C_LOADFIRM              0x3A   // Update Firmware in master
    #define	C_EXITUPDATE            0x3B   // Write ID, exit generic handler, go to firmware handler
    #define	C_GET_LABEL_A           0x40   // set gang communication status(release etc)
    #define	C_GET_PROGRESS_STATUS   0xA5   //
    #define	   PROGRESS_STATUS_SIZE   48
    
    // ==  End of commands used in the BOOT - =======================
    
    #define C_START                 0x31   // Command Start: Executes main process
    #define	C_ERASEIMAGE            0x33   // Erase image memory
    
    //  all commands 0x40 and over 
    //    even - short address A1, A2
    //    odd  - long  address A1, A2, A3, A4
    
    #define	C_GET_INFO_MEMORY       0x41   // get preferable setup saved in Info-D
    #define	C_WRITE_INFO_MEMORY     0x42
    #define	C_LOADIMAGE             0x43   // must be odd opcode - Load target code into image memory
    #define	C_ACCESS_KEY_ST         0x44
    #define	C_VERIFY_IMAGE_PSA      0x45   // Verify PSA in the SFlash
    #define	C_INTERACTIVE_TASK      0x46
       //response message type with the C_INTERACTIVE_TASK
      #define READ_MEMORY_TYPE      0x10
      #define PROGRESS_STATUS_TYPE  0xA5   // the same as C_GET_PROGRESS_STATUS	0xA5
      #define WAITING_TYPE          0x15
    
    #define	C_READ_IMAGE_HEADER     0x47   // Read data from Image (SFlash)
    #define	C_BOOT_UPDATE           0x48
    #define	C_READ_GANG_BUFFER      0x49
    #define	C_WRITE_GANG_BUFFER     0x4A
    
    #define	C_DISABLE_API_INT       0x4C
    #define	C_SET_IO_STATE          0x4E
    
    #define	C_SELECTIMAGE           0x50   // Select program image: 0..15
    #define	C_DISPLAY_MESAGE        0x54   // display text or graphics on the screen
      #define  DISPLAY_TEXT	        0xA000
      #define  DISPLAY_INV_TEXT     0xA200
      #define  DISPLAY_GRAPHICS     0x5000
      #define  DISPLAY_INV_GRAPHICS 0x5200
    
    #define	C_SET_TMP_GANG_CFG      0x56
    #define	C_GET_APPL_GANG_STATUS  0x58
    
    #define	C_REMOTE_SELFTEST       0x71  // Production test sequence
    
    //============= End of Remote Command definitions for MSP-GANG ================
    
    // Flag definitions for affected memory ranges
    #define	F_DATA_IN_RAM           0x01  // data in ram area
    #define	F_DATA_IN_MAIN          0x02  // data in main area
    #define	F_DATA_IN_INFO          0x04  // data in info area
    
    #define	NO_OF_ACTIVE_IMAGES     (12*8)
    
    #define	TARGET_VCC_MIN          1800  //Vcc in mV	 - min 1.8 V
    #define	TARGET_VCC_MAX          3600  //Vcc in mV	 - max 3.6 V	
    #define	TARGET_VCC_STEP          100  //Vcc in mV	 - step 0.1 V
    
    #define	TARGET_VCC_SETTLE_TIME_MAX		4000  //max 4000 ms
    #define	TARGET_VCC_SETTLE_TIME_STEP       20  //step 20 ms
    
    
    //-----------------------------------------------------------------------------
    #define IMAGE_HEADER_SIZE           256
    
    #define	DATA_ACK                    0x90  // Acknowledge: command executed successfully
    #define	DATA_NAK                    0xA0  // Not Acknowledge: something was wrong
    #define	DATA_INPROGRESS             0xB0  //TASK_IN_PROGRESS->0xB0   Ack - command accepted - and is in progress
    #define	DATA_PROMPT                 0x3E  // '>' Prompt - start char - in the new protocol
    #define CMD_FAILED                  0x70
    #define DATA_FRAME                  0x80
    
    #define	MAX_COM_NO                  256
    #define	MAX_COM_SPEED_INDEX         5
    #define	SECURE_DEV_EN               0xA9
    
    #define GANG_SIZE                   8
    
    #define	INFO_CALDATA_SIZE           0x8
    #define	INFO_CALDATA_ADDR           0x10F8
    
    //====================================================================
    //         Flash definition
    //====================================================================
    
    // ------ Flash Size  definition --------------
    #define	FLASH_SEGM_SIZE				0x200
    #define	FLASH_PRG_START_ADDR		0x1100
    #define	FLASH_START_ADDR			0x1000
    
    #define	FLASH_NO_OF_BSL_SEGMENTS	4					//F5xx - 4 BSL segments
    #define	FLASH_NO_OF_SEGMENTS		(FLASH_BUF_LEN/FLASH_SEGM_SIZE)		//F5xx - max 512 kB
    #define	MAX_FLASH_NO_OF_INFO_SEGM	4
    #define	FLASH_NO_OF_ALL_SEGMENTS	(FLASH_NO_OF_BSL_SEGMENTS + FLASH_NO_OF_SEGMENTS + MAX_FLASH_NO_OF_INFO_SEGM)
    
    #define	JTAG_PASSW_ADDRESS			0xFF80
    #define	BSL_PASSW_ADDRESS			0xFFE0
    #define	BSL_ENH_ADDRESS				0xFFDE
    #define	XBSL_ENH_ADDRESS			0xFFBE
    #define	BSL_ENH_NOT_ERASE_CODE		0x0000
    #define	BSL_ENH_BSL_DISABLED_CODE	0xAA55
    #define	BSL_ENH_ERASE_CODE			0xFFFF
    
    #define PROC_NAME_LEN	    23
    #define JTAG_DEF_LEN	    10
    #define PROC_GROUP_LEN	    16
    
    #define	BSL_X2V_SEGM_MASK			0xF
    
    #define	MAX_FILE_NAME				512
    
    #define	ONE_IMAGE_BLOCK_SIZE		0x10000		// 64 kB
    //========================================================
    //  JTAG fuse restore in the MSP430Xv2 (F5xx, F6xx...)
    //     ----- procedure via Fast BSL only -----
    //========================================================
    #define		BSL3_SEGMENT_ADDR_MIN	0x1600
    #define		BSL3_SEGMENT_SIZE		0x200
    #define		FUSE_XV2_ADDR			0x17FC			//fuse address
    #define		SYSBSLC					0x0182			// Boot strap configuration area register
    #define		SYSBSLOFF				0x4000			// SYS - BSL Memory disabled
    #define		SYSBSLPE				0x8000			// SYS - BSL Memory protection enabled
    
    //====================================================================
    //         MSP432 
    //====================================================================
    #define		ARM_BSL_PASSW_ADDRESS			0x0000
    
    //==================================================================================
    //--------- DLL functions ----------------------------------------------------------
    //==================================================================================
    
    //==============================================================
    // Indexes below used in 
    //		LONG WINAPI MSPGANG_SetConfig( LONG index, LONG data );
    //		LONG WINAPI MSPGANG_GetConfig( LONG index );
    //==============================================================
    
    LONG WINAPI MSPGANG_SetConfig( LONG index, LONG data );
    LONG WINAPI MSPGANG_GetConfig( LONG index );
    
    //list of indexes and acceptable data
    
    #define		FROMIMAGE_BIT				0x1000
    
    #define		CFG_INTERFACE				0
    				#define   INTERFACE_NONE		 0
    				#define   INTERFACE_JTAG		 4
    				#define   INTERFACE_SBW			 8
    				#define   INTERFACE_BSL			 0xC
    				#define   INTERFACE_TYPE_MAX_INDEX		 INTERFACE_BSL
    
    #define		CFG_JTAG_SPEED				1
    				#define   INTERFACE_FAST		 0
    				#define   INTERFACE_MED			 1
    				#define   INTERFACE_SLOW		 2
    				#define   INTERFACE_SPEED_MAX_INDEX		 INTERFACE_SLOW
    
    #define		CFG_SBW_SPEED				2
    				//  INTERFACE_FAST			0
    				//  INTERFACE_MED			1
    				//  INTERFACE_SLOW			2
    
    #define		CFG_BSL_SPEED				3
    				//  INTERFACE_FAST			0
    				//  INTERFACE_MED			1
    				//  INTERFACE_SLOW			2
    
    #define		CFG_IO_INTERFACE			4
    				#define   SBW_VIA_TDOI_BIT		 0x00
    				#define   SBW_VIA_RST_BIT		 0x01
    				//  0  -  SBW_VIA_TDOI  (pin 1)  and TCK/TEST (pin-7/8)
    				//  1  -  SBW_VIA_RST   (pin 11) and TCK/TEST (pin-7/8)
    
    #define		CFG_POWERTARGETEN			6
    				#define   EXTERNAL_POWER_WHOLE_RANGE	0	// external power supply - whole range from Vccmin to Vccmax
    				#define   POWER_SUPPLIED_BY_MSPGANG		1	// targets supplied by MSP-GANG
    				#define   EXTERNAL_POWER_IN_RANGE		2   // external power supply - verified range - selected Vcc +/- 0.3V
    
    #define		CFG_VCCINDEX				7
    				//	Vcc in mV	1800 - 3600
    
    #define		CFG_ICC_HI_EN				8
    				//	disable		0	(up to 30mA from MSP-GANG to each targets)
    				//	enable		1	(up to 50mA from MSP-GANG to each targets)
    
    #define		CFG_BLOWFUSE				9	
    				//	disable		0
    				//	enable		1
    
    #define		CFG_TARGET_EN_INDEX			10
    				//	Targets GANG enable mask - 0x00 ...0xFF. Enable all targets -> 0xFF
    			#define	TARGET_1_MASK		0x01
    			#define	TARGET_2_MASK		0x02
    			#define	TARGET_3_MASK		0x04
    			#define	TARGET_4_MASK		0x08
    			#define	TARGET_5_MASK		0x10
    			#define	TARGET_6_MASK		0x20
    			#define	TARGET_7_MASK		0x40
    			#define	TARGET_8_MASK		0x80
    
    #define		CFG_FLASHERASEMODE			11	
    			#define	ERASE_NONE_MEM_INDEX		0
    			#define	ERASE_ALL_MEM_INDEX			1
    			#define	ERASE_PRG_ONLY_MEM_INDEX	2
    			#define	ERASE_INFILE_MEM_INDEX		3
    			#define	ERASE_DEF_CM_INDEX  		4
    			#define	ERASE_MAX_INDEX  			ERASE_DEF_CM_INDEX
    
    #define		CFG_ERASEINFOA				12	\
    				//	disable		0
    				//	enable		1
    
    #define		CFG_ERASEINFOB				13
    				//	disable		0
    				//	enable		1
    
    #define		CFG_ERASEINFOC				14	
    				//	disable		0
    				//	enable		1
    
    #define		CFG_ERASEINFOD				15	
    				//	disable		0
    				//	enable		1
    
    #define		CFG_MASSERASE_AND_INFOA_EN	16
    				//	disable		0
    				//	enable		1
    
    #define		CFG_ERASESTARTADDR			17	
    				// FLASH/FRAM start erase address
    
    #define		CFG_ERASESTOPADDR			18	
    				// FLASH/FRAM end erase address
    
    #define		CFG_FLASHREADMODE			19	
    				#define	READ_ALL_MEM_INDEX			0
    				#define	READ_PRGMEM_ONLY_INDEX		1
    				#define	READ_INFOMEM_ONLY_INDEX		2
    				#define	READ_DEF_MEM_INDEX			3
    				#define	READ_MEM_MAX_INDEX			READ_DEF_MEM_INDEX
    
    #define		CFG_READINFOA				20	
    				//	disable		0
    				//	enable		1
    
    #define		CFG_READINFOB				21	
    				//	disable		0
    				//	enable		1
    
    #define		CFG_READINFOC				22	
    				//	disable		0
    				//	enable		1
    
    #define		CFG_READINFOD				23
    				//	disable		0
    				//	enable		1
    
    #define		CFG_FINALACTION_MODE		24	
    				#define	APPLICATION_NO_RESET		0
    				#define	APPLICATION_TOGGLE_RESET	1
    				#define	APPLICATION_TOGGLE_VCC		2
    				#define	APPLICATION_JTAG_RESET		3
    				#define	APPLICATION_RESET_MAX_INDEX	  APPLICATION_JTAG_RESET
    
    #define		CFG_BEEPMODE				25	
    					// sum of following bits 
    				#define	BEEP_PCSPK_EN_BIT			1		//Beep via PC Speaker enable
    				#define	BEEP_OK_EN_BIT				2		//Beep when OK enable
    				#define	BEEP_SOUND_EN_BIT			4		//Sound enable
    
    #define		CFG_DEFERASEMAINEN			26	
    				//	disable		0
    				//	enable		1
    
    #define		CFG_CUSTOMRESETPULSETIME	27
    				//  time in ms  1.....2000
    
    #define		CFG_CUSTOMRESETIDLETIME		28
    				//  time in ms  1.....2000
    
    #define		CFG_BSL_ENH_ENABLE			29
    				//	disable		0
    				//	enable		1
    
    #define		CFG_BSL_ENH_INDEX			30
    				//for future usage
    				#define	BSL_ENH_DISABLE				0
    				#define	BSL_ENH_NONE				1
    				#define	BSL_ENH_ERASE				2
    				#define	BSL_ENH_MAX_INDEX			2
    
    #define		CFG_RETAIN_CAL_DATA_INDEX	31
    				//	disable		0
    				//	enable		1
    
    #define		CFG_FINALACTIONRUNTIME		32
    				//	0 - infinite, 
    				//  1...120 time in seconds
    
    #define		CFG_FINALACTIONVCCOFFTIME	33
    				// Vcc-OFF (then again ON) time after programming when the 
    				// APPLICATION_TOGGLE_VCC option is selected.
    
    #define		CFG_DCO_CONST_2XX_VERIFY_EN	35
    				//	disable		0
    				//	enable		1
    
    #define		CFG_DCOCAL_2XX_EN			36
    				//	disable		0
    				//	enable		1
    
    #define		CFG_BSL_FLASH_WR_EN			37
    				//	mask for 4 BSL segments - disable->0, enable->1
    				//	bit 0 -> 0x01    BSL segment 1
    				//	bit 1 -> 0x02    BSL segment 2
    				//	bit 2 -> 0x04    BSL segment 3
    				//	bit 3 -> 0x08    BSL segment 4
    
    #define		CFG_BSL_FLASH_RD_EN			38
    				//	mask for 4 BSL segments - disable->0, enable->1
    				//	bit 0 -> 0x01    BSL segment 1
    				//	bit 1 -> 0x02    BSL segment 2
    				//	bit 2 -> 0x04    BSL segment 3
    				//	bit 3 -> 0x08    BSL segment 4
    
    #define		CFG_READMAINMEMEN			39
    				//	disable		0
    				//	enable		1
    
    #define		CFG_READDEFSTARTADDR		40
    				// Memory READ start address
    
    #define		CFG_READDEFSTOPADDR			41
    				// Memory READ end address
    
    #define		CFG_COMPORT_NO				42
    				// Communication COM Port number - 0..255
    
    #define		CFG_UART_SPEED				43
    				// Baud Rate index
    				#define	UART_9600			0
    				#define	UART_19200			1
    				#define	UART_38400			2
    				#define	UART_57600			3
    				#define	UART_115200			4	
    
    #define		CFG_OPEN_FILE_TYPE			44
    				#define		CODE_FILE_INDEX				0
    				#define		APPEND_FILE_INDEX			1
    				#define		PASSW_FILE_INDEX			2
    				#define		SECONDCODE_FILE_INDEX		3
    				#define		CODE2_FILE_INDEX			4
    
    #define		CFG_USE_SCRIPT_FILE  		45
    				//	disable		0
    				//	enable		1
    
    #define		CFG_IMAGE_NO				46
    				//image number - 0...9
    
    #define		CFG_RESETTIME				47
    				#define	RESET_10MS_INDEX			0
    				#define	RESET_100MS_INDEX			1
    				#define	RESET_200MS_INDEX			2
    				#define	RESET_500MS_INDEX			3
    				#define	RESET_CUSTOM_INDEX			4
    				#define	RESET_MAX_INDEX				RESET_CUSTOM_INDEX
    
    #define		CFG_PROJECT_SOURCE			48
    				#define	INTERACTIVE_MODE			0
    				#define	FROM_IMAGE_MEMORY_MODE		1
    				#define	STANDALONE_MODE				2
    				#define	FROM_IMAGE_FILE_MODE		3
    				#define	PROJECT_SOURCE_MAX_INDEX	FROM_IMAGE_FILE_MODE
    
    #define		CFG_COPY_CFG_FROM_MEMORY_EN	49
    				//	Direct (eg. Interactive)    0       
    				//	From Image memory	        1
    
    #define		CFG_RUNNING_SCRIPT_MODE		50
    				#define		RUNNING_SCRIPT_NONE		0
    				#define		RUNNING_SCRIPT_ONLINE	1
    				#define		RUNNING_SCRIPT_OFFLINE	2
    
    #define		CFG_VCC_SETTLE_TIME			51
    				//	Vss settle time in step 20 ms. Range 0...200 ( time 0...4000 ms)
    
    #define		CFG_JTAG_UNLOCK_EN			52
    				//	disable		0
    				//	enable		1
    
    #define		CFG_CODE2_FILE_EN			53
    				//	disable		0
    				//	enable		1
    #define		CFG_BSL_FIRST_PASSWORD		54
    				#define		BSL_ANY_PASSW						0
    				#define		BSL_PASSW_FROM_CODE_FILE			1
    				#define		BSL_PASSW_FROM_PASSWORD_FILE		2
    				#define		BSL_EMPTY_PASSW						3
    
    #define		CFG_DEFINED_RETAIN_DATA_EN	55
    				//	disable		0
    				//	enable		1
    #define		CFG_DEFINED_RETAIN_START_ADDR	56
    	//address must be even
    #define		CFG_DEFINED_RETAIN_END_ADDR		57
        //address must be odd
    	#define	DEFINED_RETAIN_DATA_MAX_SIZE	0x40
    	// END_ADDR - START_ADDR + 1  <= DEFINED_RETAIN_DATA_MAX_SIZE 
    
    #define		CFG_SECURE_CODE_SOURCE			58
    		enum {USER_SOURCE=0, FILE_SOURCE=1};
    
    #define		CFG_MSP432_CLR_LOCKING_OPTIONS	59
    		#define	MSP432_CLR_LOCKING_INFOA_BIT	0x01
    		#define	MSP432_CLR_LOCKING_BSL_BIT		0x02
    		#define	MSP432_CLR_LOCKING_MASK			( MSP432_CLR_LOCKING_INFOA_BIT | MSP432_CLR_LOCKING_BSL_BIT ) 
    
    
    #define		CFG_WRDEF_EXCLUDE_SECTIONS		60
    				//	mask for 4 Read_Defined excluded sections disable->0, enable->1
    				//	bit 0 -> 0x01    section 1
    				//	bit 1 -> 0x02    section 2
    				//	bit 2 -> 0x04    section 3
    				//	bit 3 -> 0x08    section 4
    
    #define		CFG_RDDEF_EXCLUDE_SECTIONS		61
    				//	mask for 4 Read_Defined excluded sections disable->0, enable->1
    				//	bit 0 -> 0x01    section 1
    				//	bit 1 -> 0x02    section 2
    				//	bit 2 -> 0x04    section 3
    				//	bit 3 -> 0x08    section 4
    
    #define		CFG_WRDEF_EXCLUDE_S1_START_ADDR	62
    #define		CFG_WRDEF_EXCLUDE_S1_END_ADDR		63
    #define		CFG_WRDEF_EXCLUDE_S2_START_ADDR	64
    #define		CFG_WRDEF_EXCLUDE_S2_END_ADDR		65
    #define		CFG_WRDEF_EXCLUDE_S3_START_ADDR	66
    #define		CFG_WRDEF_EXCLUDE_S3_END_ADDR		67
    #define		CFG_WRDEF_EXCLUDE_S4_START_ADDR	68
    #define		CFG_WRDEF_EXCLUDE_S4_END_ADDR		69
    
    #define		CFG_RDDEF_EXCLUDE_S1_START_ADDR	70
    #define		CFG_RDDEF_EXCLUDE_S1_END_ADDR		71
    #define		CFG_RDDEF_EXCLUDE_S2_START_ADDR	72
    #define		CFG_RDDEF_EXCLUDE_S2_END_ADDR		73
    #define		CFG_RDDEF_EXCLUDE_S3_START_ADDR	74
    #define		CFG_RDDEF_EXCLUDE_S3_END_ADDR		75
    #define		CFG_RDDEF_EXCLUDE_S4_START_ADDR	76
    #define		CFG_RDDEF_EXCLUDE_S4_END_ADDR		77
    
    #define		CFG_RD_TLV_EN					78
    
    #define		CFG_SERIALIZATION_EN					80
    				//	disable		0
    				//	enable		1
    #define		CFG_SN_ADDRESS_IN_MEMORY				81
    				//address must be even
    #define		CFG_SN_DATA_SIZE_IN_BYTES				82
    				//Size must be even 2...16
    	#define	SN_DATA_MAX_SIZE			16
    #define		CFG_SN_REMOVE_CODE_FROM_SN_LOCATION		83
    				//	disable		0
    				//	enable		1
    #define		CFG_SN_SOURCE							84
    			#define	SN_SOURCE_DEFINED		0
    			#define	SN_SOURCE_FROM_FILE		1
    				// 0 - defined
    				// 1 - from file
    #define		CFG_SN_FORMAT_IN_MEMORY					85
    			#define	SN_FORMAT_LSB_FIRST		0
    			#define	SN_FORMAT_MSB_FIRST		1
    
    #define		CFG_SN_DATA_INCREMENT					86
    #define		CFG_INIT_SN_DATA_0						87
    		//Bits 0-31 of the SN init data
    #define		CFG_INIT_SN_DATA_1						(CFG_INIT_SN_DATA_0+1)
    		//Bits 32-63 of the SN init data
    #define		CFG_INIT_SN_DATA_2						(CFG_INIT_SN_DATA_0+2)
    		//Bits 64-91 of the SN init data
    #define		CFG_INIT_SN_DATA_3						(CFG_INIT_SN_DATA_0+3)
    		//Bits 92-127 of the SN init data
    #define		CFG_SN_DESTINATION						91
    			#define	NUMBER_TO_FLASH			0
    			#define	NUMBER_TO_MAC_REG		1
    
    #define		CFG_MPU_IPE_WR_LOCKED					92
    				//	disable		0
    				//	enable		1
    #define		CFG_MPU_IPE_WR_UNLOCKED					93
    				//	disable		0
    				//	enable		1
    #define		CFG_MPU_IPE_RD_UNLOCKED					94
    				//	disable		0
    				//	enable		1
    #define		CFG_MPU_IPE_START_ADDR					95
    #define		CFG_MPU_IPE_END_ADDR					96
    
    
    
    #define		CFG_ADDITIONAL_COMPORT_NO		200
    		// 0 - disable (default)
    		// 1-255 added COM port number 1-255
    
    
    // MSP432P protection configuration
    #define		CFG_MSP432_MB_CMD									300
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_SECEN					301	
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_INIT_VECT0			302
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_INIT_VECT1			303
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_INIT_VECT2			304
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_INIT_VECT3			305
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_SECKEYS0			306
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_SECKEYS1			307
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_SECKEYS2			308
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_SECKEYS3			309
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_SECKEYS4			310
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_SECKEYS5			311
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_SECKEYS6			312
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_AES_SECKEYS7			313
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_UNENC_PWD0				314
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_UNENC_PWD1				315
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_UNENC_PWD2				316
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_UNENC_PWD3				317
    #define		CFG_MSP432_MB_SEC_ZONE0_SECEN						318
    #define		CFG_MSP432_MB_SEC_ZONE0_START_ADDR					319
    #define		CFG_MSP432_MB_SEC_ZONE0_LENGTH						320
    #define		CFG_MSP432_MB_SEC_ZONE0_AESINIT_VECT0				321
    #define		CFG_MSP432_MB_SEC_ZONE0_AESINIT_VECT1				322
    #define		CFG_MSP432_MB_SEC_ZONE0_AESINIT_VECT2				323
    #define		CFG_MSP432_MB_SEC_ZONE0_AESINIT_VECT3				324
    #define		CFG_MSP432_MB_SEC_ZONE0_SECKEYS0					325
    #define		CFG_MSP432_MB_SEC_ZONE0_SECKEYS1					326
    #define		CFG_MSP432_MB_SEC_ZONE0_SECKEYS2					327
    #define		CFG_MSP432_MB_SEC_ZONE0_SECKEYS3					328
    #define		CFG_MSP432_MB_SEC_ZONE0_SECKEYS4					329
    #define		CFG_MSP432_MB_SEC_ZONE0_SECKEYS5					330
    #define		CFG_MSP432_MB_SEC_ZONE0_SECKEYS6					331
    #define		CFG_MSP432_MB_SEC_ZONE0_SECKEYS7					332
    #define		CFG_MSP432_MB_SEC_ZONE0_UNENC_PWD0					333
    #define		CFG_MSP432_MB_SEC_ZONE0_UNENC_PWD1					334
    #define		CFG_MSP432_MB_SEC_ZONE0_UNENC_PWD2					335
    #define		CFG_MSP432_MB_SEC_ZONE0_UNENC_PWD3					336
    #define		CFG_MSP432_MB_SEC_ZONE0_ENCUPDATE_EN				337
    #define		CFG_MSP432_MB_SEC_ZONE0_DATA_EN						338
    #define		CFG_MSP432_MB_SEC_ZONE1_SECEN						339
    #define		CFG_MSP432_MB_SEC_ZONE1_START_ADDR					340
    #define		CFG_MSP432_MB_SEC_ZONE1_LENGTH						341
    #define		CFG_MSP432_MB_SEC_ZONE1_AESINIT_VECT0				342
    #define		CFG_MSP432_MB_SEC_ZONE1_AESINIT_VECT1				343
    #define		CFG_MSP432_MB_SEC_ZONE1_AESINIT_VECT2				344
    #define		CFG_MSP432_MB_SEC_ZONE1_AESINIT_VECT3				345
    #define		CFG_MSP432_MB_SEC_ZONE1_SECKEYS0					346
    #define		CFG_MSP432_MB_SEC_ZONE1_SECKEYS1					347
    #define		CFG_MSP432_MB_SEC_ZONE1_SECKEYS2					348
    #define		CFG_MSP432_MB_SEC_ZONE1_SECKEYS3					349
    #define		CFG_MSP432_MB_SEC_ZONE1_SECKEYS4					350
    #define		CFG_MSP432_MB_SEC_ZONE1_SECKEYS5					351
    #define		CFG_MSP432_MB_SEC_ZONE1_SECKEYS6					352
    #define		CFG_MSP432_MB_SEC_ZONE1_SECKEYS7					353
    #define		CFG_MSP432_MB_SEC_ZONE1_UNENC_PWD0					354
    #define		CFG_MSP432_MB_SEC_ZONE1_UNENC_PWD1					355
    #define		CFG_MSP432_MB_SEC_ZONE1_UNENC_PWD2					356
    #define		CFG_MSP432_MB_SEC_ZONE1_UNENC_PWD3					357
    #define		CFG_MSP432_MB_SEC_ZONE1_ENCUPDATE_EN				358
    #define		CFG_MSP432_MB_SEC_ZONE1_DATA_EN						359
    #define		CFG_MSP432_MB_SEC_ZONE2_SECEN						360
    #define		CFG_MSP432_MB_SEC_ZONE2_START_ADDR					361
    #define		CFG_MSP432_MB_SEC_ZONE2_LENGTH						362
    #define		CFG_MSP432_MB_SEC_ZONE2_AESINIT_VECT0				363
    #define		CFG_MSP432_MB_SEC_ZONE2_AESINIT_VECT1				364
    #define		CFG_MSP432_MB_SEC_ZONE2_AESINIT_VECT2				365
    #define		CFG_MSP432_MB_SEC_ZONE2_AESINIT_VECT3				366
    #define		CFG_MSP432_MB_SEC_ZONE2_SECKEYS0					367
    #define		CFG_MSP432_MB_SEC_ZONE2_SECKEYS1					368
    #define		CFG_MSP432_MB_SEC_ZONE2_SECKEYS2					369
    #define		CFG_MSP432_MB_SEC_ZONE2_SECKEYS3					370
    #define		CFG_MSP432_MB_SEC_ZONE2_SECKEYS4					371
    #define		CFG_MSP432_MB_SEC_ZONE2_SECKEYS5					372
    #define		CFG_MSP432_MB_SEC_ZONE2_SECKEYS6					373
    #define		CFG_MSP432_MB_SEC_ZONE2_SECKEYS7					374
    #define		CFG_MSP432_MB_SEC_ZONE2_UNENC_PWD0					375
    #define		CFG_MSP432_MB_SEC_ZONE2_UNENC_PWD1					376
    #define		CFG_MSP432_MB_SEC_ZONE2_UNENC_PWD2					377
    #define		CFG_MSP432_MB_SEC_ZONE2_UNENC_PWD3					378
    #define		CFG_MSP432_MB_SEC_ZONE2_ENCUPDATE_EN				379
    #define		CFG_MSP432_MB_SEC_ZONE2_DATA_EN						380
    #define		CFG_MSP432_MB_SEC_ZONE3_SECEN						381
    #define		CFG_MSP432_MB_SEC_ZONE3_START_ADDR					382
    #define		CFG_MSP432_MB_SEC_ZONE3_LENGTH						383
    #define		CFG_MSP432_MB_SEC_ZONE3_AESINIT_VECT0				384
    #define		CFG_MSP432_MB_SEC_ZONE3_AESINIT_VECT1				385
    #define		CFG_MSP432_MB_SEC_ZONE3_AESINIT_VECT2				386
    #define		CFG_MSP432_MB_SEC_ZONE3_AESINIT_VECT3				387
    #define		CFG_MSP432_MB_SEC_ZONE3_SECKEYS0					388
    #define		CFG_MSP432_MB_SEC_ZONE3_SECKEYS1					389
    #define		CFG_MSP432_MB_SEC_ZONE3_SECKEYS2					390
    #define		CFG_MSP432_MB_SEC_ZONE3_SECKEYS3					391
    #define		CFG_MSP432_MB_SEC_ZONE3_SECKEYS4					392
    #define		CFG_MSP432_MB_SEC_ZONE3_SECKEYS5					393
    #define		CFG_MSP432_MB_SEC_ZONE3_SECKEYS6					394
    #define		CFG_MSP432_MB_SEC_ZONE3_SECKEYS7					395
    #define		CFG_MSP432_MB_SEC_ZONE3_UNENC_PWD0					396
    #define		CFG_MSP432_MB_SEC_ZONE3_UNENC_PWD1					397
    #define		CFG_MSP432_MB_SEC_ZONE3_UNENC_PWD2					398
    #define		CFG_MSP432_MB_SEC_ZONE3_UNENC_PWD3					399
    #define		CFG_MSP432_MB_SEC_ZONE3_ENCUPDATE_EN				400
    #define		CFG_MSP432_MB_SEC_ZONE3_DATA_EN						401
    #define		CFG_MSP432_MB_BSL_EABLE								402
    #define		CFG_MSP432_MB_BSL_START_ADDR						403
    #define		CFG_MSP432_MB_BSL_HARD_INV_PARAMS					404
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_ENCPAYLOADADDR			405
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_ENCPAYLOADLEN			406
    #define		CFG_MSP432_MB_JTAG_SWD_LOCK_DST_ADDR				407
    #define		CFG_MSP432_MB_SEC_ZONE0_PAYLOADADDR					408
    #define		CFG_MSP432_MB_SEC_ZONE0_PAYLOADLEN					409
    #define		CFG_MSP432_MB_SEC_ZONE1_PAYLOADADDR					410
    #define		CFG_MSP432_MB_SEC_ZONE1_PAYLOADLEN					411
    #define		CFG_MSP432_MB_SEC_ZONE2_PAYLOADADDR					412
    #define		CFG_MSP432_MB_SEC_ZONE2_PAYLOADLEN					413
    #define		CFG_MSP432_MB_SEC_ZONE3_PAYLOADADDR					414
    #define		CFG_MSP432_MB_SEC_ZONE3_PAYLOADLEN					415
    #define		CFG_MSP432_MB_FACTORY_RESET_ENABLE					416
    #define		CFG_MSP432_MB_FACTORY_RESET_PWDEN					417
    #define		CFG_MSP432_MB_FACTORY_RESET_PWD0					418
    #define		CFG_MSP432_MB_FACTORY_RESET_PWD1					419
    #define		CFG_MSP432_MB_FACTORY_RESET_PWD2					420
    #define		CFG_MSP432_MB_FACTORY_RESET_PWD3					421	
    #define		CFG_MSP432_MB_FACTORY_RESET_PASSWORD0				422
    #define		CFG_MSP432_MB_FACTORY_RESET_PASSWORD1				423
    #define		CFG_MSP432_MB_FACTORY_RESET_PASSWORD2				424
    #define		CFG_MSP432_MB_FACTORY_RESET_PASSWORD3				425
    
    // MSP432E protection configuration
    
    #define		CFG_MSP432E_FMPREADEN0_DATA				430
    #define		CFG_MSP432E_FMPREADEN1_DATA				431
    #define		CFG_MSP432E_FMPREADEN2_DATA				432
    #define		CFG_MSP432E_FMPREADEN3_DATA				433
    #define		CFG_MSP432E_FMPREADEN4_DATA				434
    #define		CFG_MSP432E_FMPREADEN5_DATA				435
    #define		CFG_MSP432E_FMPREADEN6_DATA				436
    #define		CFG_MSP432E_FMPREADEN7_DATA				437
    #define		CFG_MSP432E_FMPREADEN8_DATA				438
    #define		CFG_MSP432E_FMPREADEN9_DATA				439
    #define		CFG_MSP432E_FMPREADEN10_DATA			440
    #define		CFG_MSP432E_FMPREADEN11_DATA			441
    #define		CFG_MSP432E_FMPREADEN12_DATA			442
    #define		CFG_MSP432E_FMPREADEN13_DATA			443
    #define		CFG_MSP432E_FMPREADEN14_DATA			444
    #define		CFG_MSP432E_FMPREADEN15_DATA			445
    #define		CFG_MSP432E_FMPPRGEN0_DATA				446
    #define		CFG_MSP432E_FMPPRGEN1_DATA				447
    #define		CFG_MSP432E_FMPPRGEN2_DATA				448
    #define		CFG_MSP432E_FMPPRGEN3_DATA				449
    #define		CFG_MSP432E_FMPPRGEN4_DATA				450
    #define		CFG_MSP432E_FMPPRGEN5_DATA				451
    #define		CFG_MSP432E_FMPPRGEN6_DATA				452
    #define		CFG_MSP432E_FMPPRGEN7_DATA				453
    #define		CFG_MSP432E_FMPPRGEN8_DATA				454
    #define		CFG_MSP432E_FMPPRGEN9_DATA				455
    #define		CFG_MSP432E_FMPPRGEN10_DATA				456
    #define		CFG_MSP432E_FMPPRGEN11_DATA				457
    #define		CFG_MSP432E_FMPPRGEN12_DATA				458
    #define		CFG_MSP432E_FMPPRGEN13_DATA				459
    #define		CFG_MSP432E_FMPPRGEN14_DATA				460
    #define		CFG_MSP432E_FMPPRGEN15_DATA				461
    #define		CFG_MSP432E_USER_REG0					462
    #define		CFG_MSP432E_USER_REG1					463
    #define		CFG_MSP432E_USER_REG2					464
    #define		CFG_MSP432E_USER_REG3					465
    #define		CFG_MSP432E_USERDEBUGDATA				466
    #define		CFG_MSP432E_FP_REG_WREN					467
    #define		CFG_MSP432E_USER_REG_WREN				468
    #define		CFG_MSP432E_DBG_REG_WREN				469
    #define		CFG_MSP432E_PROTECTION_SOURCE			470
    
    
    
    //---------- end of configuration setup indexes and data list --------------------
    
    //The MSPGANG_Set_MCU_Name set the desired target's MCU
    // Arguments: LPTSTR MCU name - without spaces eg MSP430F5438A
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_Set_MCU_Name( LPTSTR name );
    
    //The MSPGANG_Check_MCU_Name check if the MCU with specified MCU_name is supported
    // Arguments: LPTSTR MCU name - without spaces eg MSP430F5438A
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_Check_MCU_Name( LPTSTR name );
    
    //MSPGANG_SetTmpGANG_Config set temporaty configuration that is restored
    //to original configuration afte the mein or interractive process is finished
    // Arguments: LONG index, data
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_SetTmpGANG_Config( LONG no, LONG data );
    //----- TMP_CFG_INDEX and data --------
    #define   CFG_TMP_CLEAR         2
    		//data  - none
    
    #define   CFG_TMP_TASK_MASK     4
    			//---  task mask bits ---- - for all tasks - set 0xFFFF
    			#define	CONNECT_TASK_BIT     0x0001
    			#define	ERASE_TASK_BIT       0x0002
    			#define	BLANKCHECK_TASK_BIT  0x0004
    			#define	PROGRAM_TASK_BIT     0x0008
    			#define	VERIFY_TASK_BIT   	 0x0010
    			#define	SECURE_TASK_BIT      0x0020
    			#define	DCO_CAL_TASK_BIT     0x0040
    			//spare              		0x0080 to 0x4000
    			#define	RST_AND_START_FW_BIT 0x8000
    
    #define   CFG_TMP_VCC_VALUE     6
    			// Vcc in mV - 1800 ...3600
    
    #define   CFG_TMP_POWER_VCC_EN  8
    			//	disable		0
    			//	enable		1
    
    #define   CFG_TMP_INTERFACE     10
    			// (INTERFACE_JTAG  |  INTERFACE_FAST)
    			// (INTERFACE_JTAG  |  INTERFACE_MED)
    			// (INTERFACE_JTAG  |  INTERFACE_SLOW)
    			// (INTERFACE_SBW  |  INTERFACE_FAST)
    			// (INTERFACE_SBW  |  INTERFACE_MED)
    			// (INTERFACE_SBW  |  INTERFACE_SLOW)
    
    #define   CFG_TMP_GANG_MASK     12
    			//	Targets GANG enable mask - 0x00 ...0xFF. Enable all targets -> 0xFF
    			//	TARGET_1_MASK		0x01
    			//	TARGET_2_MASK		0x02
    			//	TARGET_3_MASK		0x04
    			//	TARGET_4_MASK		0x08
    			//	TARGET_5_MASK		0x10
    			//	TARGET_6_MASK		0x20
    			//	TARGET_7_MASK		0x40
    			//	TARGET_8_MASK		0x80
    
    #define   CFG_TMP_VCC_ONOFF     14
    			//	disable		0
    			//	enable		1
    
    #define   CFG_LCD_CONTRAST      16
    			//	0x00 --0x3F
    
    #define   CFG_TMP_ICC_HI_EN     18
    			//	disable		0
    			//	enable		1
    
    #define   CFG_TMP_IO_INTERFACE  20
    			//  0  -  SBW_VIA_TDOI  (pin 1)  and TCK/TEST (pin-7/8)
    			//  1  -  SBW_VIA_RST   (pin 11) and TCK/TEST (pin-7/8)
    
    #define   CFG_TMP_RESET			22	
    			//	disable		0
    			//	enable		1
    
    #define   CFG_TMP_KEYBOARD_EN   24
    			//	disable		0
    			//	enable		1
    
    #define   CFG_TMP_VCC_SETTLE_TIME  26
    			// 0...200  Vcc settle time in 20 ms increment (t = 0...4000 ms)
    
    #define   CFG_TMP_CUMULATIVE_ST_EN  28
                // 0   - disable 
                // 1   - enable     ( default )     
    #define   CFG_WRAPPER_MASK			30
    			// used in the DLL wrapper of the MSP-GANG430 only. Do not use it.
    #define   CFG_WRAPPER_EN_KEY		32
    			// used in the DLL wrapper of the MSP-GANG430 only. Do not use it.
    #define   CFG_WRAPPER_GANG_MASK		34
    			// used in the DLL wrapper of the MSP-GANG430 only. Do not use it.
    #define   CFG_TMP_BSL_1ST_PASSW		36	
    			//	#define		BSL_ANY_PASSW						0
    			//	#define		BSL_PASSW_FROM_CODE_FILE			1
    			//	#define		BSL_PASSW_FROM_PASSWORD_FILE		2
    			//	#define		BSL_EMPTY_PASSW						3
    
    #define   CFG_DISABLE_TASK_MASK		38
    
    #define   CFG_TMP_MAX_INDEX			CFG_DISABLE_TASK_MASK
    
    //===  end of MSPGANG_SetTmpGANG_Config ===============
    
    
    
    //	MSPGANG_GetNameConfig
    //	MSPGANG_SetNameConfig
    // Set - Get file names of current code /script / password / sounds files
    // Arguments: LONG index, File name
    LPTSTR WINAPI MSPGANG_GetNameConfig( LONG index );
    LONG WINAPI MSPGANG_SetNameConfig( LONG index, LPTSTR name );
    #define		CODEFILE_INDEX			0
    #define		SCRIPTFILE_INDEX		1
    #define		PASSWORDFILE_INDEX		2
    #define		SOUNDERRFILE_INDEX		3
    #define		SOUNDOKFILE_INDEX		4
    #define		SOUNDWARNINGFILE_INDEX	5
    #define		CODE_2_FILE_INDEX		6
    #define		IMAGE_FILE_INDEX		7
    #define		SN_LOG_FILE_INDEX		8
    #define		SN_DATA_FILE_INDEX		9
    #define		NAMECFG_MAX_INDEX		SN_DATA_FILE_INDEX
    
    
    //Access to all codes, data and passwords buffers and flags 
    //See below buffers structure
    //get ptr to 'DATA_BUFFERS dat' inside the MSP-GANG.dll
    
    LONG WINAPI MSPGANG_GetDataBuffers_ptr( void ** x );
    
    #define	DBUFFER_SIZE			0x210000
    #define	JTAG_PASSW_LEN			0x80
    #define	BSL_PASSW_LEN			0x20	//MSP430	
    #define	ARM_BSL_PASSW_LEN		0x100	//MSP432
    #define	MAX_BSL_PASSW_LEN		0x100	//max from (ARM_BSL_PASSW_LEN, BSL_PASSW_LEN)
    #define	MAX_PASSW_LEN			0x100	//max from (ARM_BSL_PASSW_LEN, BSL_PASSW_LEN, JTAG_PASSW_LEN ) 
    #define	FLASH_END_ADDR			(DBUFFER_SIZE-1)
    #define	FLASH_BUF_LEN			DBUFFER_SIZE
    #define GANG_SIZE				8
    
    typedef struct
    {
    	BYTE	SourceCode[DBUFFER_SIZE];			//source code from the file 
    	BYTE	UsedCode[DBUFFER_SIZE];				//combined data (source code, serialization etc) 
    	BYTE	GangRx[DBUFFER_SIZE][GANG_SIZE];	//data read from all targets 	
    	BYTE	Tmp[DBUFFER_SIZE];					//used for second file cmp
    	BYTE	Flag_ScrCode[DBUFFER_SIZE];			//0 - empty	 1-Code1, 2-Code2, 4-Appended Code in  SourceCode[x];
    			#define		CODE1_FLAG			1
    			#define		CODE2_FLAG			2
    			#define		APPEND_CODE_FLAG	4
    	BYTE	Flag_UsedCode[DBUFFER_SIZE];		//0 - empty	 1-valid data  in  UsedCode[x];
    	BYTE	Flag_WrEn[DBUFFER_SIZE];			//0 - none	 1-write/verify enable in FlashMem[x]
    	BYTE	Flag_EraseEn[DBUFFER_SIZE];			//0 - none	 1-erase enable	in FlashMem[x]
    	BYTE	Flag_RdEn[DBUFFER_SIZE];			//0 - none	 1-read enable in FlashMem[x]
    	BYTE	Flag_Sp3[DBUFFER_SIZE];				//used internally
    	BYTE	JTAG_Passsword[2][JTAG_PASSW_LEN];
    	BYTE	BSL_Passsword[2][MAX_BSL_PASSW_LEN];
    	BYTE	Flag_JTAG_Passw[2][JTAG_PASSW_LEN];	// [0][..]-password from code file;  [1][..]-password from password file
    	BYTE	Flag_BSL_Passw[2][MAX_BSL_PASSW_LEN];	// [0][..]-password from code file;  [1][..]-password from password file
    } DATA_BUFFERS;
    extern	DATA_BUFFERS  dat;
    
    LONG WINAPI MSPGANG_Convert_Address( BYTE type, LONG Addr );
    #define     MCU_TO_DATABUF      1
    #define     DATABUF_TO_MCU      2
    
    LPTSTR WINAPI MSPGANG_Memory_Header_text( LONG Addr );
    #define     MEM_HEADER_TXT_SIZE   200
    
    
    // Write/Read  to/from internal RAM buffer GangBuffer[128][8] inside the MSP-GANG programmer.
    // Buffer can contains unique data to each target that should be copied from buffer to target's RAM or FLASH.
    // All unique data, even if are not the same contents can be copied simultaneously to each target devices using
    // MSPGANG_Interactive_Copy_GANG_Buffer_to_RAM( LONG addr, LONG size )
    // and MSPGANG_Interactive_Copy_GANG_Buffer_to_FLASH( LONG addr, LONG size );
    // Prepare data to each target using MSPGANG_SetGangBuffer to write data to GangBuffer[target-1][size];
    // Target number -> 1...8
    // When the Serial Number is read/write for using with option - Autoprogram (GO), then size buffer is limited
    // to 32 bytes and with the target number the SN_DATA_FLAG must be added, e.g
    // MSPGANG_SetGangBuffer( SN_DATA_FLAG | target, size, data );
    
    #define		GANG_DATA_BUF_SIZE		128
    #define		SN_GANG_BUF_SIZE	     SN_DATA_MAX_SIZE
    #define		TARGET_MASK				0x1F
    #define		SN_DATA_FLAG			0x40
    LONG WINAPI MSPGANG_GetGangBuffer( BYTE target, BYTE size, BYTE *data );
    LONG WINAPI MSPGANG_SetGangBuffer( BYTE target, BYTE size, BYTE *data );
    
    //-- MSPGANG_LoadFirmware ---------------------------------------------------------
    // loads the firmware memory at the programmer from build-in the DLL code table contents
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_LoadFirmware( void );
    
    
    //The MSPGANG_HW_devices reads all available COM ports. See structure below for details
    // ARGUMENT - pointer to internal structure inside the MSP-GANG.dll
    // Result:    LONG (error code)
    LONG  WINAPI MSPGANG_HW_devices( LONG max, void ** AvailableComPorts );
    
    #define HW_NAME_SIZE	30
    typedef union
    {
    	unsigned char bytes[HW_NAME_SIZE];
    	struct
    	{
    		unsigned short ComNo; 			
    		char		   ComName[7]; 			
    		char		   description[HW_NAME_SIZE-2-7];
    	}x;
    }COM_PORTS_DEF;
    
    
    //-- MSPGANG_InitCom ------------------------------------------------------------------
    // InitCom opens a communications port, sets the baudrate and checks if the
    // MSP-GANG is present
    // Arguments: char * lpszComPort (the name of the port) eg> "\\\\.\\COM3"
    //            LONG lBaudRate (the baud rate)
    // Result:    LONG (error code)
    // Note: It is recommended to call the MSPGANG_HW_devices(..) (see above) function first and check
    //       available com ports. The USB COM port for the MSP-GANG, if detectec, is listed as the first.
    LONG WINAPI MSPGANG_InitCom( LPTSTR lpszPort, LONG lBaud);
    
    //-- MSPGANG_ReleaseCom ---------------------------------------------------------------
    // ReleaseCom releases the communications port
    // Arguments: none
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_ReleaseCom(void);
    
    //-- GetErrorString -----------------------------------------------------------
    // retrieves the pointer to the error string belonging to the error number
    // Arguments: LONG lErrorNumber (the error number)
    // Result:    CHAR* (the pointer to the error string)
    LPTSTR WINAPI MSPGANG_GetErrorString(LONG lErrorNumber);
    
    //-- MSPGANG_GetDevice ----------------------------------------------------------------
    // reads all specific parameters of a device type from MSP-GANG.dll and allocate
    // them in a buffer pointed to by lpData (see structure below).	
    // Arguments: LPTSTR - MCUname (name without spaces) or blank "" for currently selected MCU 	
    //            void **lpData  - ponter to structure
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_GetDevice( LPTSTR lpszDeviceName, void **lpData);
    
    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;
    extern	DEVICE_INFO  device;
    
    #define		MPU_NONE			0
    #define		HAS_MPU_BIT			1
    #define		HAS_MPU_IPE_BIT		2
    
    //-- MSPGANG_SelectBaudrate -------------------------------------------------------
    // MSPGANG_SelectBaudrate selects the baudrate of the programmer unit
    // Arguments: LONG (baudrate index: 0 = 9600, 4 = 115200
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_SelectBaudrate(LONG lBaud);
    
    
    //-- MSPGANG_GetDiagnostic ------------------------------------------------------------
    // MSPGANG_GetDiagnostic retrieves info baout the unit - hardware and software
    // Arguments: void *lpData (result's data)
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_GetDiagnostic(void *lpData);
    
    
    //-- MSPGANG_MainProcess ----------------------------------------------------------
    // MSPGANG_MainProcess executes the main process at the programmer unit.
    // All data during the main process are taken from image memory or SD card memmory.
    // Arguments: LONG (timeout in s)
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_MainProcess(LONG lTime);
    
    //-- MSPGANG_InteractiveProcess ----------------------------------------------------------
    // MSPGANG_InteractiveProcess executes the main process at the programmer unit.
    // All data during the main process are transferred via USB or RS232 communication interface
    // Contents inside the image memory or SD card memmory (in u=inserted) are irrelevant.
    // Arguments: LONG (timeout in s)
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_InteractiveProcess( LONG lTime ); //timeout in seconds
    
    
    //-- MSPGANG_Interactive_Open_Target_Device ----------------------------------------------------------
    // MSPGANG_Interactive_Open_Target_Device inits communication with target device and checking MCU_ID.
    // When done, target(s)is ready to get next interracctive commands (write, read , erase etc)
    // Arguments: LPTSTR (name- displayed on the LCD displaye)
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_Interactive_Open_Target_Device( LPTSTR name );
    
    
    //-- MSPGANG_Interactive_Close_Target_Device ----------------------------------------------------------
    // MSPGANG_Interactive_Close_Target_Device close communication with target device(s)
    // All Vcc becomes OFF, JTAG/SBW inactive
    // Arguments: none
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_Interactive_Close_Target_Device( void );
    
    
    //-- MSPGANG_Interactive_DefReadTargets ----------------------------------------------------------
    // MSPGANG_Interactive_DefReadTargets read contenst of the FLASH/FRAM wrom the space defined for READ
    // in the configuration MSPGANG_SetConfig(...)
    // Arguments: none
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_Interactive_DefReadTargets( BYTE mask, BYTE bar_min, BYTE bar_max, LONG Start_addr, LONG End_addr ) ;
    LONG WINAPI MSPGANG_Interactive_ReadTargets( BYTE mask ) ;
    LONG WINAPI MSPGANG_Interactive_ReadBytes( BYTE target_no, LONG addr, LONG size, BYTE * data ) ;
    LONG WINAPI MSPGANG_Interactive_WriteWord_to_RAM( LONG addr, LONG data );
    LONG WINAPI MSPGANG_Interactive_WriteByte_to_RAM( LONG addr, BYTE data );
    LONG WINAPI MSPGANG_Interactive_WriteBytes_to_RAM( LONG addr, LONG size, BYTE * data );
    LONG WINAPI MSPGANG_Interactive_WriteBytes_to_FLASH( LONG addr, LONG size, BYTE * data );
    LONG WINAPI MSPGANG_Interactive_Copy_GANG_Buffer_to_RAM( LONG addr, LONG size );
    LONG WINAPI MSPGANG_Interactive_Copy_GANG_Buffer_to_FLASH( LONG addr, LONG size );
    
    LONG WINAPI MSPGANG_Interactive_EraseSectors( LONG StartAddr, LONG EndAddr );
    LONG WINAPI MSPGANG_Interactive_BlankCheck( LONG StartAddr, LONG EndAddr );
    LONG WINAPI MSPGANG_Interactive_CS( LONG StartAddr, LONG EndAddr );
    LONG WINAPI MSPGANG_Interactive_DCO_Test( BYTE DCO_no, LONG *result_in_kHz );
    
    LONG WINAPI MSPGANG_Interactive_ClrLockedDevice( void );
    
    
    //-- MSPGANG_SelectImage -----------------------------------------------------------
    // MSPGANG_SelectImage sets active image to work with. MSP-GANG supports up to 96 images images.
    // Image numbers (image size 64 kB each) are compatible with the old image numbering (0..15) - 512 kB each.
    //   new image numbering style
    //     b7 - 1     - new numbering - force new standard for e.g. subimage number = 0
    //     b6..b4 - sub image number
    //     b3..b0 - image number  (0...15  -> image # 1..16 )
    //          b7  b6..4  b3..0
    //   e.g.   1     2      4        (image 5.2) (new numbering - when erased- one sector 64 kB only)
    //          0     0      4        (image 5 )  (old numbering - when erased- eight sector -> 512 kB) 
    //  but 
    //          0     2      4        (image 5.2) ( even without b7=1, it is a new numbering - when erased- one sector 64 kB only)    
    //    Old image numbering     New image numbering
    //        0							0x80 or 0,  0x90,  0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0	 (on GUI displayed as 1.0, 1.1, 1.2, 1.3....)
    //        1							0x81 or 1,  0x91,  0xA1, 0xB1, 0xC1, 0xD1, 0xE1, 0xF1	   .........................
    //        2							0x82 or 2,  0x92,  0xA2, 0xB2, 0xC2, 0xD2, 0xE2, 0xF2	   .........................
    //        3							0x83 or 3,  0x93,  0xA3, 0xB3, 0xC3, 0xD3, 0xE3, 0xF3	   .........................
    //        4							0x84 or 4,  0x94,  0xA4, 0xB4, 0xC4, 0xD4, 0xE4, 0xF4	   .........................
    //        5							0x85 or 5,  0x95,  0xA5, 0xB5, 0xC5, 0xD5, 0xE5, 0xF5	   .........................
    //        6							0x86 or 6,  0x96,  0xA6, 0xB6, 0xC6, 0xD6, 0xE6, 0xF6	   .........................
    //        7							0x87 or 7,  0x97,  0xA7, 0xB7, 0xC7, 0xD7, 0xE7, 0xF7	   .........................
    //        8							0x88 or 8,  0x98,  0xA8, 0xB8, 0xC8, 0xD8, 0xE8, 0xF8	   .........................
    //        9							0x89 or 9,  0x99,  0xA9, 0xB9, 0xC9, 0xD9, 0xE9, 0xF9	   .........................
    //        10						0x8A or 10, 0x9A,  0xAA, 0xBA, 0xCA, 0xDA, 0xEA, 0xFA	   .........................
    //        11						0x8B or 11, 0x9B,  0xAB, 0xBB, 0xCB, 0xDB, 0xEB, 0xFB	   .........................
    //        12						 - used for read only as long as the flash image is not used for internal firmware 
    //        13						(transition time)
    //        14						 --,,,---
    //        15						 --,,,---
    // Result:    LONG (the error code)
    
    LONG WINAPI MSPGANG_SelectImage(LONG lImage);
    
    
    //-- MSPGANG_EraseImage -----------------------------------------------------------
    // MSPGANG_EraseImage clears (presets with 0xFF) the image memory at the progr. unit
    // Arguments: none
    // Result:    LONG (the error code)
    LONG WINAPI MSPGANG_EraseImage(void);
    
    
    //-- MSPGANG_CreateGangImage -----------------------------------------------------------
    // MSPGANG_CreateGangImage - prepares data to be saved in the Image memory or used in Interractive process
    // Arguments: name - displayed on the LCD display
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_CreateGangImage( LPTSTR name );
    
    
    //-- MSPGANG_LoadImageBlock -----------------------------------------------------------
    // MSPGANG_LoadImageBlock - saved data prepared by MSPGANG_CreateGangImage in the selected Image memory
    // Arguments: name
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_LoadImageBlock( void );
    
    //-- MSPGANG_VerifyPSAImageBlock -----------------------------------------------------------
    // MSPGANG_VerifyPSAImageBlock - verified check sum of all bclock saved in the selected image memory
    // Arguments: name
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_VerifyPSAImageBlock( void );
    
    
    //-- MSPGANG_Read_Code_File read code file, append file or password file and save it in the MSP-GANG.dll internal buffer
    // Type of the code is selected via Configuration
    //		MSPGANG_SetConfig( CFG_OPEN_FILE_TYPE, LONG data );
    //		where:  data -> CODE_FILE_INDEX, APPEND_FILE_INDEX or PASSW_FILE_INDEX.
    //  By default it is used CODE_FILE_INDEX. When the MSPGANG_Read_Code_File is executed
    //  then the type file is set again to default value - CODE_FILE_INDEX.	
    //
    // Arguments: LPTSTR FullPath
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_Read_Code_File( LPTSTR FullPath );
    
    
    LONG WINAPI MSPGANG_Get_Code_Info( LONG type );
    #define     CODE_SIZE_INFO				1
    #define     CODE_CHECK_SUM				2
    #define     CODE2_SIZE_INFO				3
    #define     CODE2_CHECK_SUM				4
    #define     APPEND_CODE_SIZE_INFO		5
    #define     APPEND_CODE_CHECK_SUM		6
    #define     WHOLE_CODE_SIZE_INFO		7
    #define     WHOLE_CODE_CHECK_SUM		8
    #define     CS_PER_GANG430STD		    9
    
    
    // The MSPGANG_Load_Config, MSPGANG_Save_Config and MSPGANG_Default_Config
    // read, write the configuration file used in the MSP-GANG.
    // The MSPGANG_Default_Config restore confuguration to default (new) setup.
    // All confuguration items loaded from the file or default can be modified later item by item
    // using MSPGANG_SetConfig(...) function
    // Arguments: LPTSTR FullPath
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_Load_Config( LPTSTR filename );
    LONG WINAPI MSPGANG_Save_Config( LPTSTR filename );
    LONG WINAPI MSPGANG_Default_Config( void );
    
    
    // LONG WINAPI MSPGANG_Read_SN_Data_File( LONG mode, LONG index, LPTSTR filename );
    // File with serial number / MAC addresses used for programming selected target device in Autoprogram (GO) - current run only. 
    // File must be modified before starting Autoprogram and should contain new SN/MAC addresses for programming current target devices. 
    // Format inside file is fixed
    // first line - SN/MAC for first target
    // ..................................
    // last line -  SN/MAC for last target
    //  SN.MAC format - number of bytes in hex e.g. - in example SN/MAC has size 6 bytes each
    //  A5 28 38 E2 56 A8
    //  ....................
    //  A5 28 38 E2 56 AF
    // mode, index - spare - not used yet. For future options.
    //  filename -> full name and path of the SN data file with extention *.txt
    LONG WINAPI MSPGANG_Read_SN_Data_File( LONG mode, LONG index, LPTSTR filename );
    
    // LONG WINAPI MSPGANG_Append_Log_File( LONG mode, LPTSTR filename );
    LONG WINAPI MSPGANG_Append_Log_File( LONG mode, LPTSTR filename );
    	#define	SN_LOG_FILE		1
    
    
    // The MSPGANG_GetLabel function read the MSP-GANG programmer's label
    LONG WINAPI MSPGANG_GetLabel( BYTE *Data );
    
    #define	LABEL_SIZE_IN_BYTES		256
    typedef union
    {
    	unsigned char bytes[LABEL_SIZE_IN_BYTES+2];
    	struct
    	{
         //label from MSP-GANG
    		unsigned char  boot_sw_ID[2]; 			
    		unsigned char  boot_sw_rev[4]; 			
    		unsigned char  api_sw_ID[2]; 			
    		unsigned char  api_sw_rev[4];
    		unsigned char  boot_sw_rev_m[2]; 			
    		unsigned char  hardware_rev[2]; 			
    		unsigned char  api_sw_rev_m[2];
    		char		   boot_sw_name[9];
    		char		   api_sw_name[9];
    		unsigned char  silicon_UN[8];
    		char		   access_code_desc[32];
    		unsigned char  access_code[32];
    		char		   HW_SN[8];
    		char		   MFG_ID[4];
    		char		   HW_ID[4];
    		unsigned char  HW_rev[2];
    		unsigned char  HW_yymmdd[6];
    		char		   InfoA_spare[8];
         //end of from MSP-GANG (total 140 bytes) 
    		unsigned char  dll_ID[2];
    		unsigned char  dll_rev[4]; 			
    		char		   dll_date[16]; 			
    		char		   dll_name[16]; 			
    		unsigned char  new_FW_ID[2];
    		unsigned char  new_FW_rev[4];
    		char		   new_FW_name[10];
    		char		   new_FW_spare2[8];
    	}x;
    }UNIT_LABEL_DEF;
    extern	UNIT_LABEL_DEF unit_label;
    
    
    //The MSPGANG_GetInfoMemory and MSPGANG_SetInfoMemory read or write 128 bytes from/to information memory inside MSP-GANG.
    //Information memory contains a few data and setup used in the MSP-GANG. It can be used for additional data in the future 
    // Arguments: BYTE - page 0 - (info memory - 0x1800-0x187F)
    //					 page 1 - (info memory - 0x1880-0x18FF)
    //			  BYTE *data  - pointer to data buffer
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_GetInfoMemory( BYTE page, BYTE *data );
    LONG WINAPI MSPGANG_SetInfoMemory( BYTE page, BYTE *data );
    
    
    //The MSPGANG_ReadImageBlock reads the header from the selected image memory
    // Arguments: LONG	addr - address from the image memory (0..250)
    //			  LONG	size - 1...254 	
    //			  void *lpData - pointer to BYTE data buffer - Data format of the void *lpData -> union _IMAGE_HEADER - see below.
    // Result:    LONG (error code)
    
    #define         UNLOCK_INFOA            0x40
    #define         UNLOCK_INFO             0x80
    
    LONG WINAPI MSPGANG_ReadImageBlock( LONG addr, LONG size, void *lpData );  //size - max 250 bytes
    
    #define		HEADER_ID_SIZE			10			//fixed size - do not modify
    #define		SCRIPT_TEXT_SIZE		16			//fixed size - do not modify
    #define		SCRIPT_MCU_NAME_SIZE	16			//fixed size - do not modify
    #define		IMAGE_HEADER_CTRL_OFFSET	112
    
    union _IMAGE_HEADER
    {
      BYTE	bytes[IMAGE_HEADER_SIZE];  
      WORD	words[IMAGE_HEADER_SIZE/2];  
    
      struct
      {
    	WORD		own_PSA;
    	WORD		global_PSA;
    	BYTE		year;
    	BYTE		month;
    	BYTE		day;
    	BYTE		hour;
    	BYTE		min;
    	BYTE		sec;
    #define GLOBAL_PSA_START_OFFSET		10
      // down - covered by global_PSA ----
    #define SHORT_ID_2BYTE_OFFSET			10
    	WORD		shortID;
    #define CHUNKS_NO_2BYTE_OFFSET			12
    	WORD		chunks;
    #define IMAGE_DATA_2BYTE_OFFSET			14
    	WORD		image_data_offset;
    #define GLOBAL_SIZE_4BYTE_OFFSET		16
    	DWORD		size;				//global_size;
    	WORD		ID_rev;					//20
    	BYTE		ID_name[HEADER_ID_SIZE]; //22
    	DWORD		DLL_ver;                 //32 
    #define HEADER_COMMENT_ADDR		36
    	char		comment[SCRIPT_TEXT_SIZE];
    	WORD		used_tasks_mask;		//52        
    	BYTE		Interface;				//54   type (JTAG, SBW, BSL), speed(Fast, Med, Slow) 
    	BYTE		GangMask;				//55
    	BYTE		Vcc_PowerEn;			//56
    	BYTE		Icc_HiEn;				//57
    	WORD		Vcc_mV;					//58	
    	WORD		min_Vcc_mV;				//60
    	WORD		max_Vcc_mV;				//62
    	WORD		RST_time_ms;			//64
    	WORD		RST_release_ms;			//66
        BYTE        InfoA_Erase_En;			//68
        BYTE        BSL_Erase_En_mask;      //69  
    	BYTE		SecureDev_En;			//70
    	BYTE        DCO_Flags;				//71
    #define		DCO_RETAIN_EN		0x01	 	
    #define		DCO_VALIDATION_EN	0x02
    #define		DCO_RECAL_EN		0x04	 	
    #define		DCO_ONE_CONSTANTS	0x08	 	        
        BYTE        IO_cfg;					//72
    #define     SBW_VIA_RST_BIT     0x01
        BYTE        MemoryOption;			//73	for GUI only - for displaying used memory option. No impact in firmware
        BYTE        InterfaceSpeed;			//74	for GUI only - for displaying used speeds (JTAG/SBW/CJTAG/BSL). No impact in firmware
        BYTE        VccSettleTime;          //75	settle time *20ms
    
    	BYTE        JTAG_unlockEn			: 1;	//76
    	BYTE        HasLockedInfoA			: 1;
    	BYTE        HasAutoEraseInBSL		: 1;
    	BYTE        BSL_X_type				: 1;
    	BYTE        spare_flag4 			: 1;
    	BYTE        spare_flag5				: 1;
    	BYTE        spare_flag6				: 1;
    	BYTE        spare_flag7				: 1;
    
        BYTE        ClrSegments;			//77  MSP432
    	//	#define	MSP432_CLR_LOCKING_INFOA_BIT	0x01
    	//	#define	MSP432_CLR_LOCKING_BSL_BIT		0x02
    
        BYTE        BSL_1st_Passw;			//78
        BYTE        EraseIfLocked;      //ARM !!!!!!!!!!!!!!!!!  - not used yet       
                    #define   UNLOCK_KEY_EN   0x39   
        BYTE        SnDataSize; 		//80
        BYTE        MPU_Options; 		//81
    				#define   MPU_OPTION_NONE	0 
    				#define   MPU_IPE_WR_LOCKED_EN_BIT		0x01 
    				#define   MPU_IPE_WR_UNLOCKED_EN_BIT	0x02 
    				#define   MPU_IPE_RD_UNLOCKED_EN_BIT	0x04 
    
     //	BYTE		free[112-82];
      }prg;
    
      struct
      {
    	BYTE		offset[IMAGE_HEADER_CTRL_OFFSET];		//offset 112
    	BYTE        flags;									//0x70
    		#define  IMAGE_LOCK		0x10		//must be the same bit as in LOCK_LD_PRJ
    	BYTE        sp1;									//0x71
    	BYTE        sp2;									//0x72
    	BYTE        sp3;									//0x73	
    	BYTE        sp4;									//0x74
    	BYTE        sp5;									//0x75
    	BYTE        sp6;									//0x76
    	BYTE        sp7;									//0x77
    	BYTE        sp8;									//0x78
    	BYTE        sp9;									//0x79	
    	BYTE        sp10;									//0x7A
    	BYTE        sp11;									//0x7B
    	BYTE        sp12;									//0x7C
    	BYTE        sp13;									//0x7D
    	BYTE        sp14;									//0x7E
    	BYTE        sp15;									//0x7F
      }ctrl;
    
      struct
      {
    	BYTE		offset[IMAGE_HEADER_SIZE/2];
    
    	char		MCU_name[SCRIPT_MCU_NAME_SIZE];		//0
    	WORD		Id[2];								//16
    	WORD        SubId[2];							//20
    	WORD		MainEraseMode;						//24
    	WORD		minPVcc;							//26
        WORD		RAM_size;							//28
    	WORD		SubIDAddr;							//30
        BYTE        FRAM;								//32
    //#define		 FRAM_NONE			0
    //#define		 FRAM_ASIC			1
    //#define		 FRAM_MSPXV2_57		2
    //#define		 FRAM_APOLLO		3
    //#define		 FRAM_MSPXV2_59		4
    
        // --- one byte        
    	BYTE            DefaultDCO			: 1;		//33	    
        BYTE            ASIC				: 1;
    	BYTE            MPU					: 1;
        BYTE            JTAG_Passw			: 1;
        BYTE            BSLprogrammable		: 1;
        BYTE            JTAG_Unlockable    	: 1;
        BYTE            BSL_16B_passw		: 1;
        BYTE            has_MPU_IPE			: 1;	//spare      
        // --- one byte                
    
    	BYTE		TestPin;							//34
    	BYTE		CpuX;								//35
    
    	BYTE		Quick_W			  :1;			    //36
    	BYTE		Quick_R			  :1;
    	BYTE		Quick_W_bug		  :1;
    	BYTE		Quick_WclkA		  :1;
    	BYTE		BSL_F5x_StdEntry  :1;
    	BYTE		BSL9600			  :1;
    	BYTE		FRAM_directWr_En  :1;
    	BYTE		AutoBlankCheckDis :1;
    
    	BYTE		FastFlash;							//37
    
    	BYTE		EnhVerify;							//38
    	BYTE		JTAG;								//39
    
    	BYTE		SpyBiWire;							//40
    	BYTE		Marginal;							//41
    
    	BYTE		F5xx;								//42
        BYTE        MCU_Group;							//43
    
        WORD        RAM_addr;							//44
    	BYTE		SYS_CLK;							//46  used for F5xx and up
    		//#define STANDARD	0 - for compatibility 
    		#define		Xv2_PLL			1	//as standard before
    		#define		HF_8MHz			2	//FRAM FR57xx
    		#define		HF_1MHz			3	//Apollo 
    		#define		HF2_8MHz		4   //FRAM FR58xx, FR59xx        
    		#define		Xv2_PLL_G60XX	5
    		#define		DCO_16384HZ		6	//i2xxx
    
    	BYTE		InfoA_type;							//47
    		//#define STANDARD	        0 - for compatibility         
    		#define		I2XX_1K		1	//i2xxx 1K - 0x1000-0x13FF
    
        BYTE       FLASH_Type;                //48
    		//#define STANDARD	        0 - for compatibility
    		#define		SEGMENT_1K		1	//i2xxx 1K flash segment size
            #define     FLASH_SEGM_2K   2
            #define     FLASH_SEGM_4K   4
            #define     FLASH_SEGM_8K   8
            #define     FLASH_SEGM_16K  16
            #define     FLASH_SEGM_32K  32
    
        BYTE            Secure_Type;       //49         
    		//#define STANDARD	        0 - for compatibility                         
    		#define		SUC   	        1 	//i2xxx         
    
        BYTE            Map;				//50
        BYTE            SysClkDiv2;			//51
        BYTE            NMI_to_addr;		//52
            #define NMI_TO_ADDR_NOT_SUPPORTED   0x80     
        BYTE            FW_type;			//53
    		#define FAMILY_XMS432P401			21		//XSP432P401 Rev-B  obsolete - not supported
            #define FAMILY_MSP432P401			22
            #define FAMILY_MSP432P4111			23
    
            #define FAMILY_MSP432E4X			60    
    
        BYTE        MCU_Type;				//54
            #define    MSP430F                  0x01	//or can be 0 
            #define    CC_RF_BIT_ID             0x10
            #define    MSP_FR_BIT_ID            0x20
    	    #define    MSP432_BIT_ID            0x80
        BYTE        free_1;					//55
        BYTE        free_2;					//56
        BYTE        free_3;					//57
    	WORD		Id2[2];					//58
        WORD        free_4;					//62
        DWORD       PrgFlags;               //64    used for ARM only so far. 
                                            //68
     //	free 128-68;        
      }device;
    };
    
    
    
    
    //The MSPGANG_Get_qty_MCU_Family, MSPGANG_Get_MCU_FamilyName and MSPGANG_Get_MCU_Name
    // allows to get list of all supported MCUs and sort them in the family names groups. 
    // Currently following MCU's grout are suttorted
    // Family_ID	Family name
    //	  1,	" MSP430F1xx"
    //	 20,	" MSP430F2xx"
    //	 22,	" MSP430AFE2xx"
    //	 21,	" MSP430G2xx"
    //	 40,	" MSP430F4xx"
    //	 41,	" MSP430FE4xx"
    //	 42,	" MSP430FG4xx"
    //	 43,	" MSP430FW4xx"
    //	 50,	" MSP430F5xx"
    //	 57,	" MSP430FR5xx"
    //	 60,	" MSP430F6xx"
    //	 51,	" CC-430F5xx"
    //	 61,	" CC-430F6xx"
    // See manual for details how to get list of MCUs
    LONG WINAPI MSPGANG_Get_qty_MCU_Type( void );
    LONG WINAPI MSPGANG_Set_MCU_Type( int type );
    LONG WINAPI MSPGANG_Get_MCU_TypeName( LONG index, LPTSTR name );
    LONG WINAPI MSPGANG_Get_qty_MCU_Family( void );
    LONG WINAPI MSPGANG_Get_MCU_FamilyName( LONG index, LPTSTR name );
    LONG WINAPI MSPGANG_Get_MCU_Name( LONG group_index, LONG index, LPTSTR name );
    
    
    // The MSPGANG_MakeSound make beep or sounds
    void	WINAPI  MSPGANG_MakeSound( LONG type );
    			//type as below
    			#define	BEEP_OK			1
    			#define	BEEP_ERR		2
    			#define	BEEP_PRG_ERR	3
    			#define	BEEP_WARNING	4
    
    
    
    //The MSPGANG_CallBack_ProgressBar, MSPGANG_CallBack_Message and MSPGANG_WaitUntilFinished
    // monitors executed functions during execution
    // Functions used internally
    LONG WINAPI MSPGANG_CallBack_ProgressBar( void ** text, void ** history, BYTE *G_status, BYTE *DLL_status  );
    LPTSTR WINAPI MSPGANG_CallBack_Message( void );
    LONG WINAPI MSPGANG_WaitUntilFinished( LONG error, LONG lTime );
    #define	DLL_STATUS_SIZE			32
    
    
    // MSPGANG_GetProgressStatus get progress status from MSP-GANG. Received data in bytes contains
    //gang mask of all preoceesed done in the function called before the 
    //MSPGANG_GetProgressStatus is used. Each bit in the Gang mask represent one targted device
    //     bit 0  -> Target 1, ....... bit 7 -> Target 8
    // eg: Connected_gang_mask   -> 0x7A   - targets 2,4,5,6,7 are detected and communication established
    //  *** -> final results - for all targets
    // See GANG_PROGRESS_STATUS union below for details
    LONG WINAPI MSPGANG_GetProgressStatus(void *lpData);
    
    #define	SCRIPT_TEXT_SIZE	16
    union GANG_PROGRESS_STATUS
    {
      BYTE	    bytes[PROGRESS_STATUS_SIZE+4];			
      struct
      {	
        BYTE		header;
    	BYTE		ctr;
        WORD		task_ctr;						//byte offset - 0
    	WORD		chunk_ctr;						//byte offset - 2
    	BYTE		run;							//byte offset - 4
    	BYTE		ack;							//byte offset - 5
    	WORD		Finished_tasks_mask;			//byte offset - 6,7
    			//---  task mask bits ----
    			//	CONNECT_TASK_BIT     0x0001
    			//	ERASE_TASK_BIT       0x0002
    			//	BLANKCHECK_TASK_BIT  0x0004
    			//	PROGRAM_TASK_BIT     0x0008
    			//	VERIFY_TASK_BIT   	 0x0010
    			//	SECURE_TASK_BIT      0x0020
    			//	DCO_CAL_TASK_BIT     0x0040
    			//spare              		0x0080 to 0x4000
    			//	RST_AND_START_FW_BIT 0x8000
    
    	BYTE		***;						//byte offset - 8
    			//target masks
    			//	TARGET_1_MASK		0x01
    			//	TARGET_2_MASK		0x02
    			//	TARGET_3_MASK		0x04
    			//	TARGET_4_MASK		0x08
    			//	TARGET_5_MASK		0x10
    			//	TARGET_6_MASK		0x20
    			//	TARGET_7_MASK		0x40
    			//	TARGET_8_MASK		0x80
    	BYTE		Rq_gang_mask;					//byte offset - 9
    	BYTE		Connected_gang_mask;			//byte offset - 10
    	BYTE		Erased_gang_mask;				//byte offset - 11
    	BYTE		BlankCheck_gang_mask;			//byte offset - 12
    	BYTE		Programmed_gang_mask;			//byte offset - 13
    	BYTE		Verified_gang_mask;				//byte offset - 14
    	BYTE		Secured_gang_mask;				//byte offset - 15
    	BYTE		RestoredOldSN;                  //byte offset - 16
    	BYTE		spare[5];                       //byte offset - 17..21
    	BYTE		error_no;                       //byte offset - 22
    	BYTE		VTIO_32mV;                      //byte offset - 23
    	BYTE		VccSt_LOW;                      //byte offset - 24
    	BYTE		VccSt_HI;                       //byte offset - 25
    			//	VccSt_LOW, VccSt_HI provide 2 bits to each target.
    			//	Bit A for each target and bit B for each target.
    			//		Bits    B   A
    		    //			    0	0		Vcc below 0.7V	
    			//				0   1     	Vcc below Vcc min   ( 0.7V < Vcc < Vcc min)     
    			//				1   0		Vcc over Vcc min (OK status) 
    			//				1   1		Vcc over 3.8V	
    	BYTE		VccErr;                         //byte offset - 26
    			//current Vcc below min
    	BYTE		VccErr_Cumulative;              //byte offset - 27
    			//*** (during programminf) Vcc below min
    	BYTE		JTAG_init_err_mask;				//byte offset - 28	
    	BYTE		JTAG_Fuse_already_blown_mask;	//byte offset - 29	
    	BYTE		Wrong_MCU_ID_mask;				//byte offset - 30
    	BYTE		Progress_bar;					//byte offset - 31
    			// 0...100%	
    	char		comment[SCRIPT_TEXT_SIZE];		//byte offset - 32..47
      }st;
    };
    
    
    
    LONG WINAPI MSPGANG_GetAPIStatus( LONG no, BYTE *data );
    //----- Gang Status index (no) -----------
    #define   GET_APP_FLAGS					10
    #define   GET_LAST_STATUS				12
    #define   GET_LAST_ERROR_NO				14
    #define   GET_ACTIVE_TARGETS_MASK		16
    #define   GET_MCU_ID					18
    	#define GANG_MCU_ID_IN_BYTES_SIZE	16
    
    	#define GANG_LAST_STATUS_SIZE		8
    typedef union
    {
        BYTE     b[GANG_LAST_STATUS_SIZE];
        WORD     w[GANG_LAST_STATUS_SIZE/2];    
        struct   
        {
          BYTE  status;     //error no
          BYTE  connected_mask;      
          BYTE  active_mask;
          BYTE  error_mask;      
          BYTE  gang_mask;
          BYTE  spare_1;
          BYTE  spare_2;      
          BYTE  spare_3;      
        }type;
    }_LAST_STATUS;
    
    	//received 4 bytes of internal status
    	//no = GET_APP_FLAGS (10)
    	//response: 
    	//		Byte-0
    	//			b0 (LSB)	Hardware rev-0	
    	//			b1		initialization finished	(after power-up)
    	//			b2		access key CRC error
    	//			b3		invalid access key
    	//			b4		running from SD card
    	//			b5		File in SD card found
    	//			b6		target secure device in process	
    	//			b7		keypad enabled
        //
    	//		Byte-1
    	//			b0		key pressed 
    	//			b1..b7             spare
    	//		Byte-2     spare
    	//		Byte-3     spare
    	//
    	//  
    	// no = GET_LAST_STATUS (12)
    	//	response: 
    	//		Byte-0	Error number in the last execute transaction
    	//		Byte-1		targets connection mask
    	//		Byte-2       active targets mask
    	//		Byte-3       targets error mask
    	//		Byte-4..7    spare			
    	//	
    	// no = GET_LAST_ERROR_NO (14)
    	//		Byte-0  - last error number from MSP-GANG for any command
    	//				  error numbers 1...255 - see error list numbers above 		
    
    	// no = GET_ACTIVE_TARGETS_MASK	(16)
    	//		return - mask of the active target devices - checked IR response
    	//			valid for JTAG/SBW communication only
    	//			0x01 - target 1
    	//          ................
    	//			0x80 - target 8
        //          e.g. response 0x47 - targets 1,2,3,5 give the alive response
    
    	// no = GET_MCU_ID	(18)
    	//		return - ID of MCU - 2 bytes per one target - in total 2*8 = 16 bytes
    	//			byte 0,1  - ID for target 1
    	//			byte 2,4  - ID for target 3
    	//          ................
    	//			byte 14,15  - ID for target 8
    
    
    
    
    
    //The MSPGANG_GetPCHardwareFingerprint reads hardware fingerprint from the PC.
    //Used for project protected with password or hardware fingerprint number.
    // Arguments: none
    // Result:    DWORD - hex hardware fimgerprint number
    DWORD WINAPI MSPGANG_GetPCHardwareFingerprint( void );
    
    
    //The MSPGANG_ImageFileSave and  MSPGANG_ImageFileLoad Save/Load the image to/from file
    // Used internally by GUI
    LONG WINAPI MSPGANG_ImageFileSave( LPTSTR filename, LPTSTR name, LONG type, LPTSTR passw );
    LONG WINAPI MSPGANG_ImageFileLoad( LPTSTR filename, LPTSTR passw, LONG mode );
    // load mode - 0   read only
    // load mode - 1   read from the file and save to selected image memory
    #define BINARY_EXTENTION    ".mspgangbin"
    #define	IMAGE_FILE_EXT		".mspgangimage"
    
    //The MSPGANG_SelfTest is used for the MSP-GANg programmer selftest - provided in GUI
    // 
    LONG  WINAPI MSPGANG_SelfTest( LONG addr, LONG size, BYTE * data_in, BYTE * result );
    
    
    //The MSPGANG_Flash_valid_addr is used for validation FLASH/FRAM address
    // Arguments: LONG dest - 0 (without TLV memory), 0x10 - with TLV memory
    //			  LONG start_addr	- Flash/FRAM start address	
    //			  LONG size			- Flash/FRAM size
    // Result:    LONG (error code)
    LONG WINAPI MSPGANG_Flash_valid_addr( LONG dest, LONG start_addr, LONG size );
    
    //	Used by GUI only
    void WINAPI MSPGANG_Save_Data_to_File( LONG mode, LONG source, LPTSTR FileName );
    
    //-------------------------------------------
    //    MSPGANG_Set_IO_State( LONG Vcc_mV, BYTE *data )  - set static level on IO pins (JTAG,SBW...)
    //                                         
    //		Vcc_mV   - Set the Vcc in mV - for output voltage and I/O translators levels
    //      data -> 8 data bytes
    //      
    //      data[0]  - open destination buffer for output and transferred data for each targets
    //                  0          ->   none
    //                  1          ->   TDI  (targer 1..8)
    //                  2          ->   TDOI (targer 1..8)
    //                  3          ->   TMS  (targer 1..8)
    //                  4          ->   RST  (targer 1..8)
    //                  5          ->   BSL-RX (targer 1..8)
    //      data[1]  - data transferred to the buffer above  b0..b7 -> target1... target8    
    //      data[2]  -  output enable bits    0-> tri-state   1->output  
    //             b2 (0x04) -  common RST   - the same state for all 8 targets  (note - if the RST buffer above is selected, then this state is ignored)
    //             b3 (0x08) -  common TEST  - the same state for all 8 targets
    //             b4 (0x10) -  common TCK   - the same state for all 8 targets
    //             b5 (0x20) -  common TMS   - the same state for all 8 targets  (note - if the TMS buffer above is selected, then this state is ignored)
    //      data[3]  -  output level on all targets     0-> LOW   1->HI
    //             b2 (0x04) -  common RST   - the same level for all 8 targets  (note - if the RST buffer above is selected, then this state is ignored)
    //             b3 (0x08) -  common TEST  - the same level for all 8 targets
    //             b4 (0x10) -  common TCK   - the same level for all 8 targets
    //             b5 (0x20) -  common TMS   - the same level for all 8 targets  (note - if the TMS buffer above is selected, then this state is ignored)
    //      data[4]  -  Vcc enable bits to each targets  b0..b7 -> target1... target8    
    //      data[5]  -  Icc HI enable    0->disable,  1->enable
    //      data[6]  -  spare-1
    //      data[7]  -  spare-2
    //
    //-------------------------------------------
    
    LONG WINAPI MSPGANG_Set_IO_State( LONG Vcc_mV, BYTE *data );
     // definition for data[0]
    #define		DEST_STATE_NONE		0
    #define		TDI_STATE_DEST		1
    #define		TDOI_STATE_DEST		2
    #define		TMS_STATE_DEST		3
    #define		RST_STATE_DEST		4
    #define		BSLRX_STATE_DEST	5
    // definition for data[2], [3]
    #define		RST_STATE_BIT	0x04
    #define		TEST_STATE_BIT	0x08
    #define		TCK_STATE_BIT	0x10
    #define		TMS_STATE_BIT	0x20
    
    //========================================================================
    // MSP432P_Locking Option definitions
    //========================================================================
    
    #define MSP432_MB_START_ADDR						0x200000
    
    #define	CMD_ENABLE_JTAG_UNLOCK_FACTORY_RESET		0x00000001
    #define	CMD_ENABLE_PASSWORD3						0x00000800
    #define	CMD_ENABLE_PASSWORD2						0x00000400
    #define	CMD_ENABLE_PASSWORD1						0x00000200
    #define	CMD_ENABLE_PASSWORD0						0x00000100
    
    
    #define	CMD_ENABLE_MASK_0_JTAG_SWD_LOCK_SECEN		0x00080000
    #define	CMD_ENABLE_MASK_1_SEC_ZONE0_EN				0x00100000
    #define	CMD_ENABLE_MASK_2_SEC_ZONE1_EN				0x00200000
    #define	CMD_ENABLE_MASK_3_SEC_ZONE2_EN				0x00400000
    #define	CMD_ENABLE_MASK_4_SEC_ZONE3_EN				0x00800000
    #define	CMD_ENABLE_MASK_5_BSL_CONFIG				0x00020000
    #define	CMD_ENABLE_MASK_6_JTAG_SWD_LOCK_ENC_UPDATE	0x10000000
    #define	CMD_ENABLE_MASK_7_SEC_ZONE0_UPDATE			0x01000000
    #define	CMD_ENABLE_MASK_8_SEC_ZONE1_UPDATE			0x02000000
    #define	CMD_ENABLE_MASK_9_SEC_ZONE2_UPDATE			0x04000000
    #define	CMD_ENABLE_MASK_10_SEC_ZONE3_UPDATE			0x08000000
    #define	CMD_ENABLE_MASK_11_FACTORY_RESET_PARAMS		0x20000000
    #define	CMD_ENABLE_MASK_12_FACTORY_RESET			0x00010000
    
    #define	CMD_EN_FLASH_MAILBOX_GLOBAL_MASK			0x3FFB0000
    
    enum
    {
    	CMD_JTAG_SWD_LOCK_SECEN_INDEX=0, 
    	CMD_SEC_ZONE0_EN_INDEX, 
    	CMD_SEC_ZONE1_EN_INDEX, 
    	CMD_SEC_ZONE2_EN_INDEX, 
    	CMD_SEC_ZONE3_EN_INDEX,
    	CMD_BSL_CONFIG_INDEX,
    	CMD_JTAG_SWD_LOCK_ENC_UPDATE_INDEX,
    	CMD_SEC_ZONE0_UPDATE_INDEX,
    	CMD_SEC_ZONE1_UPDATE_INDEX,
    	CMD_SEC_ZONE2_UPDATE_INDEX,
    	CMD_SEC_ZONE3_UPDATE_INDEX,
    	CMD_FACTORY_RESET_PARAMS_INDEX,
    	CMD_FACTORY_RESET_INDEX,
    	NUM_CMDS
    };
    
    
    typedef struct TI_MSP432_CMD_JTAG_SWD_LOCK_SECEN_t 
    {
    	UINT32 JTAG_SWD_LOCK_SECEN;
    	UINT32 JTAG_SWD_LOCK_AES_INIT_VECT[4];
    	UINT32 JTAG_SWD_LOCK_AES_SECKEYS[8];
    	UINT32 JTAG_SWD_LOCK_UNENC_PWD[4];
    	UINT32 ACK;			//read-only
    	UINT32 reserved[2];
    }TI_MSP432_CMD_JTAG_SWD_LOCK_SECEN;
    
    typedef struct TI_MSP432_CMD_SEC_ZONEx_EN_t
    {
    	UINT32 SEC_ZONEx_SECEN;
    	UINT32 SEC_ZONEx_START_ADDR;
    	UINT32 SEC_ZONEx_LENGTH;
    	UINT32 SEC_ZONEx_AESINIT_VECT[4];
    	UINT32 SEC_ZONEx_SECKEYS[8];
    	UINT32 SEC_ZONEx_UNENC_PWD[4];
    	UINT32 SEC_ZONEx_ENCUPDATE_EN;
    	UINT32 SEC_ZONEx_DATA_EN;
    	UINT32 ACK;			//read-only
    	UINT32 reserved[2];
    }TI_MSP432_CMD_SEC_ZONEx_EN;
    
    typedef struct TI_MSP432_CMD_BSL_CONFIG_t
    {
    	UINT32 BSL_Enable;
    	UINT32 BSL_Start_Addr;
    	UINT32 BSL_Hard_Inv_Params;
    	UINT32 reserved[2];
    	UINT32 ACK;			//read-only
    }TI_MSP432_CMD_BSL_CONFIG;
    
    typedef struct TI_MSP432_CMD_JTAG_SWD_LOCK_ENC_UPDATE_t
    {
    	UINT32 JTAG_SWD_LOCK_ENCPAYLOADADDR;
    	UINT32 JTAG_SWD_LOCK_ENCPAYLOADLEN;
    	UINT32 JTAG_SWD_LOCK_DST_ADDR;
    	UINT32 ACK;			//read-only
    	UINT32 reserved;		
    }TI_MSP432_CMD_JTAG_SWD_LOCK_ENC_UPDATE;
    
    
    typedef struct TI_MSP432_CMD_SEC_ZONEx_UPDATE_t
    {
    	UINT32 SEC_ZONEx_PAYLOADADDR;
    	UINT32 SEC_ZONEx_PAYLOADLEN;
    	UINT32 ACK;			//read-only
    	UINT32 reserved;
    }TI_MSP432_CMD_SEC_ZONEx_UPDATE;
    
    typedef struct TI_MSP432_CMD_FACTORY_RESET_PARAMS_t
    {	
    	UINT32 FACTORY_RESET_ENABLE;
    	UINT32 FACTORY_RESET_PWDEN;
    	UINT32 FACTORY_RESET_PWD[4];
    	UINT32 ACK;			//read-only
    	UINT32 reserved;
    }TI_MSP432_CMD_FACTORY_RESET_PARAMS;
    
    typedef struct TI_MSP432_CMD_FACTORY_RESET_t
    {	
    	UINT32 PASSWORD[4];
    	UINT32 ACK;			//read-only
    	UINT32 reserved;
    }TI_MSP432_CMD_FACTORY_RESET;
    
    #define	NUM_SINGLE_FIELDS	5
    #define NUM_MULTI_FIELDS	3
    #define NUM_FIELDS			(NUM_SINGLE_FIELDS + NUM_MULTI_FIELDS)
    #define MULTI_FIELD_START_OFFSET	3 //reference InitDialog function for this
    #define	MAX_FIELD_TXT_SIZE	200
    
    #define TI_MSP432_MB_WORD_SIZE	0xA4
    #define TI_MSP432_MB_BYTE_SIZE	(4*TI_MSP432_MB_WORD_SIZE)
    typedef union TI_MSP432_CMD_MAILBOX_t
    {
    	BYTE   mb_bytes[4*TI_MSP432_MB_BYTE_SIZE];	//0 - 0x24c (inclusive) 
    	UINT32 mb_words[TI_MSP432_MB_WORD_SIZE];	//0 - 0x24c (inclusive) 
    	struct
    	{
    		UINT32 MB_START;	//magic number
    		UINT32 CMD;			//bit-field with all enabled commands
    		UINT32 RESERVED[2];	//Blanks, set to 0xFFFFFFFF		
    		TI_MSP432_CMD_JTAG_SWD_LOCK_SECEN		CMD_JTAG_SWD_LOCK_SECEN;
    		TI_MSP432_CMD_SEC_ZONEx_EN				CMD_SEC_ZONEx_EN[4];
    		TI_MSP432_CMD_BSL_CONFIG				CMD_BSL_CONFIG;
    		TI_MSP432_CMD_JTAG_SWD_LOCK_ENC_UPDATE	CMD_JTAG_SWD_LOCK_ENC_UPDATE;
    		TI_MSP432_CMD_SEC_ZONEx_UPDATE			CMD_SEC_ZONEx_UPDATE[4];
    		UINT32 RESERVED2;	//extra reserved between Zonex and Factory Reset
    		TI_MSP432_CMD_FACTORY_RESET_PARAMS		CMD_FACTORY_RESET_PARAMS;
    		TI_MSP432_CMD_FACTORY_RESET				CMD_FACTORY_RESET;
    		UINT32 MB_END;		//magic number	
    	}mb_fields;
    
    	//Don't create a mailbox without the magic numbers!
    #ifdef __cplusplus
    	TI_MSP432_CMD_MAILBOX_t()
    	{
    		mb_fields.MB_START = 0x0115ACF6;
    		mb_fields.MB_END = 0x011E11D;		
    		mb_fields.RESERVED[0] = mb_fields.RESERVED[1] = 0xFFFFFFFF;
    		mb_fields.CMD_JTAG_SWD_LOCK_SECEN.ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_JTAG_SWD_LOCK_SECEN.reserved[0] = 0xFFFFFFFF;		
    		mb_fields.CMD_JTAG_SWD_LOCK_SECEN.reserved[1] = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[0].ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[0].reserved[0] = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[0].reserved[1] = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[1].ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[1].reserved[0] = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[1].reserved[1] = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[2].ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[2].reserved[0] = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[2].reserved[1] = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[3].ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[3].reserved[0] = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_EN[3].reserved[1] = 0xFFFFFFFF;		
    		mb_fields.CMD_BSL_CONFIG.ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_BSL_CONFIG.reserved[0] = 0xFFFFFFFF;		
    		mb_fields.CMD_BSL_CONFIG.reserved[1] = 0xFFFFFFFF;		
    		mb_fields.CMD_JTAG_SWD_LOCK_ENC_UPDATE.ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_JTAG_SWD_LOCK_ENC_UPDATE.reserved = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_UPDATE[0].ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_UPDATE[0].reserved = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_UPDATE[1].ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_UPDATE[1].reserved = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_UPDATE[2].ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_UPDATE[2].reserved = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_UPDATE[3].ACK = 0xFFFFFFFF;		
    		mb_fields.CMD_SEC_ZONEx_UPDATE[3].reserved = 0xFFFFFFFF;	
    		mb_fields.RESERVED2 = 0xFFFFFFFF;
    		mb_fields.CMD_FACTORY_RESET_PARAMS.FACTORY_RESET_ENABLE = 0;
    		mb_fields.CMD_FACTORY_RESET_PARAMS.FACTORY_RESET_PWDEN = 0xFFFFFFFF;
    		mb_fields.CMD_FACTORY_RESET_PARAMS.ACK = 0xFFFFFFFF;
    		mb_fields.CMD_FACTORY_RESET_PARAMS.reserved = 0xFFFFFFFF;
    		mb_fields.CMD_FACTORY_RESET.ACK = 0xFFFFFFFF;
    		mb_fields.CMD_FACTORY_RESET.reserved = 0xFFFFFFFF;
    	}
    #endif
    }TI_MSP432_CMD_MAILBOX;
    
    
    //========================================================================
    // MSP432E_Locking Option definitions
    //========================================================================
    #define	TI_SYSTEM_REGISTERS		0x400FE000	
    #define	TI_DEVICE_ID_REG0		TI_SYSTEM_REGISTERS	
    #define	TI_DEVICE_ID_REG1		(TI_SYSTEM_REGISTERS + 4 )	
    #define	TI_DEVICE_MEMSIZE_REG	(TI_SYSTEM_REGISTERS + 8 )
    #define	TI_USECRL_ADDR			(TI_SYSTEM_REGISTERS + 0x140)
    
    #define	TI_FLASH_REGISTERS		0x400FD000	
    #define	TI_FMA_ADDR				( TI_FLASH_REGISTERS + 0 )
    #define	TI_FMD_ADDR				( TI_FLASH_REGISTERS + 4 )
    #define	TI_FMC_ADDR				( TI_FLASH_REGISTERS + 8 )
    #define	TI_FCRIS_ADDR			( TI_FLASH_REGISTERS + 0x0C )
    #define	TI_FCIM_ADDR			( TI_FLASH_REGISTERS + 0x10 )
    #define	TI_FCMISC_ADDR			( TI_FLASH_REGISTERS + 0x14 )
    
    //--- OTP and protection registers --
    #define	TI_PROT_REG_SIZE	16
    #define	TI_PROT_READ_ENABLE_ADDR	0x400FE200
    #define	TI_PROT_PRG_ENABLE_ADDR		0x400FE400
    
    #define	TI_FMPRE0			(TI_SYSTEM_REGISTERS + 0x130)			
    #define	TI_FMPRE0_2			(TI_SYSTEM_REGISTERS + 0x200)
    #define	TI_FMPRE1			(TI_SYSTEM_REGISTERS + 0x204)			
    #define	TI_FMPRE2			(TI_SYSTEM_REGISTERS + 0x208)			
    #define	TI_FMPRE3			(TI_SYSTEM_REGISTERS + 0x20C)
    #define	TI_FMPRE4			(TI_SYSTEM_REGISTERS + 0x210)
    #define	TI_FMPRE5			(TI_SYSTEM_REGISTERS + 0x214)
    #define	TI_FMPRE6			(TI_SYSTEM_REGISTERS + 0x218)
    #define	TI_FMPRE7			(TI_SYSTEM_REGISTERS + 0x21C)
    #define	TI_FMPRE8			(TI_SYSTEM_REGISTERS + 0x220)			
    #define	TI_FMPRE9			(TI_SYSTEM_REGISTERS + 0x224)			
    #define	TI_FMPRE10			(TI_SYSTEM_REGISTERS + 0x228)			
    #define	TI_FMPRE11			(TI_SYSTEM_REGISTERS + 0x22C)
    #define	TI_FMPRE12			(TI_SYSTEM_REGISTERS + 0x230)
    #define	TI_FMPRE13			(TI_SYSTEM_REGISTERS + 0x234)
    #define	TI_FMPRE14			(TI_SYSTEM_REGISTERS + 0x238)
    #define	TI_FMPRE15			(TI_SYSTEM_REGISTERS + 0x23C)
    
    #define	TI_FMPPE0			(TI_SYSTEM_REGISTERS + 0x134)			
    #define	TI_FMPPE0_2			(TI_SYSTEM_REGISTERS + 0x400)			
    #define	TI_FMPPE1			(TI_SYSTEM_REGISTERS + 0x404)			
    #define	TI_FMPPE2			(TI_SYSTEM_REGISTERS + 0x408)			
    #define	TI_FMPPE3			(TI_SYSTEM_REGISTERS + 0x40C)
    #define	TI_FMPPE4			(TI_SYSTEM_REGISTERS + 0x410)
    #define	TI_FMPPE5			(TI_SYSTEM_REGISTERS + 0x414)
    #define	TI_FMPPE6			(TI_SYSTEM_REGISTERS + 0x418)
    #define	TI_FMPPE7			(TI_SYSTEM_REGISTERS + 0x41C)
    #define	TI_FMPPE8			(TI_SYSTEM_REGISTERS + 0x420)			
    #define	TI_FMPPE9			(TI_SYSTEM_REGISTERS + 0x424)			
    #define	TI_FMPPE10			(TI_SYSTEM_REGISTERS + 0x428)			
    #define	TI_FMPPE11			(TI_SYSTEM_REGISTERS + 0x42C)
    #define	TI_FMPPE12			(TI_SYSTEM_REGISTERS + 0x430)
    #define	TI_FMPPE13			(TI_SYSTEM_REGISTERS + 0x434)
    #define	TI_FMPPE14			(TI_SYSTEM_REGISTERS + 0x438)
    #define	TI_FMPPE15			(TI_SYSTEM_REGISTERS + 0x43C)
    
    #define	TI_USER_DBG			(TI_SYSTEM_REGISTERS + 0x1D0)	
    #define	TI_BOOTCFG			(TI_SYSTEM_REGISTERS + 0x1D0)
    
    #define	TI_USER_REG0		(TI_SYSTEM_REGISTERS + 0x1E0)			
    #define	TI_USER_REG1		(TI_SYSTEM_REGISTERS + 0x1E4)			
    #define	TI_USER_REG2		(TI_SYSTEM_REGISTERS + 0x1E8)			
    #define	TI_USER_REG3		(TI_SYSTEM_REGISTERS + 0x1EC)		
    
    #define	TI_M3_DBG			(TI_SYSTEM_REGISTERS + 0x130)		
    
    #define MSP432E_PROTECTION_SIZE			(4*TI_PROT_REG_SIZE+2*4+6)
    #define MSP432E_USER_PROT_SIZE			(2*TI_PROT_REG_SIZE+4+5)
    #define MSP432E_USER_FPRE_OFFSET		0
    #define MSP432E_USER_FPPE_OFFSET		TI_PROT_REG_SIZE
    #define MSP432E_USER_USER_OFFSET		(2*TI_PROT_REG_SIZE)
    #define MSP432E_USER_DBG_OFFSET			(2*TI_PROT_REG_SIZE + 4)
    #define MSP432E_USER_DBG_WE_OFFSET		(2*TI_PROT_REG_SIZE + 5)
    #define MSP432E_USER_REG_WE_OFFSET		(2*TI_PROT_REG_SIZE + 6)
    #define MSP432E_FP_WE_OFFSET			(2*TI_PROT_REG_SIZE + 7)
    #define MSP432E_PROTECT_SOURCE_OFFSET	(2*TI_PROT_REG_SIZE + 8)
    
    #define MSP432E_FILE_PROT_OFFSET		MSP432E_USER_PROT_SIZE
    #define MSP432E_FILE_PROT_SIZE			(2*TI_PROT_REG_SIZE+4+1)
    #define MSP432E_FILE_FPRE_OFFSET		MSP432E_USER_PROT_SIZE
    #define MSP432E_FILE_FPPE_OFFSET		(MSP432E_USER_PROT_SIZE + TI_PROT_REG_SIZE)
    #define MSP432E_FILE_USER_OFFSET		(MSP432E_USER_PROT_SIZE + 2*TI_PROT_REG_SIZE)
    #define MSP432E_FILE_DBG_OFFSET			(MSP432E_USER_PROT_SIZE + 2*TI_PROT_REG_SIZE + 4)
    
    typedef union TI_MSP432E_LOCKING_OPTIONS_t
    {
    	BYTE bytes[4*MSP432E_PROTECTION_SIZE];
    	struct
    	{
    	 UINT32 MemoryProt_User_FPRE[TI_PROT_REG_SIZE];
    	 UINT32 MemoryProt_User_FPPE[TI_PROT_REG_SIZE];
    	 UINT32 MemoryProt_User_USER[4];
    	 UINT32 UserDebugData;
    	 UINT32 USER_DBG_WrEn;
    	 UINT32 USER_REG_WrEn;
    	 UINT32 FP_WrEn;
    	 UINT32 Protection_Source;
    
    	 UINT32 MemoryProt_File_FPRE[TI_PROT_REG_SIZE];
    	 UINT32 MemoryProt_File_FPPE[TI_PROT_REG_SIZE];
    	 UINT32 MemoryProt_File_USER[4];
    	 UINT32 FileDebugData;
    
    	}data;
    }TI_MSP432E_LOCKING_OPTIONS;
    
    //LONG WINAPI MSPGANG_GetLockingOptions( LONG dest, LONG offset, LONG size, BYTE *data );
    //
    LONG WINAPI MSPGANG_GetLockingOptions( LONG dest, LONG offset, LONG size, BYTE *data );
    		// dest definitions
    	#define		MSP432_USER_LOCKING_OPTIONS		1	
    	#define		MSP432_FILE_LOCKING_OPTIONS		2	
    	#define		MSP432E_USER_LOCKING_OPTIONS	3	
    	#define		MSP432E_FILE_LOCKING_OPTIONS	4	
    
    //LONG WINAPI MSPGANG_SetLockingOptions( LONG dest, LONG offset, LONG size, BYTE *data );
    
    LONG WINAPI MSPGANG_SetLockingOptions( LONG dest, LONG offset, LONG size, BYTE *data );
    		// dest definitions
    		// #define		MSP432_USER_LOCKING_OPTIONS		1	
    		// #define		MSP432E_USER_LOCKING_OPTIONS	3	
    
    //LONG WINAPI MSPGANG_GetLockingOptions( LONG dest, LONG offset, LONG size, BYTE *data );
    //
    LONG WINAPI MSPGANG_GetCmdListTxt( LONG dest, LONG n, LONG k, void **txt );
    		// dest definitions
    	#define		MSP432_MB_CMD_TEXT			1	
    	#define		MSP432_MB_FIELD_TEXT		2	
    
    void WINAPI MSPGANG_Trace( LONG state );
    

  • Hi Susan Yang,

    感谢你的回复,2.1.6是GUI如何操作的,而在4 Dynamic Link Library for MSP-GANG Programmer 中并没有找到与 Secure Device 相关的DLL入口,

    在这个定义附近也没有找到相关的使用说明

  • 请您跟踪或补充下面链接的回复

    e2e.ti.com/.../815521
  • 如果能提供dll的源文件就好了。这样可以看到里面都实现了哪些函数。
  • 国外BU的回复

    I believe the Secure_Task_bit will accomplish what the customer is trying to do. I'll double check this with the tools team.
  • 谢谢你的协助及回复,我已经找到正确的配置项。

  • 很高兴能帮到您!

    In the configuration CFG_BLOWFUSE  set enable and MCU will be secured at the end of Autoprogram - via DLL also. 

       MSPGANG_SetConfig( CFG_BLOWFUSE, 1 );