beautypg.com

Teledyne LeCroy ST Automated Test Suite User Manual User Manual

Page 29

background image

29

GetFullTimestamp ( time_obj )
{
seconds = time_obj [0];
total_nanoseconds = time_obj [1];

miliseconds = total_nanoseconds / 1000000;
microseconds = (total_nanoseconds - 1000000*miliseconds) / 1000;
nanoseconds = (total_nanoseconds - 1000000*miliseconds - 1000*microseconds);

timestamp_str = FormatEx ( "%4d . %03d %03d %03d", seconds,
miliseconds,
microseconds,
nanoseconds );
return timestamp_str;
}

GetCurrTimestamp ()
{
return GetFullTimestamp ( in.Time );
}

########################################################################
# This function returns SAS address value and related company name

#

########################################################################
GetSASAddressString ( address_hi_dword, address_lo_dword )
{
company_name = GetIEEECompanyName ( (address_hi_dword >> 4) & 0x00FFFFFF );
company_name_str = select { company_name == "" : "";
default : Format ( " (%s)", company_name ); };

return FormatEx ( "0x%08X%08X%s\n", address_hi_dword,
address_lo_dword,
company_name_str );
}

########################################################################
# This function returns SAS address value and related company name

#

########################################################################
GetSASAddressString2 (SASAddress)
{

address_hi_dword = Revert32BitData(GetSASAddressHi(SASAddress));

address_lo_dword = Revert32BitData(GetSASAddressLo(SASAddress));

return GetSASAddressString(address_hi_dword, address_lo_dword);
}

########################################################################
# This function reverts given 32 bit valus.

#

########################################################################
Revert32BitData(Data)
{

NewData = (Data << 24);

NewData += ((Data & 0xFF00) << 8);

NewData += ((Data & 0xFF0000) >> 8);

NewData += ((Data >> 24) & 0xFF);

#

Test = FormatEx ( "Data: 0x%08X NewData: %08X \n", Data, NewData);

#

ReportText(Test);

return NewData;

}