[D /LoadSW [P [A LoadFlag ] % LoadFlag = False -> Check only if Files are existing /Result #1 def /MissingFile '' def % Build SW File name /SWFile FilePath ApplSel.ApplDir add '\' add ApplSel.ApplSWFileName add ApplTypeExt add def /SWFile SWFile '_V' add ApplSel.SWVersion cvs add 'S' add ApplSel.SWSubVersion cvs add def ApplSel.SWBetaInfo '' ne [B /SWFile SWFile '_' add ApplSel.SWBetaInfo add def ] if /SWFile SWFile '.HX3' add def % Build Tree File name /TreeFile FilePath ApplSel.ApplDir add '\' add ApplSel.ApplTreeFileName add ApplTypeExt add def /TreeFile TreeFile '_V' add ApplSel.TreeVersion cvs add 'S' add ApplSel.TreeSubVersion cvs add def ApplSel.TreeBetaInfo '' ne [B /TreeFile TreeFile '_' add ApplSel.TreeBetaInfo add def ] if /TreeFile TreeFile '.HX2' add def % Build DefaultPar File name /DefaultParFile FilePath ApplSel.ApplDir add '\' add ApplSel.ApplTreeFileName add ApplTypeExt add def /DefaultParFile DefaultParFile '_V' add ApplSel.TreeVersion cvs add 'S' add ApplSel.TreeSubVersion cvs add def ApplSel.TreeBetaInfo '' ne [B /DefaultParFile DefaultParFile '_' add ApplSel.TreeBetaInfo add def ] if /DefaultParFile DefaultParFile '.GR3' 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 [B DefaultParFile FileExist not [B /Result #0 def /MissingFile DefaultParFile def ] if ] if Result LoadFlag and [B % Read drive % Get Installation Valid Flag /InstVal APPLInstallValidAddr PackInst:ReadMemory def % Get SW CRC /CRC_drive_SW APPL_SW_CRC_Addr PackInst:_GetBlock def % Get Tree CRC /CRC_drive_Tr APPL_Tr_CRC_Addr PackInst:_GetBlock def % Get SW file name /Filename_read_SW APPL_SW_FileName_Addr GetInstalledFileName uppercase def % Get Tree file name /Filename_read_Tr APPL_Tr_FileName_Addr GetInstalledFileName uppercase def % Read file % Get SW CRC getcurrentdir '\' add SWFile add APPL_SW_CRC_Addr SystGen_CRC crcfromfile /Res exch def /CRC_file_SW exch def % Get Tree CRC getcurrentdir '\' add TreeFile add APPL_Tr_CRC_Addr SystGen_CRC crcfromfile /Res exch def /CRC_file_Tr 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 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 or [B 'File: ' TreeFile extfilename add ' is corrupted!' add log /Result #0 def ] if Result [B InstVal InstallationValid ne [B 'Erasing APPL SW firmware sector...' log 'Erasing APPL Tree firmware sector...' log 3 EraseSWInstance 'Downloading ' SWFile add log SWFile dup loadobj exch PackInst:DownloadHX3File 'Downloading ' TreeFile add log TreeFile dup loadobj exch PackInst:DownloadHX2File 'Updating UPID list...' log TalkIntf.UpdateUPIDList TalkIntf.GetResult 0 ne [B ResetDevice 10000 wait ] if ][B /InstallSW Filename_file_SW Filename_read_SW ne CRC_file_SW CRC_drive_SW ne or def /InstallTr Filename_file_Tr Filename_read_Tr ne CRC_file_Tr CRC_drive_Tr ne or def SystGen_CRC 5 ne [B InstallSW [B APPLInstallValidAddr InstallationInvalid WriteWordToElo 'Erasing APPL SW firmware sector...' log 13 EraseSWInstance 'Downloading ' SWFile add log SWFile dup loadobj exch PackInst:DownloadHX3File ][B 'Download APPL SW firmware skipped. Already up to date...' log ] ifelse InstallTr [B APPLInstallValidAddr InstallationInvalid WriteWordToElo 'Erasing APPL Tree firmware sector...' log 103 EraseSWInstance 'Downloading ' TreeFile add log TreeFile dup loadobj exch PackInst:DownloadHX2File 'Updating UPID list...' log TalkIntf.UpdateUPIDList TalkIntf.GetResult 0 ne [B ResetDevice 10000 wait ] if ][B 'Download APPL Tree firmware skipped. Already up to date...' log ] ifelse ][B InstallSW InstallTr or [B APPLInstallValidAddr InstallationInvalid WriteWordToElo 'Erasing APPL SW firmware sector...' log 'Erasing APPL Tree firmware sector...' log 3 EraseSWInstance 'Downloading ' SWFile add log SWFile dup loadobj exch PackInst:DownloadHX3File 'Downloading ' TreeFile add log TreeFile dup loadobj exch PackInst:DownloadHX2File 'Updating UPID list...' log TalkIntf.UpdateUPIDList TalkIntf.GetResult 0 ne [B ResetDevice 10000 wait ] if ][B 'Download APPL SW firmware skipped. Already up to date...' log 'Download APPL Tree firmware skipped. Already up to date...' log ] ifelse ] ifelse ] ifelse ] if ] if [A /MissingFile /Result] ] ]