1818PAGE_LENGTH = 128
1919INIT_OFFSET = 128
2020CMDLEN = 2
21- MAX_WAIT = 100
21+ MAX_WAIT = 600
2222
2323
2424class CmisCdbApi (XcvrApi ):
@@ -121,12 +121,12 @@ def cdb1_chkstatus(self):
121121 30h-3Fh=Custom
122122 '''
123123 status = self .xcvr_eeprom .read (consts .CDB1_STATUS )
124- is_busy = bool ((status >> 7 ) & 0x1 )
124+ is_busy = bool ((status >> 7 ) & 0x1 )
125125 cnt = 0
126126 while is_busy and cnt < MAX_WAIT :
127127 time .sleep (0.1 )
128128 status = self .xcvr_eeprom .read (consts .CDB1_STATUS )
129- is_busy = bool ((status >> 7 ) & 0x1 )
129+ is_busy = bool ((status >> 7 ) & 0x1 )
130130 cnt += 1
131131 return status
132132
@@ -165,7 +165,7 @@ def query_cdb_status(self):
165165 if status > 127 :
166166 txt = 'Query CDB status: Busy'
167167 else :
168- status_txt = self .failed_status_dict [ status & 0x3f ]
168+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
169169 txt = 'Query CDB status: Fail- ' + status_txt
170170 else :
171171 txt = 'Query CDB status: Success'
@@ -189,7 +189,7 @@ def module_enter_password(self, psw = 0x00001011):
189189 if status > 127 :
190190 txt = 'Enter password status: Busy'
191191 else :
192- status_txt = self .failed_status_dict [ status & 0x3f ]
192+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
193193 txt = 'Enter password status: Fail- ' + status_txt
194194 else :
195195 txt = 'Enter password status: Success'
@@ -209,7 +209,7 @@ def get_module_feature(self):
209209 if status > 127 :
210210 txt = 'Get module feature status: Busy'
211211 else :
212- status_txt = self .failed_status_dict [ status & 0x3f ]
212+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
213213 txt = 'Get module feature status: Fail- ' + status_txt
214214 else :
215215 txt = 'Get module feature status: Success'
@@ -230,7 +230,7 @@ def get_fw_management_features(self):
230230 if status > 127 :
231231 txt = 'Get firmware management feature status: Busy'
232232 else :
233- status_txt = self .failed_status_dict [ status & 0x3f ]
233+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
234234 txt = 'Get firmware management feature status: Fail- ' + status_txt
235235 else :
236236 txt = 'Get firmware management feature status: Success'
@@ -253,7 +253,7 @@ def get_fw_info(self):
253253 if status > 127 :
254254 txt = 'Get firmware info status: Busy'
255255 else :
256- status_txt = self .failed_status_dict [ status & 0x3f ]
256+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
257257 txt = 'Get firmware info status: Fail- ' + status_txt
258258 else :
259259 txt = 'Get firmware info status: Success'
@@ -284,7 +284,7 @@ def start_fw_download(self, startLPLsize, header, imagesize):
284284 if status > 127 :
285285 txt = 'Start firmware download status: Busy'
286286 else :
287- status_txt = self .failed_status_dict [ status & 0x3f ]
287+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
288288 txt = 'Start firmware download status: Fail- ' + status_txt
289289 else :
290290 txt = 'Start firmware download status: Success'
@@ -307,7 +307,7 @@ def abort_fw_download(self):
307307 if status > 127 :
308308 txt = 'Abort firmware download status: Busy'
309309 else :
310- status_txt = self .failed_status_dict [ status & 0x3f ]
310+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
311311 txt = 'Abort firmware download status: Fail- ' + status_txt
312312 else :
313313 txt = 'Abort firmware download status: Success'
@@ -333,13 +333,12 @@ def block_write_lpl(self, addr, data):
333333 cmd += paddedPayload
334334 cmd [133 - INIT_OFFSET ] = self .cdb_chkcode (cmd )
335335 self .write_cdb (cmd )
336- time .sleep (0.2 )
337336 status = self .cdb1_chkstatus ()
338337 if (status != 0x1 ):
339338 if status > 127 :
340339 txt = 'LPL firmware download status: Busy'
341340 else :
342- status_txt = self .failed_status_dict [ status & 0x3f ]
341+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
343342 txt = 'LPL firmware download status: Fail- ' + status_txt
344343 else :
345344 txt = 'LPL firmware download status: Success'
@@ -386,13 +385,12 @@ def block_write_epl(self, addr, data, autopaging_flag, writelength):
386385 cmd += addr_byte
387386 cmd [133 - INIT_OFFSET ] = self .cdb_chkcode (cmd )
388387 self .write_cdb (cmd )
389- time .sleep (0.2 )
390388 status = self .cdb1_chkstatus ()
391389 if (status != 0x1 ):
392390 if status > 127 :
393391 txt = 'EPL firmware download status: Busy'
394392 else :
395- status_txt = self .failed_status_dict [ status & 0x3f ]
393+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
396394 txt = 'EPL firmware download status: Fail- ' + status_txt
397395 else :
398396 txt = 'EPL firmware download status: Success'
@@ -414,7 +412,7 @@ def validate_fw_image(self):
414412 if status > 127 :
415413 txt = 'Firmware download complete status: Busy'
416414 else :
417- status_txt = self .failed_status_dict [ status & 0x3f ]
415+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
418416 txt = 'Firmware download complete status: Fail- ' + status_txt
419417 else :
420418 txt = 'Firmware download complete status: Success'
@@ -442,7 +440,7 @@ def run_fw_image(self, mode = 0x01):
442440 if status > 127 :
443441 txt = 'Run firmware status: Busy'
444442 else :
445- status_txt = self .failed_status_dict [ status & 0x3f ]
443+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
446444 txt = 'Run firmware status: Fail- ' + status_txt
447445 else :
448446 txt = 'Run firmware status: Success'
@@ -472,7 +470,7 @@ def commit_fw_image(self):
472470 if status > 127 :
473471 txt = 'Commit firmware status: Busy'
474472 else :
475- status_txt = self .failed_status_dict [ status & 0x3f ]
473+ status_txt = self .failed_status_dict . get ( status & 0x3f , "Unknown" )
476474 txt = 'Commit firmware status: Fail- ' + status_txt
477475 else :
478476 txt = 'Commit firmware status: Success'
0 commit comments