Skip to content

Commit

Permalink
Fix API bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
cchr-ledger committed Aug 1, 2024
1 parent 01806ed commit d459f3e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions api/scaffold/__init__.py
Original file line number Diff line number Diff line change
@@ -1650,7 +1650,8 @@ def read(self, apndp, addr):
:param apndp: Address space of the register (0 for DP, 1 for AP).
:param addr: Address of the register.
"""
val = 0b0000_0100 | ((apndp & 0b1) << 3) | (addr & 0b11)
val = 0b0000_0100 | ((apndp & 0b1) << 3) | (((addr >> 2) & 1) << 1) \
| ((addr >> 3) & 1)
self.reg_cmd.write(val)
return (self.status(), self.rdata())

@@ -1680,8 +1681,9 @@ def debug_power_up(self, retry=10):
"""
Fully powers up the debug interface by writing to the CRTL/STAT register.
"""
self.clear_errors()
self.write(0, 0x4, (1 << 28) | (1 << 30))
self.clear_errors()
self.read(0, 0)
for _ in range(retry):
(status, ctrl_stat) = self.read(0, 0x4)
if ((ctrl_stat >> 29) & 0x1) == 1 and ((ctrl_stat >> 31) & 0x1) == 1:
@@ -1698,7 +1700,7 @@ def rdata(self):
"""
Retrieve the data read by the last emitted Read transaction.
"""
return int.from_bytes(self.reg_rdata.read(), 'little') | \
return int.from_bytes(self.reg_rdata.read(), 'little') << 0 | \
int.from_bytes(self.reg_rdata.read(), 'little') << 8 | \
int.from_bytes(self.reg_rdata.read(), 'little') << 16 | \
int.from_bytes(self.reg_rdata.read(), 'little') << 24

0 comments on commit d459f3e

Please sign in to comment.