src/lib/jtag.c
inline u_long lsbit(u_long bits)
{
    if (bits & 1)                    // Set or clear TDI
        PIO_SODR = MASK(TDI_BIT);
    else
        PIO_CODR = MASK(TDI_BIT);
    
    CLK_HIGH;                        // Set TCK
    bits >>= 1;

    if( PIO_PDSR & MASK(TDO_BIT) ) { // Test TDO
        bits |= 0x80000000;
    }
    CLK_LOW;                         // Clear TCK

    return bits;
}
// Shift the LSB of bits into the JTAG scan chain, shift bits right,
// and put the JTAG scan chain output into the MSB of bits
Shift the LSB of bits into the JTAG scan chain, shift bits right,
and put the JTAG scan chain output into the MSB of bits
Shift the LSB of bits into the JTAG scan chain shift bits right and put the JTAG scan chain output into the MSB of bits
inline u_long lsbit(u_long bits)
{
    if (bits & 1)                    
        PIO_SODR = MASK(TDI_BIT);
    else
        PIO_CODR = MASK(TDI_BIT);
    CLK_HIGH;                        
    bits >>= 1;
    if( PIO_PDSR & MASK(TDO_BIT) ) { 
        bits |= 0x80000000;
    }
    CLK_LOW;                         
    return bits;
}
inline u_long lsbit ( u_long bits ) { if ( bits & 1 ) PIO_SODR = MASK ( TDI_BIT ) ; else PIO_CODR = MASK ( TDI_BIT ) ; CLK_HIGH ; bits >>= 1 ; if ( PIO_PDSR & MASK ( TDO_BIT ) ) { bits |= 0x80000000 ; } CLK_LOW ; return bits ; }
Shift the LSB of bits into the JTAG scan chain, shift bits right,
and put the JTAG scan chain output into the MSB of bits
Shift the LSB of bits into the JTAG scan chain shift bits right and put the JTAG scan chain output into the MSB of bits
// Set or clear TDI // Set TCK // Test TDO // Clear TCK