Sorry, first time I've used git-send-email. Didn't realize the
commit message was so sparse.

While the Seralyzer is currently an internal-only tool in our
Company, I don't think adding it to upstream will have any effect
on the maintainability of the ft2232 driver.

> -----Original Message-----
> From: a...@compbox [mailto:a...@compbox]
> Sent: Monday, September 27, 2010 4:04 PM
> To: [email protected]
> Cc: Austin, Alex
> Subject: [PATCH 2/2] Added Seralyzer
> 
> ---
>  src/jtag/drivers/ft2232.c   |   89
> +++++++++++++++++++++++++++++++++++++++++++
>  tcl/interface/seralyzer.cfg |    9 ++++
>  2 files changed, 98 insertions(+), 0 deletions(-)
>  create mode 100644 tcl/interface/seralyzer.cfg
> 
> diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c
> index 01af152..fc91329 100644
> --- a/src/jtag/drivers/ft2232.c
> +++ b/src/jtag/drivers/ft2232.c
> @@ -175,6 +175,7 @@ static int usbjtag_init(void);
>  static int jtagkey_init(void);
>  static int lm3s811_jtag_init(void);
>  static int icdi_jtag_init(void);
> +static int seralyzer_init(void);
>  static int olimex_jtag_init(void);
>  static int flyswatter_init(void);
>  static int turtle_init(void);
> @@ -193,6 +194,7 @@ static int lisa_l_init(void);
>  /* reset procedures for supported layouts */
>  static void ftx23_reset(int trst, int srst);
>  static void jtagkey_reset(int trst, int srst);
> +static void seralyzer_reset(int trst, int srst);
>  static void olimex_jtag_reset(int trst, int srst);
>  static void flyswatter_reset(int trst, int srst);
>  static void turtle_reset(int trst, int srst);
> @@ -310,6 +312,10 @@ static const struct ft2232_layout
> ft2232_layouts[] =
>               .reset = ftx23_reset,
>               .blink = lisa_l_blink,
>               .channel = INTERFACE_B,
> +        },
> +     { .name = "seralyzer",
> +             .init = seralyzer_init,
> +             .reset = seralyzer_reset,
>       },
>       { .name = NULL, /* END OF TABLE */ },
>  };
> @@ -1414,6 +1420,34 @@ static void ftx23_reset(int trst, int srst)
>       buffer_write(low_direction);
>  }
> 
> +static void seralyzer_reset(int trst, int srst)
> +{
> +     if (trst == 1)
> +     {
> +             low_output &= ~nTRST;
> +     }
> +     else if (trst == 0)
> +     {
> +             low_output |= nTRST;
> +     }
> +
> +     if (srst == 0)
> +     {
> +             low_output &= ~nSRST;
> +     }
> +     else if (srst == 1)
> +     {
> +             low_output |= nSRST;
> +     }
> +
> +     /* command "set data bits low byte" */
> +     buffer_write(0x80);
> +     buffer_write(low_output);
> +     buffer_write(low_direction);
> +     LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x,
> low_direction: 0x%2.2x", trst, srst, low_output,
> +                     low_direction);
> +}
> +
>  static void jtagkey_reset(int trst, int srst)
>  {
>       enum reset_types jtag_reset_config = jtag_get_reset_config();
> @@ -2686,6 +2720,61 @@ static int redbee_init(void)
>       return ERROR_OK;
>  }
> 
> +static int seralyzer_init(void)
> +{
> +     uint8_t  buf[3];
> +     uint32_t bytes_written;
> +
> +     low_output    = 0x08;
> +     low_direction = 0x6b;
> +
> +     if (strcmp(layout->name, "seralyzer") == 0)
> +     {
> +             nTRST    = 0x40;
> +             nTRSTnOE = 0x00; /* no output enable for nTRST */
> +             nSRST    = 0x20;
> +             nSRSTnOE = 0x00; /* no output enable for nSRST */
> +     }
> +     else
> +     {
> +             LOG_ERROR("BUG: seralyzer_init called for non seralyzer
> layout");
> +             exit(-1);
> +     }
> +
> +     enum reset_types jtag_reset_config = jtag_get_reset_config();
> +     if (jtag_reset_config & RESET_TRST_OPEN_DRAIN)
> +     {
> +             LOG_ERROR("can't set nTRST to open-drain on the
> Seralyzer");
> +     }
> +     else
> +     {
> +             low_output |= nTRST;
> +     }
> +
> +     if (jtag_reset_config & RESET_SRST_PUSH_PULL)
> +     {
> +             LOG_ERROR("can't set nSRST to push-pull on the Seralyzer");
> +     }
> +     else
> +     {
> +             low_output |= nSRST;
> +     }
> +
> +     /* initialize low byte for jtag */
> +     buf[0] = 0x80;          /* command "set data bits low byte" */
> +     buf[1] = low_output;    /* value (TMS = 1,TCK = 0, TDI = 0, nOE =
> 0) */
> +     buf[2] = low_direction; /* dir (output = 1), TCK/TDI/TMS = out,
> TDO = in, nOE = out */
> +     LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]);
> +
> +     if (((ft2232_write(buf, 3, &bytes_written)) != ERROR_OK) ||
> (bytes_written != 3))
> +     {
> +             LOG_ERROR("couldn't initialize FT2232 with 'JTAGkey'
> layout");
> +             return ERROR_JTAG_INIT_FAILED;
> +     }
> +
> +     return ERROR_OK;
> +}
> +
>  static int jtagkey_init(void)
>  {
>       uint8_t  buf[3];
> diff --git a/tcl/interface/seralyzer.cfg b/tcl/interface/seralyzer.cfg
> new file mode 100644
> index 0000000..5c89fb2
> --- /dev/null
> +++ b/tcl/interface/seralyzer.cfg
> @@ -0,0 +1,9 @@
> +#
> +# SpectrumDSI Seralyzer
> +#
> +
> +interface ft2232
> +ft2232_device_desc "USB Serial Analyzer v0.2"
> +ft2232_layout seralyzer
> +ft2232_vid_pid 0x0403 0x6011
> +
> --
> 1.7.1

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to