This is an automated email from Gerrit.

Jatin Muddu ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/4079

-- gerrit

commit 78dd950c94965eebc6ed05f542cfdfc466e55c31
Author: jatinmuddu <[email protected]>
Date:   Wed Mar 22 15:04:23 2017 +0530

    Addressed recent code review comments
    
    Change-Id: I45e5619e8f20588e2b6ea8e65cbcfed4bc29315b
    Signed-off-by: jatinmuddu <[email protected]>

diff --git a/README b/README
index 9c6a814..12a48cc 100644
--- a/README
+++ b/README
@@ -299,6 +299,10 @@ method.
 =======================================
 Using Avago Pilot JTAG Master Interface
 =======================================
+Avago Pilot JTAG Master Interface Driver should be built if you
+intend to use OpenOCD on Avago Pilot ASIC. Once OpenOCD is
+built with this driver, OpenOCD can be used to debug JTAG targets
+connected to Avago Pilot JTAG Master Interface.
 
 These instructions help to build and use the Avago Pilot JTAG
 Master Interface driver
diff --git a/src/jtag/drivers/avago_pilot.c b/src/jtag/drivers/avago_pilot.c
index 59cbe80..0683775 100644
--- a/src/jtag/drivers/avago_pilot.c
+++ b/src/jtag/drivers/avago_pilot.c
@@ -341,11 +341,13 @@ static int avago_init(void)
 }
 
 
-/* This array should be in descending order of freq */
 struct avago_freq_info {
        int freq;
        unsigned char regb_val;
-} g_avago_freq_map[] = {
+};
+
+/* This array should be in descending order of freq */
+static const struct avago_freq_info g_avago_freq_map[] = {
        {31200, 0x40},
        {15620, 0x60},
        {7800, 0x80},
@@ -367,7 +369,7 @@ static int avago_speed_div(int speed, int *khz)
        PRINTF("Entered %s\n", __func__);
 
        /* Use 7800 as the default if invalid speed is provided */
-       if ((speed < 0) || (speed > (ssize_t)(ARRAY_SIZE(g_avago_freq_map))))
+       if ((speed < 0) || (speed >= (ssize_t)(ARRAY_SIZE(g_avago_freq_map))))
                speed = 2;
 
        *khz = g_avago_freq_map[speed].freq;
@@ -392,8 +394,8 @@ static int avago_khz(int khz, int *jtag_speed)
                }
        }
 
-       /* This is the lowest frequency in our list */
-       *jtag_speed = i;
+       /* This is the default frequency */
+       *jtag_speed = 2;
 
        return ERROR_OK;
 }
@@ -403,7 +405,7 @@ static int avago_speed(int speed)
 {
        PRINTF("Entered %s\n", __func__);
 
-       if ((speed < 0) || (speed > (ssize_t)(ARRAY_SIZE(g_avago_freq_map))))
+       if ((speed < 0) || (speed >= (ssize_t)(ARRAY_SIZE(g_avago_freq_map))))
                return ERROR_FAIL;
 
        PRINTF("Setting speed: %d %d\n", speed, g_avago_freq_map[speed].freq);

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to