[D /LoadSW [P [A LoadFlag ] % LoadFlag = False -> Check only if Files are existing /Result #1 def /MissingFile '' def % Build SW File name /SWFile FilePath MCDir add '\' add MCSWFileName add def /SWFile SWFile 'S' add EloSWVersion 16 cvrs add def /SWFile SWFile '_V' add MCSWVersion cvs add 'S' add MCSWSubVersion cvs add def MCSWBetaInfo '' ne [B /SWFile SWFile '_' add MCSWBetaInfo add def ] if /SWFile SWFile '.HX3' add def %exception for F1150 to install as developer MCTreeFileName 'F1150' search [B /IntfMCTreeExt 'DS' def ]if %end exception % Build Tree File name /TreeFile FilePath MCDir add '\' add MCTreeFileName add def /TreeFile TreeFile 'S' add EloSWVersion 16 cvrs add def /TreeFile TreeFile PowerExtension add IntfMCTreeExt add def /TreeFile TreeFile '_V' add MCTreeVersion cvs add 'S' add MCTreeSubVersion cvs add def MCTreeBetaInfo '' ne [B /TreeFile TreeFile '_' add MCTreeBetaInfo add def ] if /TreeFile TreeFile '.HX2' add def % check if files are existing Result [B SWFile FileExist not [B /Result #0 def /MissingFile SWFile def ] if ] if Result [B TreeFile FileExist not [B /Result #0 def /MissingFile TreeFile def ] if ] if Result LoadFlag and [B % Read drive % Get Installation Valid Flag /InstVal MCInstallValidAddr PackInst:ReadMemory def % Get SW CRC /CRC_drive_SW MC_SW_CRC_Addr PackInst:_GetBlock def % Get Tree CRC /CRC_drive_Tr MC_Tr_CRC_Addr PackInst:_GetBlock def % Get SW file name /Filename_read_SW MC_SW_FileName_Addr GetInstalledFileName uppercase def % Get Tree file name /Filename_read_Tr MC_Tr_FileName_Addr GetInstalledFileName uppercase def % Read file % Get SW CRC getcurrentdir '\' add SWFile add MC_SW_CRC_Flash_Addr SystGen crcfromfile /Res exch def /CRC_file_SW exch def getcurrentdir '\' add SWFile add MC_SW_CRC_EEPROM_Addr SystGen crcfromfile /Res exch def /CRC_file_SW_EEPROM exch def % Get Tree CRC getcurrentdir '\' add TreeFile add MC_Tr_CRC_Flash_Addr SystGen crcfromfile /Res exch def /CRC_file_Tr exch def getcurrentdir '\' add TreeFile add MC_Tr_CRC_EEPROM_Addr SystGen crcfromfile /Res exch def /CRC_file_Tr_EEPROM exch def % Get SW file name /Filename_file_SW SWFile extfilename '' chfileext uppercase def % Get Tree file name /Filename_file_Tr TreeFile extfilename '' chfileext uppercase def % Check CRC CRC_file_SW CRC_invalid1 eq CRC_file_SW CRC_invalid2 eq CRC_file_SW CRC_file_SW_EEPROM ne or or [B 'File: ' SWFile extfilename add ' is corrupted!' add log /Result #0 def ] if CRC_file_Tr CRC_invalid1 eq CRC_file_Tr CRC_invalid2 eq CRC_file_Tr CRC_file_Tr_EEPROM ne or or [B 'File: ' TreeFile extfilename add ' is corrupted!' add log /Result #0 def ] if Result [B InstVal InstallationValid ne [B 'Clearing MC Parameter Section...' log 2 PIVar:TalkIntf.ClearInstancePar 'Downloading ' SWFile add log SystGen 8 eq[B % erase old data in serial flash first 23 PIVar:TalkIntf.EraseSWInstance ]if SWFile dup loadobj exch PackInst:DownloadHX3FileNoFlashMem MCSoftwareUpdateAddr InstallationValid WriteWordToElo 'Downloading ' TreeFile add log SystGen 8 eq[B % erase old data in serial flash first 24 PIVar:TalkIntf.EraseSWInstance ]if TreeFile dup loadobj exch PackInst:DownloadHX2File MCTreeUpdateAddr InstallationValid WriteWordToElo MCInstallValidAddr InstallationInvalid WriteWordToElo 'Updating UPID list...' log TalkIntf.UpdateUPIDList ][B /InstallSW /StrLength Filename_file_SW length def %remove the E from the filename to compare /StrLength StrLength 1 sub def /Filename_file_SW Filename_file_SW 1 StrLength getsubstr def Filename_file_SW Filename_read_SW ne CRC_file_SW CRC_drive_SW ne or def /InstallTr /StrLength Filename_file_Tr length def %remove the E from the filename to compare /StrLength StrLength 1 sub def /Filename_file_Tr Filename_file_Tr 1 StrLength getsubstr def Filename_file_Tr Filename_read_Tr ne CRC_file_Tr CRC_drive_Tr ne or def InstallSW [B MCSoftwareUpdateAddr InstallationValid WriteWordToElo MCInstallValidAddr InstallationInvalid WriteWordToElo 'Downloading ' SWFile add log SystGen 8 eq[B % erase old data in serial flash first 23 PIVar:TalkIntf.EraseSWInstance ]if SWFile dup loadobj exch PackInst:DownloadHX3FileNoFlashMem ][B 'Download MC SW firmware skipped. Already up to date...' log ] ifelse InstallTr [B MCTreeUpdateAddr InstallationValid WriteWordToElo MCInstallValidAddr InstallationInvalid WriteWordToElo 'Downloading ' TreeFile add log SystGen 8 eq[B % erase old data in serial flash first 24 PIVar:TalkIntf.EraseSWInstance ]if TreeFile dup loadobj exch PackInst:DownloadHX2File 'Updating UPID list...' log TalkIntf.UpdateUPIDList ][B 'Download MC Tree firmware skipped. Already up to date...' log ] ifelse ] ifelse ] if ] if [A /MissingFile /Result] ] ]