mirror of
https://github.com/corundum/corundum.git
synced 2025-01-30 08:32:52 +08:00
Add has_data and status parameters to set_completion, add set_completion_data
This commit is contained in:
parent
16fdbba010
commit
2f279b55b3
20
tb/pcie.py
20
tb/pcie.py
@ -233,30 +233,34 @@ class TLP(object):
|
|||||||
raise Exception("TLP validation failed, request crosses 4K boundary")
|
raise Exception("TLP validation failed, request crosses 4K boundary")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_completion(self, tlp, completer_id):
|
def set_completion(self, tlp, completer_id, has_data=False, status=CPL_STATUS_SC):
|
||||||
"""Prepare completion for TLP"""
|
"""Prepare completion for TLP"""
|
||||||
|
if has_data:
|
||||||
|
self.fmt, self.type = TLP_CPL_DATA
|
||||||
|
else:
|
||||||
self.fmt, self.type = TLP_CPL
|
self.fmt, self.type = TLP_CPL
|
||||||
self.requester_id = tlp.requester_id
|
self.requester_id = tlp.requester_id
|
||||||
self.completer_id = completer_id
|
self.completer_id = completer_id
|
||||||
self.status = CPL_STATUS_SC
|
self.status = status
|
||||||
self.attr = tlp.attr
|
self.attr = tlp.attr
|
||||||
self.tag = tlp.tag
|
self.tag = tlp.tag
|
||||||
self.tc = tlp.tc
|
self.tc = tlp.tc
|
||||||
|
|
||||||
|
def set_completion_data(self, tlp, completer_id):
|
||||||
|
"""Prepare completion with data for TLP"""
|
||||||
|
self.set_completion(tlp, completer_id, True)
|
||||||
|
|
||||||
def set_ur_completion(self, tlp, completer_id):
|
def set_ur_completion(self, tlp, completer_id):
|
||||||
"""Prepare unsupported request (UR) completion for TLP"""
|
"""Prepare unsupported request (UR) completion for TLP"""
|
||||||
self.set_completion(tlp, completer_id)
|
self.set_completion(tlp, completer_id, False, CPL_STATUS_UR)
|
||||||
self.status = CPL_STATUS_UR
|
|
||||||
|
|
||||||
def set_crs_completion(self, tlp, completer_id):
|
def set_crs_completion(self, tlp, completer_id):
|
||||||
"""Prepare configuration request retry status (CRS) completion for TLP"""
|
"""Prepare configuration request retry status (CRS) completion for TLP"""
|
||||||
self.set_completion(tlp, completer_id)
|
self.set_completion(tlp, completer_id, False, CPL_STATUS_CRS)
|
||||||
self.status = CPL_STATUS_CRS
|
|
||||||
|
|
||||||
def set_ca_completion(self, tlp, completer_id):
|
def set_ca_completion(self, tlp, completer_id):
|
||||||
"""Prepare completer abort (CA) completion for TLP"""
|
"""Prepare completer abort (CA) completion for TLP"""
|
||||||
self.set_completion(tlp, completer_id)
|
self.set_completion(tlp, completer_id, False, CPL_STATUS_CA)
|
||||||
self.status = CPL_STATUS_CA
|
|
||||||
|
|
||||||
def set_be(self, addr, length):
|
def set_be(self, addr, length):
|
||||||
"""Compute byte enables and DWORD length from byte address and length"""
|
"""Compute byte enables and DWORD length from byte address and length"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user