src/lib/jtag.c
u_long shift_lsbs(int first, int last, int nbits, u_long bits)
{
    if (first) {
        // Start in Run-Test/Idle, Update-DR, or Update-IR state
        PIO_SODR = MASK(TMS_BIT);  PULSE;           // One to Select-DR-Scan
        PIO_CODR = MASK(TMS_BIT);  PULSE;  PULSE;   // Zero to Shift-DR
    }

    while (nbits--) {
        bits = lsbit(bits);
    }

    if (last) {
        PIO_SODR = MASK(TMS_BIT);        // One to Exit1-DR state
        bits = lsbit(bits);
        PULSE;                           // One to update-dr state
    }
    return bits;
}
// If first is true, advance the JTAG state machine to the Shift-DR state.
// Shift nbits, LSB first, between bits and the JTAG scan chain.
// If last is true, set TMS, shift one more bit, and pulse the clock
// again, thus leaving the JTAG state machine in the Update-DR state.
// (If last is false, the state machine remains in the Shift-DR state.)
If first is true, advance the JTAG state machine to the Shift-DR state.
Shift nbits, LSB first, between bits and the JTAG scan chain.
If last is true, set TMS, shift one more bit, and pulse the clock
again, thus leaving the JTAG state machine in the Update-DR state.
(If last is false, the state machine remains in the Shift-DR state.)
If first is true advance the JTAG state machine to the Shift - DR state . Shift nbits LSB first between bits and the JTAG scan chain . If last is true set TMS shift one more bit and pulse the clock again thus leaving the JTAG state machine in the Update - DR state . ( If last is false the state machine remains in the Shift - DR state . )
u_long shift_lsbs(int first, int last, int nbits, u_long bits)
{
    if (first) {
        PIO_SODR = MASK(TMS_BIT);  PULSE;           
        PIO_CODR = MASK(TMS_BIT);  PULSE;  PULSE;   
    }
    while (nbits--) {
        bits = lsbit(bits);
    }
    if (last) {
        PIO_SODR = MASK(TMS_BIT);        
        bits = lsbit(bits);
        PULSE;                           
    }
    return bits;
}
u_long shift_lsbs ( int first , int last , int nbits , u_long bits ) { if ( first ) { PIO_SODR = MASK ( TMS_BIT ) ; PULSE ; PIO_CODR = MASK ( TMS_BIT ) ; PULSE ; PULSE ; } while ( nbits -- ) { bits = lsbit ( bits ) ; } if ( last ) { PIO_SODR = MASK ( TMS_BIT ) ; bits = lsbit ( bits ) ; PULSE ; } return bits ; }
If first is true, advance the JTAG state machine to the Shift-DR state.
If first is true advance the JTAG state machine to the Shift - DR state .
// Start in Run-Test/Idle, Update-DR, or Update-IR state // One to Select-DR-Scan // Zero to Shift-DR // One to Exit1-DR state // One to update-dr state