SLAU358Q September 2011 – October 2019
The MSPGANG_CallBack_ProgressBar function returns the current status during process execution. The function should be called from an interrupt or separate thread if the main function is executed.
Syntax
LONG WINAPI MSPGANG_CallBack_ProgressBar( void ** text, void ** history, BYTE *G_status, BYTE *DLL_status );
Result
LONG | If the result is negative, then the contents of the MSPGANG_CallBack_ProgressBar have not been updated. |
If the result is positive, then data has been updated. |
Example
#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 cumulative; //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 spare[6]; //byte offset - 16..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.7 V < 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
//Cumulative (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;
};
union DLL_STATUS
{
BYTE bytes[DLL_STATUS_SIZE+4];
struct
{
BYTE new_data;
BYTE COM_status;
//reserved for future
}st;
};
void *text, *history;
GANG_PROGRESS_STATUS Gang_Status;
DLL_STATUS DLL_Status;
int pos;
pos = MSPGANG_CallBack_ProgressBar( &text, &history, Gang_Status.bytes+2, DLL_Status.bytes );
if( pos >= 0 )
{
ProgressBar->SetPos( pos );
...
}