[D /LoadSW [P [A LoadFlag ] % LoadFlag = False -> Check only if Files are existing /Result #1 def /MissingFile '' def % Build SW File name /SWFile FilePath IntfSel.IntfDir add '\' add IntfSel.IntfSWFileName add IntfSWTypeExt add def /SWFile SWFile '_V' add IntfSel.SWVersion cvs add 'S' add IntfSel.SWSubVersion cvs add def IntfSel.SWBetaInfo '' ne [B /SWFile SWFile '_' add IntfSel.SWBetaInfo add def ] if /SWFile SWFile '.HX3' add def % Build Tree File name /TreeFile FilePath IntfSel.IntfDir add '\' add IntfSel.IntfTreeFileName add IntfTreeTypeExt add def /TreeFile TreeFile '_V' add IntfSel.TreeVersion cvs add 'S' add IntfSel.TreeSubVersion cvs add def IntfSel.TreeBetaInfo '' ne [B /TreeFile TreeFile '_' add IntfSel.TreeBetaInfo 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 [B IntfSel /IntfSpecificSetup known [B /SpecificSetupName IntfSel.IntfSpecificSetup def #0 'IntfLoader:' SpecificSetupName add cvn exec /MissingFile exch def /Result exch def ] if ] if Result LoadFlag and [B % write serialnumber, articlenumber and articlenumber string according to selected interface % only for 2S netX drives at the moment: 10.09.2021, dc IntfSel /VirtArtNumberValue known [B /VirtArtNumberValueAddress $A2006046 def /VirtArtNumberStringAddress $A200603C def /SerialNumberStringAddress $A200602E def VirtArtNumberValueAddress IntfSel.VirtArtNumberValue WriteWordToElo VirtArtNumberStringAddress IntfSel.VirtArtNumberCompleteString 10 ' ' padr WriteStringToElo /SerialNumberStr IntfSel.VirtArtNumberString def %XXXXX.YYY.ZZZ % read .YYY of ordering serial number /Value $A2006294 ReadMemory def /SerialNumberStr SerialNumberStr Value $FF and chr add def /SerialNumberStr SerialNumberStr Value 8 shr chr add def /Value $A2006296 ReadMemory def /SerialNumberStr SerialNumberStr Value $FF and chr add def /SerialNumberStr SerialNumberStr Value 8 shr chr add def % read .ZZZ of ordering serial number /Value $A2006298 ReadMemory def /SerialNumberStr SerialNumberStr Value $FF and chr add def /SerialNumberStr SerialNumberStr Value 8 shr chr add def /Value $A200629A ReadMemory def /SerialNumberStr SerialNumberStr Value $FF and chr add def /SerialNumberStr SerialNumberStr Value 8 shr chr add def /SerialNumberStr SerialNumberStr 0 chr add def SerialNumberStringAddress SerialNumberStr 14 ' ' padr WriteStringToElo ] if % Read drive % Get Installation Valid Flag /InstVal INTFInstallValidAddr PackInst:ReadMemory def % Get SW CRC /CRC_drive_SW INTF_SW_CRC_Addr PackInst:_GetBlock def % Get Tree CRC /CRC_drive_Tr INTF_Tr_CRC_Addr PackInst:_GetBlock def % Get SW file name /Filename_read_SW INTF_SW_FileName_Addr GetInstalledFileName uppercase def % Get Tree file name /Filename_read_Tr INTF_Tr_FileName_Addr GetInstalledFileName uppercase def % Read file % Get SW CRC getcurrentdir '\' add SWFile add INTF_SW_CRC_Flash_Addr SystGen crcfromfile /Res exch def /CRC_file_SW exch def getcurrentdir '\' add SWFile add INTF_SW_CRC_EEPROM_Addr SystGen crcfromfile /Res exch def /CRC_file_SW_EEPROM exch def % Get Tree CRC getcurrentdir '\' add TreeFile add INTF_Tr_CRC_Flash_Addr SystGen crcfromfile /Res exch def /CRC_file_Tr exch def getcurrentdir '\' add TreeFile add INTF_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 % if it is an MI SG8 devices download netx90 FW image before rest of interface FW IntfSel /IntfSpecificSetup known [B IntfSel.IntfSpecificSetup 'MIGenericSetup_NX_SG8' eq[B /SpecificSetupName IntfSel.IntfSpecificSetup def #1 'IntfLoader:' SpecificSetupName add cvn exec /MissingFile exch def /Result exch def IntfSel.Name 'None' ne IntfSel.Name 'NoChange' ne and [B % set bit on to indicate when install is finished /OSInstallCommand OSInstallCommandAddress ReadMemory def /OSInstallCommand OSInstallCommand $0008 or def OSInstallCommandAddress OSInstallCommand WriteWordToElo % set re-Download FW flag and framework enable flag for netx /REDOWNLOADFLAG_ADDRESS $A2001E00 def /REDOWNLOADFLAG_VALUE $00000003 def REDOWNLOADFLAG_ADDRESS REDOWNLOADFLAG_VALUE WriteWordToElo '' log 'Init update of Interface FW-stack...' log ][B % reset re-Download FW flag for netx /REDOWNLOADFLAG_ADDRESS $A2001E00 def /REDOWNLOADFLAG_VALUE $00000001 def REDOWNLOADFLAG_ADDRESS REDOWNLOADFLAG_VALUE WriteWordToElo ]ifelse ]if ] if InstVal InstallationValid ne [B INTFSoftwareUpdateAddr InstallationValid WriteWordToElo INTFTreeUpdateAddr InstallationValid WriteWordToElo INTFInstallValidAddr InstallationInvalid WriteWordToElo 'Downloading ' SWFile add log SystGen 8 eq[B % erase old data in serial flash first 25 PIVar:TalkIntf.EraseSWInstance ]if SWFile dup loadobj exch PackInst:DownloadHX3FileNoFlashMem 'Downloading ' TreeFile add log SystGen 8 eq[B % erase old data in serial flash first 26 PIVar:TalkIntf.EraseSWInstance ]if TreeFile dup loadobj exch PackInst:DownloadHX2File '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 INTFSoftwareUpdateAddr InstallationValid WriteWordToElo INTFInstallValidAddr InstallationInvalid WriteWordToElo 'Downloading ' SWFile add log SystGen 8 eq[B % erase old data in serial flash first 25 PIVar:TalkIntf.EraseSWInstance ]if SWFile dup loadobj exch PackInst:DownloadHX3FileNoFlashMem ][B 'Download INTF SW firmware skipped. Already up to date...' log ] ifelse InstallTr [B INTFTreeUpdateAddr InstallationValid WriteWordToElo INTFInstallValidAddr InstallationInvalid WriteWordToElo 'Clearing Intf Parameter Section...' log 3 PIVar:TalkIntf.ClearInstancePar 'Downloading ' TreeFile add log SystGen 8 eq[B % erase old data in serial flash first 26 PIVar:TalkIntf.EraseSWInstance ]if TreeFile dup loadobj exch PackInst:DownloadHX2File 'Updating UPID list...' log TalkIntf.UpdateUPIDList ][B 'Download INTF Tree firmware skipped. Already up to date...' log ] ifelse ] ifelse IntfSel /IntfSpecificSetup known [B IntfSel.IntfSpecificSetup 'MIGenericSetup_NX_SG8' ne[B /SpecificSetupName IntfSel.IntfSpecificSetup def #1 'IntfLoader:' SpecificSetupName add cvn exec /MissingFile exch def /Result exch def ]if ] if ] if ] if [A /MissingFile /Result] ] % SG8 MI netx devices /MIGenericSetup_NX_SG8 [P [A /LoadFlag ] /Result #1 def /MissingFile '' def /ModuleParFile FilePath IntfSel.IntfDir add IntfSel.IntfModulePar add def ModuleParFile FileExist not [B /Result #0 def /MissingFile ModuleParFile def ] if LoadFlag [B netX90Based[B IntfSel.IntfModulePar GetNetX90FWVersionFromFileName ][B IntfSel.IntfModulePar GetNetX52FWVersionFromFileName ] ifelse /ProtStackRevNumber exch def /ProtStackBuildVers exch def /ProtStackMinorVers exch def /ProtStackMajorVers exch def /ProtStackVersName IntfSel.ProtStackVersName uppercase def ProtStackMajorVers ProtStackMajorVersRead eq ProtStackMinorVers ProtStackMinorVersRead eq and ProtStackBuildVers ProtStackBuildVersRead eq and ProtStackRevNumber ProtStackRevNumberRead eq and ProtStackVersName ProtStackVersNameRead eq and [B 'Download netX firmware skipped. Already up to date...' log IntfSel /Name known [B IntfSel /Name 'NoChange' puts ] if ][B 'Erasing netX firmware sectors...' log 11 PIVar:TalkIntf.EraseSWInstance 'Downloading ' ModuleParFile add log ModuleParFile dup loadobj exch PackInst:DownloadHX2file ] ifelse ] if [A /Result /MissingFile] ] ]