The interface to the OpenRISC JTAG system is found in
gdb/or1k-jtag.c
and
gdb/or1k-jtag.h
. The details are not directly
relevant to porting GDB so only an overview is given here. Full
details are found in the commenting within the source code.
The interface is layered, to maximize use. In particular much of the functionality is the same whether the target is connected remotely over TCP/IP or directly via a JP1 header connected to the parallel port.
The highest level is the public function interface, which
operate in terms of entities that are visible in GDB: open and
close the connection, read and write SPRs, read and write
memory, stall, unstall and wait for the processor. These
functions always succeed and have function prefixes
or1k_jtag_
.
The next level is the abstraction provided by the OR1K JTAG
protocol: read/write a JTAG register, read/write a block of
JTAG registers and select a scan chain. These functions may
encounter errors and will deal with them, but otherwise return
no error result. These are static functions (i.e. local to this
file), with prefixes or1k_jtag_
.
The next level is in two sets, one for use with a locally
connected (JP1) JTAG and one for a remote connection over
TCP/IP corresponding to the functions in the previous
layer. These functions detect with errors and return an error
code to indicate an error has occurred. These are static
functions with prefixes: jp1_
and
jtr_
respectively.
The final level comes in separate flavors for locally connected
JTAG (low level routines to drive the JP1 interface) and
remote use (to build and send/receive packets over
TCP/IP). These functions detect errors and return an error code
to indicate an error has occurred. These are static function
with prefixes jp1_ll_
and
jtr_ll_
respectively.
Errors are either dealt with silently or (if fatal) via the GDB
error
function.