ft2232.c: Add missing flyswatter_jtag_blink func.

Add missing function.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k: remove unnecessary endianness byte swaps

Since adbg_wb_burst_write and adbg_wb_burst_read functions already
operate on correct endianness there is no point of swapping bytes
in or1k_jtag_read_cpu and or1k_jtag_write_cpu functions in
or1k_jtag_adv.c file only to be swapped again where they are used.

Endiannes byte swaps for dbg_if are moved to or1k_jtag_read_cpu and
or1k_jtag_write_cpu functions in or1k_jtag.c.

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k.c: or1k_jtag_read_regs used to save register context

adv_debug_sys has burst mode which can be used in
or1k_jtag_read_regs function. This mode makes reading
whole set of registers at once much faster than reading
one at a time.

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k: multiple reads/writes to/from cpu

or1k_jtag_read_cpu and or1k_jtag_write_cpu functions
can now perform multiple word operations.

- adv_debug_sys uses burst mode.
- dbg_if just reads/writes registers in a loop.

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k_jtag_adv.c: add const qualifier

- Added const qualifier to data pointer in
adbg_wb_burst_write function since it does not change
the data.

- Casts cleanup: no more needed to cast to (void *)

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k_jtag_adv.c: burst mode for cpu registers set

reading and writing register set is now performed with
burst operation.

TODO: if sr, npc and ppc would be in sequence in
or1k_core_reg structure (in terms of cpu bus address)
calls to or1k_jtag_read_cpu in or1k_jtag_read_regs and
or1k_jtag_write_cpu in or1k_jtag_write_regs could be
reduced to just two (first 32 registers, second 3 registers)

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k.c: access to debug unit registers grouped

or1k_resume_or_step: instead of reading and writing
couple of times, it can be just one burst read and one
burst write.

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k_resume_or_step: removed second write to npc reg

It appears that it is just redundant write.

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k.c: corrected behaviour while stepping

- While single stepping we can't assume that cpu will be stalled
so quickly. After unstall, or1k_poll must be invoked to check if
cpu is stalled.

- When stepping we execute user code so parameter debug_execution
for or1k_resume_or_step function must be set to 0.

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
skeletal implementation of or1k_checksum_memory

added skeletal implementation of or1k_checksum_memory
(compare-sections executed from gdb will crash OpenOCD
withaout it)

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k_jtag_adv.c: removed burst transfer size limit

Removed limit for word_count in adbg_wb_burst_write and
adbg_wb_burst_read.

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
usb_blaster.c: improved transfer speed

enlarged data buffer in usb_blaster driver thus improved
upload speed for large chunks of data (ex. loading program).

Signed-off-by: Marek Czerski <ma.czerski@gmail.com>
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
helper/binarybuffer: introduce buffer shift right

Introduce a buffer shift right function. This function
is used in or1k_jtag_adv.c but could also be usefull
somewhere else.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k_jtag_adv.c: don't pull waiting for status bit

We don't pull when waiting for the status bit to arrive.

The polling method was triggering an USB transfert at every
polling cycle.

We now shift some more bits, check if we can find the status
bit on the first few bits received in the buffer then we shift
the buffer to discard dummy bits before the status bit.

This method also solves a problem when using the ftdi driver.
Because of an unknown reason, a DRSHIFT command with an end
state equal to DRSHIFT (what we were doing when polling) generates
a TMS transition and a misbehavior in the adb_dbg_if. Now we do
a classic DRSHIFT ending in IDLE state.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
or1k_jtag_adv.c: fix memory leak

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>