增加新的测试用例,测试看门狗
This commit is contained in:
@@ -145,10 +145,14 @@ if __name__ == '__main__':
|
|||||||
add_tc_2_runlist(ebmmu.tc19())
|
add_tc_2_runlist(ebmmu.tc19())
|
||||||
#'''
|
#'''
|
||||||
|
|
||||||
add_tc_2_runlist(watchdog.tc1())
|
#add_tc_2_runlist(watchdog.tc1())
|
||||||
add_tc_2_runlist(watchdog.tc2())
|
#add_tc_2_runlist(watchdog.tc2())
|
||||||
add_tc_2_runlist(watchdog.tc3())
|
add_tc_2_runlist(watchdog.tc3())
|
||||||
add_tc_2_runlist(watchdog.tc4())
|
add_tc_2_runlist(watchdog.tc4())
|
||||||
|
#add_tc_2_runlist(watchdog.tc5())
|
||||||
|
#add_tc_2_runlist(watchdog.tc6())
|
||||||
|
add_tc_2_runlist(watchdog.tc7())
|
||||||
|
#add_tc_2_runlist(watchdog.tc8())
|
||||||
|
|
||||||
#add_tc_2_runlist(mac.tc1())
|
#add_tc_2_runlist(mac.tc1())
|
||||||
#add_tc_2_runlist(mac.tc2())
|
#add_tc_2_runlist(mac.tc2())
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ SM0/2/4/6与SM1/3/5/7超时逻辑:
|
|||||||
复位继续工作,指看门狗需要重新被触发开始计数直至超时或者复位。写看门狗状态,无论超时没超时,对应bit为1,则对应看门狗被复位。
|
复位继续工作,指看门狗需要重新被触发开始计数直至超时或者复位。写看门狗状态,无论超时没超时,对应bit为1,则对应看门狗被复位。
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def watchdog_test_sm_wr_timeout(tc_id, wd_id):
|
def watchdog_test_sm_lvds_wr_timeout(tc_id, wd_id):
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
||||||
@@ -107,15 +107,15 @@ def watchdog_test_sm_wr_timeout(tc_id, wd_id):
|
|||||||
|
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
|
|
||||||
def watchdog_test_sm_wr_no_timeout(tc_id, wd_id):
|
def watchdog_test_sm_lvds_wr_no_timeout(tc_id, wd_id):
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
slave_sm_id = int((wd_id - 1) / 2)
|
slave_sm_id = int((wd_id - 1) / 2)
|
||||||
tc_des = (f"使能看门狗{wd_id},监视SM{slave_sm_id},写数据到SM中,只写一半,看Watchdog是否超时。\\n"
|
tc_des = (f"使能看门狗{wd_id},监视SM{slave_sm_id},写数据到SM中,正常写,看Watchdog是否超时。\\n"
|
||||||
"清除中断后,错误消失,出问题的设备恢复正常。"
|
"整个过程中,没有看门狗中断产生。"
|
||||||
)
|
)
|
||||||
|
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
@@ -189,7 +189,7 @@ def watchdog_test_sm_wr_no_timeout(tc_id, wd_id):
|
|||||||
return gen_file_def
|
return gen_file_def
|
||||||
|
|
||||||
|
|
||||||
def watchdog_test_sm_rd_timeout(tc_id, wd_id):
|
def watchdog_test_sm_if_rd_timeout(tc_id, wd_id):
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
||||||
@@ -273,15 +273,15 @@ def watchdog_test_sm_rd_timeout(tc_id, wd_id):
|
|||||||
return gen_file_def
|
return gen_file_def
|
||||||
|
|
||||||
|
|
||||||
def watchdog_test_sm_rd_no_timeout(tc_id, wd_id):
|
def watchdog_test_sm_if_rd_no_timeout(tc_id, wd_id):
|
||||||
genPkt = GenPkt()
|
genPkt = GenPkt()
|
||||||
|
|
||||||
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
||||||
sm_idx = 0
|
sm_idx = 0
|
||||||
|
|
||||||
slave_sm_id = int((wd_id - 1) / 2)
|
slave_sm_id = int((wd_id - 1) / 2)
|
||||||
tc_des = (f"使能看门狗{wd_id},监视SM{slave_sm_id},写数据到SM中,只读一半,看Watchdog是否超时。\\n"
|
tc_des = (f"使能看门狗{wd_id},监视SM{slave_sm_id},写数据到SM中,正常读,看Watchdog是否超时。\\n"
|
||||||
"清除中断后,错误消失,出问题的设备恢复正常。"
|
"看门狗正常工作,不需要额外的操作。"
|
||||||
)
|
)
|
||||||
|
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
@@ -337,7 +337,7 @@ def watchdog_test_sm_rd_no_timeout(tc_id, wd_id):
|
|||||||
+genIFRwDataCode(3, 0x074, False, 0x04)
|
+genIFRwDataCode(3, 0x074, False, 0x04)
|
||||||
+genIFRwDataCode(4, 0x074, False, 0x04)
|
+genIFRwDataCode(4, 0x074, False, 0x04)
|
||||||
+genMessageCode("--读缓冲区")
|
+genMessageCode("--读缓冲区")
|
||||||
+genIFRwDataCode(1, 0x800 + slave_sm_id * 0x1000, False, 0x10)
|
+genIFRwDataCode(1, 0x800 + slave_sm_id * 0x1000, False, 0x10 - 1)
|
||||||
|
|
||||||
+genMessageCode("--延时后检查看门狗寄存器")
|
+genMessageCode("--延时后检查看门狗寄存器")
|
||||||
+"#2000000\n"
|
+"#2000000\n"
|
||||||
@@ -356,15 +356,343 @@ def watchdog_test_sm_rd_no_timeout(tc_id, wd_id):
|
|||||||
|
|
||||||
return gen_file_def
|
return gen_file_def
|
||||||
|
|
||||||
def tc1():
|
|
||||||
return watchdog_test_sm_wr_timeout(1, 1)
|
|
||||||
|
|
||||||
|
|
||||||
|
def watchdog_test_sm_if_wr_timeout(tc_id, wd_id):
|
||||||
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
||||||
|
sm_idx = 0
|
||||||
|
|
||||||
|
slave_sm_id = int((wd_id - 1) / 2)
|
||||||
|
tc_des = (f"使能看门狗{wd_id},监视SM{slave_sm_id},写数据到SM中,只写一半,看Watchdog是否超时。\\n"
|
||||||
|
"清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
#>>>>>> 测试用例1 看门狗测试
|
||||||
|
genPkt.clean()
|
||||||
|
genPkt.setPktType(0)
|
||||||
|
|
||||||
|
data = 1 << wd_id ##使能看门狗
|
||||||
|
data0 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
data = 0x002000 ##看门狗的超时值
|
||||||
|
data1 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
data = 0xffffffff ##清除中断
|
||||||
|
data2 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||||||
|
+ genIFRwDataCode(0, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
#+ genSlvSMWriteData(1, 1, 16, list(range(16, 0, -1)))
|
||||||
|
+ genIFRwDataCode(1, 0x302 + slave_sm_id * 4, True, 2, [16, 0])
|
||||||
|
+ genIFRwDataCode(1, 0x404, True, 4, data0)
|
||||||
|
+ genIFRwDataCode(1, 0x40C + (wd_id - 1) * 4, True, 4, data1)
|
||||||
|
+ genIFRwDataCode(1, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(2, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(3, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(4, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(1, 0x400, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+ genIFRwDataCode(0, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(1, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(2, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(3, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(4, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+ genIFRwDataCode(1, slave_sm_id * 0x1000, True, 0x08, list(range(0x08))))
|
||||||
|
#genPkt.addBeforeExc( genIFRwDataCode(1, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff]))
|
||||||
|
|
||||||
|
#data = [0,] * 0x20
|
||||||
|
|
||||||
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||||||
|
#sm_addr = slave_sm_id * 0x1000 #+ 0x800
|
||||||
|
#genPkt.addSubPkt(1, 0, sm_addr, 0x0, 0x08, data)
|
||||||
|
|
||||||
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addAfterExc(#genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
|
#+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
|
#+genTrgTransPktCode(gen_file_def, sm_idx)
|
||||||
|
#+genReadAckPktCode(gen_file_def, sm_idx)
|
||||||
|
genMessageCode("--检查中断寄存器")
|
||||||
|
+genIFRwDataCode(0, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(1, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(2, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(3, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(4, 0x074, False, 0x04)
|
||||||
|
+genMessageCode("--延时后检查看门狗寄存器")
|
||||||
|
+"#4000000\n"
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genIFRwDataCode(1, 0x400, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genMessageCode("--复位数据缓冲区")
|
||||||
|
+genIFRwDataCode(1, 0x300 + slave_sm_id * 4, True, 1, [0, ])
|
||||||
|
+genMessageCode("--延时后检查看门狗寄存器")
|
||||||
|
+"#4000000\n"
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genTcEndFrameCode(gen_file_def))
|
||||||
|
|
||||||
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
|
return gen_file_def
|
||||||
|
|
||||||
|
|
||||||
|
def watchdog_test_sm_if_wr_no_timeout(tc_id, wd_id):
|
||||||
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
||||||
|
sm_idx = 0
|
||||||
|
|
||||||
|
slave_sm_id = int((wd_id - 1) / 2)
|
||||||
|
tc_des = (f"使能看门狗{wd_id},监视SM{slave_sm_id},写数据到SM中,写全部,看Watchdog是否超时。\\n"
|
||||||
|
"清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
#>>>>>> 测试用例1 看门狗测试
|
||||||
|
genPkt.clean()
|
||||||
|
genPkt.setPktType(0)
|
||||||
|
|
||||||
|
data = 1 << wd_id ##使能看门狗
|
||||||
|
data0 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
data = 0x002000 ##看门狗的超时值
|
||||||
|
data1 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
data = 0xffffffff ##清除中断
|
||||||
|
data2 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||||||
|
+ genIFRwDataCode(0, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
#+ genSlvSMWriteData(1, 1, 16, list(range(16, 0, -1)))
|
||||||
|
+ genIFRwDataCode(1, 0x302 + slave_sm_id * 4, True, 2, [16, 0])
|
||||||
|
+ genIFRwDataCode(1, 0x404, True, 4, data0)
|
||||||
|
+ genIFRwDataCode(1, 0x40C + (wd_id - 1) * 4, True, 4, data1)
|
||||||
|
+ genIFRwDataCode(1, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(2, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(3, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(4, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(1, 0x400, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+ genIFRwDataCode(0, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(1, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(2, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(3, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(4, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+ genIFRwDataCode(1, slave_sm_id * 0x1000, True, 0x10, list(range(0x10))))
|
||||||
|
#genPkt.addBeforeExc( genIFRwDataCode(1, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff]))
|
||||||
|
|
||||||
|
#data = [0,] * 0x20
|
||||||
|
|
||||||
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||||||
|
#sm_addr = slave_sm_id * 0x1000 #+ 0x800
|
||||||
|
#genPkt.addSubPkt(1, 0, sm_addr, 0x0, 0x08, data)
|
||||||
|
|
||||||
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addAfterExc(#genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
|
#+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
|
#+genTrgTransPktCode(gen_file_def, sm_idx)
|
||||||
|
#+genReadAckPktCode(gen_file_def, sm_idx)
|
||||||
|
genMessageCode("--检查中断寄存器")
|
||||||
|
+genIFRwDataCode(0, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(1, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(2, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(3, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(4, 0x074, False, 0x04)
|
||||||
|
+genMessageCode("--延时后检查看门狗寄存器")
|
||||||
|
+"#4000000\n"
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genIFRwDataCode(1, 0x400, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genMessageCode("--复位数据缓冲区")
|
||||||
|
+genIFRwDataCode(1, 0x300 + slave_sm_id * 4, True, 1, [0, ])
|
||||||
|
+genMessageCode("--延时后检查看门狗寄存器")
|
||||||
|
+"#4000000\n"
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genTcEndFrameCode(gen_file_def))
|
||||||
|
|
||||||
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
|
return gen_file_def
|
||||||
|
|
||||||
|
def watchdog_test_sm_lvds_rd_timeout(tc_id, wd_id):
|
||||||
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
||||||
|
sm_idx = 0
|
||||||
|
|
||||||
|
slave_sm_id = int((wd_id - 1) / 2)
|
||||||
|
tc_des = (f"使能看门狗{wd_id},监视SM{slave_sm_id},写数据到SM中,只读一半,看Watchdog是否超时。\\n"
|
||||||
|
"清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
#>>>>>> 测试用例1 看门狗测试
|
||||||
|
genPkt.clean()
|
||||||
|
genPkt.setPktType(0)
|
||||||
|
|
||||||
|
data = 1 << wd_id ##使能看门狗
|
||||||
|
data0 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
data = 0x002000 ##看门狗的超时值
|
||||||
|
data1 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
data = 0xffffffff ##清除中断
|
||||||
|
data2 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||||||
|
+ genIFRwDataCode(0, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+ genSlvSMWriteData(1, 1, 16, list(range(16, 0, -1)))
|
||||||
|
+ genIFRwDataCode(1, 0x404, True, 4, data0)
|
||||||
|
+ genIFRwDataCode(1, 0x40C + (wd_id - 1)* 4, True, 4, data1)
|
||||||
|
+ genIFRwDataCode(1, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(2, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(3, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(4, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(1, 0x400, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+ genIFRwDataCode(0, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(1, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(2, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(3, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(4, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(1, 0x400, False, 0x04))
|
||||||
|
#genPkt.addBeforeExc( genIFRwDataCode(1, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff]))
|
||||||
|
|
||||||
|
data = [0,] * 0x20
|
||||||
|
|
||||||
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||||||
|
sm_addr = slave_sm_id * 0x1000 #+ 0x800
|
||||||
|
genPkt.addSubPkt(1, 0, sm_addr, 0x0, 0x08, data)
|
||||||
|
|
||||||
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
|
+genTrgTransPktCode(gen_file_def, sm_idx)
|
||||||
|
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||||
|
+genMessageCode("--检查中断寄存器")
|
||||||
|
+genIFRwDataCode(0, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(1, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(2, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(3, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(4, 0x074, False, 0x04)
|
||||||
|
+genMessageCode("--延时后检查看门狗寄存器")
|
||||||
|
+"#2000000\n"
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genIFRwDataCode(1, 0x400, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genMessageCode("--复位数据缓冲区")
|
||||||
|
+genIFRwDataCode(1, 0x300 + slave_sm_id * 4, True, 1, [0, ])
|
||||||
|
+genMessageCode("--延时后检查看门狗寄存器")
|
||||||
|
+"#2000000\n"
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genTcEndFrameCode(gen_file_def))
|
||||||
|
|
||||||
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
|
return gen_file_def
|
||||||
|
|
||||||
|
|
||||||
|
def watchdog_test_sm_lvds_rd_no_timeout(tc_id, wd_id):
|
||||||
|
genPkt = GenPkt()
|
||||||
|
|
||||||
|
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
||||||
|
sm_idx = 0
|
||||||
|
|
||||||
|
slave_sm_id = int((wd_id - 1) / 2)
|
||||||
|
tc_des = (f"使能看门狗{wd_id},监视SM{slave_sm_id},写数据到SM中,全部读取,看Watchdog是否超时。\\n"
|
||||||
|
"清除中断后,错误消失,出问题的设备恢复正常。"
|
||||||
|
)
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------
|
||||||
|
#>>>>>> 测试用例1 看门狗测试
|
||||||
|
genPkt.clean()
|
||||||
|
genPkt.setPktType(0)
|
||||||
|
|
||||||
|
data = 1 << wd_id ##使能看门狗
|
||||||
|
data0 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
data = 0x002000 ##看门狗的超时值
|
||||||
|
data1 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
data = 0xffffffff ##清除中断
|
||||||
|
data2 = [data&0xff, (data>>8)&0xff, (data>>16)&0xff, (data>>24)&0xff]
|
||||||
|
|
||||||
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
||||||
|
+ genIFRwDataCode(0, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+ genSlvSMWriteData(1, 1, 16, list(range(16, 0, -1)))
|
||||||
|
+ genIFRwDataCode(1, 0x404, True, 4, data0)
|
||||||
|
+ genIFRwDataCode(1, 0x40C + (wd_id - 1) * 4, True, 4, data1)
|
||||||
|
+ genIFRwDataCode(1, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(2, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(3, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(4, 0x078, True, 4, data2)
|
||||||
|
+ genIFRwDataCode(1, 0x400, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+ genIFRwDataCode(0, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(1, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(2, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(3, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(4, 0x074, False, 0x04)
|
||||||
|
+ genIFRwDataCode(1, 0x400, False, 0x04))
|
||||||
|
#genPkt.addBeforeExc( genIFRwDataCode(1, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff]))
|
||||||
|
|
||||||
|
data = [0,] * 0x20
|
||||||
|
|
||||||
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
||||||
|
sm_addr = slave_sm_id * 0x1000 #+ 0x800
|
||||||
|
genPkt.addSubPkt(1, 0, sm_addr, 0x0, 0x10, data)
|
||||||
|
|
||||||
|
sm_idx = 0
|
||||||
|
|
||||||
|
genPkt.addAfterExc(genWriteTransLenCode(gen_file_def, sm_idx)
|
||||||
|
+genWriteTransPktCode(gen_file_def, sm_idx)
|
||||||
|
+genTrgTransPktCode(gen_file_def, sm_idx)
|
||||||
|
+genReadAckPktCode(gen_file_def, sm_idx)
|
||||||
|
+genMessageCode("--检查中断寄存器")
|
||||||
|
+genIFRwDataCode(0, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(1, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(2, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(3, 0x074, False, 0x04)
|
||||||
|
+genIFRwDataCode(4, 0x074, False, 0x04)
|
||||||
|
+genMessageCode("--延时后检查看门狗寄存器")
|
||||||
|
+"#2000000\n"
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genIFRwDataCode(1, 0x400, True, 4, [0xff, 0xff, 0xff, 0xff])
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genMessageCode("--复位数据缓冲区")
|
||||||
|
+genIFRwDataCode(1, 0x300 + slave_sm_id * 4, True, 1, [0, ])
|
||||||
|
+genMessageCode("--延时后检查看门狗寄存器")
|
||||||
|
+"#2000000\n"
|
||||||
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
||||||
|
+genTcEndFrameCode(gen_file_def))
|
||||||
|
|
||||||
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
||||||
|
|
||||||
|
return gen_file_def
|
||||||
|
|
||||||
|
def tc1():
|
||||||
|
return watchdog_test_sm_lvds_wr_timeout(1, 1)
|
||||||
|
|
||||||
def tc2():
|
def tc2():
|
||||||
return watchdog_test_sm_rd_timeout(2, 2)
|
return watchdog_test_sm_if_rd_timeout(2, 2)
|
||||||
|
|
||||||
def tc3():
|
def tc3():
|
||||||
return watchdog_test_sm_wr_no_timeout(3, 1)
|
return watchdog_test_sm_lvds_wr_no_timeout(3, 1)
|
||||||
|
|
||||||
def tc4():
|
def tc4():
|
||||||
return watchdog_test_sm_rd_no_timeout(4, 2)
|
return watchdog_test_sm_if_rd_no_timeout(4, 2)
|
||||||
|
|
||||||
|
def tc5():
|
||||||
|
return watchdog_test_sm_if_wr_timeout(5, 3)
|
||||||
|
|
||||||
|
def tc6():
|
||||||
|
return watchdog_test_sm_lvds_rd_timeout(6, 4)
|
||||||
|
|
||||||
|
|
||||||
|
def tc7():
|
||||||
|
return watchdog_test_sm_if_wr_no_timeout(7, 3)
|
||||||
|
|
||||||
|
def tc8():
|
||||||
|
return watchdog_test_sm_lvds_rd_no_timeout(8, 4)
|
||||||
Reference in New Issue
Block a user