Commit e2e874aa authored by mifi's avatar mifi
Browse files

- added support for ft2232/jtag_khz

git-svn-id: svn://svn.berlios.de/openocd/trunk@653 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent fcf674ce
......@@ -61,6 +61,8 @@
int ft2232_execute_queue(void);
int ft2232_speed(int speed);
int ft2232_speed_div(int speed, int *khz);
int ft2232_khz(int khz, int *jtag_speed);
int ft2232_register_commands(struct command_context_s *cmd_ctx);
int ft2232_init(void);
int ft2232_quit(void);
......@@ -157,6 +159,9 @@ jtag_interface_t ft2232_interface =
.execute_queue = ft2232_execute_queue,
.speed = ft2232_speed,
.speed_div = ft2232_speed_div,
.khz = ft2232_khz,
.register_commands = ft2232_register_commands,
.init = ft2232_init,
.quit = ft2232_quit,
......@@ -259,6 +264,49 @@ int ft2232_speed(int speed)
return ERROR_OK;
}
int ft2232_speed_div(int speed, int *khz)
{
/*
* Take a look in the FT2232 manual,
* AN2232C-01 Command Processor for
* MPSSE and MCU Host Bus. Chapter 3.8
*/
*khz = 6000 / (1+speed);
return ERROR_OK;
}
int ft2232_khz(int khz, int *jtag_speed)
{
/*
* Take a look in the FT2232 manual,
* AN2232C-01 Command Processor for
* MPSSE and MCU Host Bus. Chapter 3.8
*
* We will calc here with a multiplier
* of 10 for better rounding later.
*/
/* Calc speed, (6000 / khz) - 1 */
*jtag_speed = (60000 / khz) - 10;
/* Add 0.5 for rounding */
*jtag_speed += 5;
/* Calc real speed */
*jtag_speed = *jtag_speed / 10;
/* Check if speed is greater than 0 */
if (*jtag_speed < 0)
{
*jtag_speed = 0;
}
return ERROR_OK;
}
int ft2232_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "ft2232_device_desc", ft2232_handle_device_desc_command,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment