Exemple #1
0
def poll_get_responses(h):
    for pv in poll_vars:
        swd.swd_wr(h, swd.SWD_AP, APORT_TAR, pv.addr, False, True)
        swd.swd_rd(h, swd.SWD_AP, APORT_DRW, False, True)
        req = swd.swd_rd(h, swd.SWD_AP, APORT_DRW, False, True)
        pv.value = req.data.value if (
            req.data is not None and req.ack.value == swd.SWD_ACK_OK) else None
Exemple #2
0
def cpu_swd_start(h):
    id = swd.swd_rd(h, swd.SWD_DP, DPORT_IDCODE)  # Read ID code
    swd.swd_wr(h, swd.SWD_DP, DPORT_ABORT, 0x1e)  # Clear errors
    swd.swd_wr(h, swd.SWD_DP, DPORT_CTRL, 0x5 << 28)  # Powerup request
    r = swd.swd_rd(h, swd.SWD_DP, DPORT_STATUS)  # Get status
    return ("no ack" if id.ack.value != swd.SWD_ACK_OK else
            "no powerup" if r.data.value >> 28 != 0xf else "%08X" %
            id.data.value)
Exemple #3
0
def ap_banked_read(h, addr):
    ap_select.reg.APBANKSEL = addr >> 4
    swd.swd_wr(h, swd.SWD_DP, DPORT_SELECT, ap_select.value)
    swd.swd_rd(h, swd.SWD_AP, addr & 0xf)
    return swd.swd_rd(h, swd.SWD_AP, addr & 0xf)
Exemple #4
0
def poll_send_requests(h):
    for pv in poll_vars:
        swd.swd_wr(h, swd.SWD_AP, APORT_TAR, pv.addr, True, False)
        swd.swd_idle_bytes(h, 2)
        swd.swd_rd(h, swd.SWD_AP, APORT_DRW, True, False)
        swd.swd_rd(h, swd.SWD_AP, APORT_DRW, True, False)
Exemple #5
0
def cpu_mem_read32(h, addr):
    ap_addr(h, addr)  # Address to read
    swd.swd_rd(h, swd.SWD_AP, APORT_DRW)  # Dummy read cycle
    r = swd.swd_rd(h, swd.SWD_AP, APORT_DRW)  # Read data
    return r.data.value if r.ack.value == swd.SWD_ACK_OK else None