- corrected rounding in ft2232_khz
authormifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sat, 10 May 2008 12:35:11 +0000 (12:35 +0000)
committermifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Sat, 10 May 2008 12:35:11 +0000 (12:35 +0000)
git-svn-id: svn://svn.berlios.de/openocd/trunk@654 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/jtag/ft2232.c

index f5453a3..0b2e79c 100644 (file)
@@ -287,11 +287,12 @@ int ft2232_khz(int khz, int *jtag_speed)
    * of 10 for better rounding later.
    */
    
-  /* Calc speed, (6000 / khz) - 1 */ 
+  /* Calc speed, (6000 / khz) - 1 */
+  /* Use 65000 for better rounding */ 
   *jtag_speed = (60000 / khz) - 10;
   
-  /* Add 0.5 for rounding */
-  *jtag_speed += 5;
+  /* Add 0.9 for rounding */
+  *jtag_speed += 9;
   
   /* Calc real speed */
   *jtag_speed = *jtag_speed / 10;