This is an automated email from Gerrit.

Luis de Arquer ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/6123

-- gerrit

commit 33e07f772052284342abf89feca01791fca50d6d
Author: Luis de Arquer <[email protected]>
Date:   Wed Mar 24 17:12:14 2021 +0100

    drivers/ftdi: drscan: Skip DR-PAUSE when endstate == IDLE
    
    Currently, all drscan commands will cycle through DR-PAUSE before reaching
    TAP-IDLE. This patch provides a different path on FTDI driver.
    
    This change is required for the ST On Chip Emulator (OnCE), to avoid
    re-enabling the OnCE tap after every DRSCAN. This is because the OnCE
    TAP (see ST Application Note AN4035) gets disabled if DR-PAUSE is entered
    before DR-UPDATE.
    
    With this commit, the current path:
    
    DR-SHIFT -> DR-EXIT1 -> DR-PAUSE -> DR-EXIT2 -> DR-UPDATE -> IDLE
    
    is changed to:
    
    DR-SHIFT -> DR-EXIT1 -> DR-UPDATE -> IDLE
    
    only if IDLE is the endstate (which is the driver default).
    
    Before this patch, once the SHIFT sequence is complete, the driver would
    normally move to the nearest stable state, which is DR-PAUSE, by clocking
    out a '10' binary sequence. Then it would follow the path provided by
    tap_get_tms_path() to reach endstate. It is done this way because
    tap_get_tms_path() only supports stable states.
    
    After this patch, the strategy is mostly the same, with the exception that,
    if TAP_IDLE is the endstate, a '110' binary sequence is output after 
completing
    the SHIFT sequence. This takes the TAP directly to IDLE, with no further 
action
    required.
    
    A scheme of the DR chain is shown below. A * character is used to mark the
    stable states.
    
     ----------------------------------------------------------------------
     |                                                                    | 0
     v    1         0          0         1        0         1        1    |
    IDLE* -> SEL-DR -> CAPTURE -> SHIFT* -> EXIT1 -> PAUSE* -> EXIT2 -> UPDATE
                                              |                           ^
                                            1 |                           |
                                              -----------------------------
    
    Change-Id: Ib413e5c4c0bbf75dae0b4672119bae4ef03d0258
    Signed-off-by: Luis de Arquer <[email protected]>

diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index 9e47d3c..ef5b696 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -482,7 +482,11 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
                        uint8_t last_bit = 0;
                        if (field->out_value)
                                bit_copy(&last_bit, 0, field->out_value, 
field->num_bits - 1, 1);
-                       uint8_t tms_bits = 0x01;
+
+                       /* If endstate is TAP_IDLE, clock out 1-1-0 (->EXIT1 
->UPDATE ->IDLE)
+                        * Otherwise, clock out 1-0 (->EXIT1 ->PAUSE)
+                        */
+                       uint8_t tms_bits = 0x03;
                        mpsse_clock_tms_cs(mpsse_ctx,
                                        &tms_bits,
                                        0,
@@ -492,9 +496,19 @@ static void ftdi_execute_scan(struct jtag_command *cmd)
                                        last_bit,
                                        ftdi_jtag_mode);
                        tap_set_state(tap_state_transition(tap_get_state(), 1));
+                       if (tap_get_end_state() == TAP_IDLE) {
+                               /* Skip this bit is endstate != TAP_IDLE */
+                               mpsse_clock_tms_cs_out(mpsse_ctx,
+                                               &tms_bits,
+                                               1,
+                                               1,
+                                               last_bit,
+                                               ftdi_jtag_mode);
+                               
tap_set_state(tap_state_transition(tap_get_state(), 1));
+                       }
                        mpsse_clock_tms_cs_out(mpsse_ctx,
                                        &tms_bits,
-                                       1,
+                                       2,
                                        1,
                                        last_bit,
                                        ftdi_jtag_mode);

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to