#!/usr/bin/env python

import sys

import jlink
import jtag
import chain
import bits
import jtag_dp
import adiv5
import logging

def main():

  logging.basicConfig(filename='test.log', level=logging.DEBUG)

  #jlink_drv = jlink.jtag()
  jlink_drv = jlink.swd()

  print(jlink_drv)

  chspec = chain.bcm49408
  #chspec = chain.bcm58625

  jtag_drv = jtag.chain(jlink_drv, chspec)
  print(jtag_drv)

  dp = jtag_dp.jtag_dp(jtag_drv.device[0])

  aps = adiv5.probe_mem_ap(dp, 256)

  sys.exit(0)

main()
