2025-10-01 08:41:43 +08:00
|
|
|
|
from pyutils import *
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
看门狗0超时逻辑:
|
|
|
|
|
|
1. 看门狗0从系统发送下行包时,触发工作;
|
|
|
|
|
|
2. 系统上行时,停止看门狗工作并复位看门狗计数器;若发生超时,报超时状态,复位继续工作,此时有上行包,不予响应;
|
|
|
|
|
|
3. 看门狗不使能,则对应的看门狗停止工作,也不会报相关的状态位与中断;
|
|
|
|
|
|
4. 写对应的看门狗状态寄存器,对应看门狗被复位;需要重新触发才能工作。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SM0/2/4/6与SM1/3/5/7超时逻辑:
|
|
|
|
|
|
1. 看门狗从读写第一个字节被触发计时工作;第二次读写第一个字节,不影响看门狗工作;
|
|
|
|
|
|
2. 读写最后一个字节,停止看门狗工作并复位看门狗计数器;若发生超时,报超时状态,复位继续工作,此时系统读到最后一个字节,不予响应。
|
|
|
|
|
|
3. 看门狗不使能,则对应的看门狗停止工作,也不会报相关的状态位与中断;
|
|
|
|
|
|
4. 写对应的看门狗状态寄存器,对应看门狗被复位;需要重新触发才能工作。
|
|
|
|
|
|
|
|
|
|
|
|
看门狗17超时逻辑:
|
|
|
|
|
|
1. 看门狗17从系统发送第一个下行包时,触发工作;
|
|
|
|
|
|
2. 系统发送第二个下行包时,停止看门狗工作并复位看门狗计数器;若发生超时,报超时状态,复位继续工作;
|
|
|
|
|
|
3. 看门狗不使能,则对应的看门狗停止工作,也不会报相关的状态位与中断;
|
|
|
|
|
|
4. 写对应的看门狗状态寄存器,对应看门狗被复位;需要重新触发才能工作。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
复位继续工作,指看门狗需要重新被触发开始计数直至超时或者复位。写看门狗状态,无论超时没超时,对应bit为1,则对应看门狗被复位。
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
2025-10-07 17:02:01 +08:00
|
|
|
|
def watchdog_test_sm_lvds_wr_timeout(tc_id, wd_id):
|
2025-10-01 08:41:43 +08:00
|
|
|
|
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])
|
|
|
|
|
|
+ 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,] * 2
|
|
|
|
|
|
data[0] = 0x80
|
|
|
|
|
|
data[1] = 0x00
|
|
|
|
|
|
genPkt.addSubPkt(0x0, 0, 0x302 + slave_sm_id * 4, 0xe, 2, data)
|
|
|
|
|
|
|
|
|
|
|
|
data = [0,] * 0x50
|
|
|
|
|
|
|
|
|
|
|
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
|
|
|
|
|
sm_addr = slave_sm_id * 0x1000 + 0x800
|
|
|
|
|
|
genPkt.addSubPkt(1, 0, sm_addr, 0x1, 0x50, 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("--延时后检查看门狗寄存器")
|
|
|
|
|
|
+"#700000\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("--延时后检查看门狗寄存器")
|
|
|
|
|
|
+"#1200000\n"
|
|
|
|
|
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
|
|
|
|
|
+genTcEndFrameCode(gen_file_def))
|
|
|
|
|
|
|
|
|
|
|
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
|
|
|
|
|
|
|
|
|
|
|
return gen_file_def
|
|
|
|
|
|
|
2025-10-07 17:02:01 +08:00
|
|
|
|
def watchdog_test_sm_lvds_wr_no_timeout(tc_id, wd_id):
|
2025-10-01 08:41:43 +08:00
|
|
|
|
genPkt = GenPkt()
|
|
|
|
|
|
|
|
|
|
|
|
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
|
|
|
|
|
sm_idx = 0
|
|
|
|
|
|
|
|
|
|
|
|
slave_sm_id = int((wd_id - 1) / 2)
|
2025-10-07 17:02:01 +08:00
|
|
|
|
tc_des = (f"使能看门狗{wd_id},监视SM{slave_sm_id},写数据到SM中,正常写,看Watchdog是否超时。\\n"
|
|
|
|
|
|
"整个过程中,没有看门狗中断产生。"
|
2025-10-01 08:41:43 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------
|
|
|
|
|
|
#>>>>>> 测试用例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])
|
|
|
|
|
|
+ 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,] * 2
|
|
|
|
|
|
data[0] = 0x80
|
|
|
|
|
|
data[1] = 0x00
|
|
|
|
|
|
genPkt.addSubPkt(0x0, 0, 0x302 + slave_sm_id * 4, 0xe, 2, data)
|
|
|
|
|
|
|
|
|
|
|
|
data = [0,] * 0x80
|
|
|
|
|
|
|
|
|
|
|
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
|
|
|
|
|
sm_addr = slave_sm_id * 0x1000 + 0x800
|
|
|
|
|
|
genPkt.addSubPkt(1, 0, sm_addr, 0x1, 0x80, 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("--延时后检查看门狗寄存器")
|
|
|
|
|
|
+"#700000\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("--延时后检查看门狗寄存器")
|
|
|
|
|
|
+"#1200000\n"
|
|
|
|
|
|
+genIFRwDataCode(1, 0x400, False, 0x04)
|
|
|
|
|
|
+genTcEndFrameCode(gen_file_def))
|
|
|
|
|
|
|
|
|
|
|
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
|
|
|
|
|
|
|
|
|
|
|
return gen_file_def
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-07 17:02:01 +08:00
|
|
|
|
def watchdog_test_sm_if_rd_timeout(tc_id, wd_id):
|
2025-10-01 08:41:43 +08:00
|
|
|
|
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]
|
|
|
|
|
|
|
|
|
|
|
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
|
|
|
|
|
+ genIFRwDataCode(1, 0x404, True, 4, data0)
|
|
|
|
|
|
+ genIFRwDataCode(1, 0x40C + (wd_id - 1) * 4, True, 4, data1)
|
|
|
|
|
|
+ genIFRwDataCode(0, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
|
|
|
|
|
+ genIFRwDataCode(1, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
|
|
|
|
|
+ genIFRwDataCode(2, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
|
|
|
|
|
+ genIFRwDataCode(3, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
|
|
|
|
|
+ genIFRwDataCode(4, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
|
|
|
|
|
+ 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,] * 2
|
|
|
|
|
|
data[0] = 0x10
|
|
|
|
|
|
data[1] = 0x00
|
|
|
|
|
|
genPkt.addSubPkt(0x0, 0, 0x302 + slave_sm_id * 4, 0xe, 2, data)
|
|
|
|
|
|
|
|
|
|
|
|
data = list(range(0x10))
|
|
|
|
|
|
|
|
|
|
|
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
|
|
|
|
|
sm_addr = slave_sm_id * 0x1000 + 0x800
|
|
|
|
|
|
genPkt.addSubPkt(1, 0, sm_addr, 0x1, 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("--读缓冲区")
|
|
|
|
|
|
+genIFRwDataCode(1, 0x800 + slave_sm_id * 0x1000, False, 8)
|
|
|
|
|
|
|
|
|
|
|
|
+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)
|
|
|
|
|
|
+genIFRwDataCode(1, 0x074, False, 0x04)
|
|
|
|
|
|
+genTcEndFrameCode(gen_file_def))
|
|
|
|
|
|
|
|
|
|
|
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
|
|
|
|
|
|
|
|
|
|
|
return gen_file_def
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-07 17:02:01 +08:00
|
|
|
|
def watchdog_test_sm_if_rd_no_timeout(tc_id, wd_id):
|
2025-10-01 08:41:43 +08:00
|
|
|
|
genPkt = GenPkt()
|
|
|
|
|
|
|
|
|
|
|
|
gen_file_def = "watchdog_tc%02d"%(tc_id, )
|
|
|
|
|
|
sm_idx = 0
|
|
|
|
|
|
|
|
|
|
|
|
slave_sm_id = int((wd_id - 1) / 2)
|
2025-10-07 17:02:01 +08:00
|
|
|
|
tc_des = (f"使能看门狗{wd_id},监视SM{slave_sm_id},写数据到SM中,正常读,看Watchdog是否超时。\\n"
|
|
|
|
|
|
"看门狗正常工作,不需要额外的操作。"
|
2025-10-01 08:41:43 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------
|
|
|
|
|
|
#>>>>>> 测试用例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]
|
|
|
|
|
|
|
|
|
|
|
|
genPkt.addBeforeExc(genTcStartFrameCode(gen_file_def, tc_des)
|
|
|
|
|
|
+ genIFRwDataCode(1, 0x404, True, 4, data0)
|
|
|
|
|
|
+ genIFRwDataCode(1, 0x40C + (wd_id - 1) * 4, True, 4, data1)
|
|
|
|
|
|
+ genIFRwDataCode(0, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
|
|
|
|
|
+ genIFRwDataCode(1, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
|
|
|
|
|
+ genIFRwDataCode(2, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
|
|
|
|
|
+ genIFRwDataCode(3, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
|
|
|
|
|
+ genIFRwDataCode(4, 0x078, True, 4, [0xff, 0xff, 0xff, 0xff])
|
|
|
|
|
|
+ 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,] * 2
|
|
|
|
|
|
data[0] = 0x10
|
|
|
|
|
|
data[1] = 0x00
|
|
|
|
|
|
genPkt.addSubPkt(0x0, 0, 0x302 + slave_sm_id * 4, 0xe, 2, data)
|
|
|
|
|
|
|
|
|
|
|
|
data = list(range(0x10))
|
|
|
|
|
|
|
|
|
|
|
|
#subPkt参数:索引、索引类型、地址、命令、长度、数据
|
|
|
|
|
|
sm_addr = slave_sm_id * 0x1000 + 0x800
|
|
|
|
|
|
genPkt.addSubPkt(1, 0, sm_addr, 0x1, 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("--读缓冲区")
|
2025-10-07 17:06:51 +08:00
|
|
|
|
+genIFRwDataCode(1, 0x800 + slave_sm_id * 0x1000, False, 0x10)
|
2025-10-01 08:41:43 +08:00
|
|
|
|
|
|
|
|
|
|
+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)
|
|
|
|
|
|
+genIFRwDataCode(1, 0x074, False, 0x04)
|
|
|
|
|
|
+genTcEndFrameCode(gen_file_def))
|
|
|
|
|
|
|
|
|
|
|
|
genPkt.gen("./generated/shin/%s.vh"%(gen_file_def, ), 1)
|
|
|
|
|
|
|
|
|
|
|
|
return gen_file_def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-07 17:02:01 +08:00
|
|
|
|
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)
|
|
|
|
|
|
|
2025-10-01 08:41:43 +08:00
|
|
|
|
def tc2():
|
2025-10-07 17:02:01 +08:00
|
|
|
|
return watchdog_test_sm_if_rd_timeout(2, 2)
|
2025-10-01 08:41:43 +08:00
|
|
|
|
|
|
|
|
|
|
def tc3():
|
2025-10-07 17:02:01 +08:00
|
|
|
|
return watchdog_test_sm_lvds_wr_no_timeout(3, 1)
|
2025-10-01 08:41:43 +08:00
|
|
|
|
|
|
|
|
|
|
def tc4():
|
2025-10-07 17:02:01 +08:00
|
|
|
|
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)
|