#
# ADAFRUIT FTDI FT232H as a SWD direct connect interface
# Any FT232H based board may work
#
# http://www.ftdichip.com/Products/ICs/FT232H.htm
#
#

adapter driver ftdi

ftdi_vid_pid 0x0403 0x6014

# data MSB..LSB       direction (1:out) MSB..LSB
# 0000'0000'0011'0000 0000'0000'0011'1011
ftdi_layout_init 0x0030 0x003b
# 0xfff8 0xfffb
# Those signal are only required on some platforms or may required to be
# enabled explicitly (e.g. nrf5x chips).
ftdi_layout_signal nSRST -data 0x0010 -oe 0x0010
ftdi_layout_signal nTRST -data 0x0020 -oe 0x0020

# swd enable
ftdi_layout_signal SWD_EN -data 0
# tri-state (configure as input) TDO/TIO when reading
ftdi_layout_signal SWDIO_OE -data 0

transport select swd

# re-configure TDO as tri-state
#ftdi_layout_signal TDO -data 0x0002 -oe 0x0002
#ftdi_layout_signal TDI -data 0x0004

# Adafruit      FT232H    JTAG       SWD
# Name  Pin     Name      Func       Func
#  D0   J1-3    ADBUS0    TCK        SWDCLK
#  D1   J1-4    ADBUS1    TDO/DI     SWDIO
#  D2   J1-5    ADBUS2    TDI/DO     SWDIO
#  D3   J1-6    ADBUS3    TMS        N/A
#  D4   J1-7    ADBUS4    (GPIOL0)   /nSRST  optional module reset
#  D5   J1-8    ADBUS5    (GPIOL1)   /nTRST  optional target reset
#  D6   J1-9    ADBUS6    (GPIOL2)
#  D7   J1-10   ADBUS7    (GPIOL3)
#  C0   J2-1    ACBUS0    (GPIOH0)
#  C1   J2-2    ACBUS1    (GPIOH1)
#  C2   J2-3    ACBUS2    (GPIOH2)
#  C3   J2-4    ACBUS3    (GPIOH3)
#  C4   J2-5    ACBUS4    (GPIOH4)
#  C5   J2-6    ACBUS5    (GPIOH5)
#  C6   J2-7    ACBUS6    (GPIOH6)
#  C7   J2-8    ACBUS7    (GPIOH7)
#  C8   J2-9    ACBUS8
#  C9   J2-10   ACBUS9
