Now that I've read through code for all the JTAG interface drivers (including the 2 new ones), it seems that every single driver does mass duplication of the JTAG state machine handling. The state machine is defined as part of the JTAG standard (although it does allow for extension) and all of the uses in the driver seem to be due to the driver interface rather than the driver doing something unique.

The problems seems to be that the when a user queues a JTAG operation, it is encoded as a command. The possible commands are scan, statemove, pathmove, runtest, reset, end_state, and sleep. These commands are used in the generic code to determine whether the state moves are allowed and for generic validation, but then are passed to the drivers. Each driver then has the same block of code that figure out which command is next in the queue, consults a state lookup table for each command, and then does some work to build up the bytes to send to the interface.

If we instead kept all the state handling in the generic JTAG code and the driver model was based around states, much of the duplicated code would go away. The generic code would deal with breaking a command into the appropriate state movements and the driver could be passed an array of JTAG state changes. That still keeps the overall number of function calls to the driver down while making the driver much simpler.

Thoughts?
--
Rick Altherr
kc8...@kc8apf.net

"He said he hadn't had a byte in three days. I had a short, so I split it with him."
 -- Unsigned



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to