On Wed, May 13, 2009 at 4:21 PM, Magnus Lundin <lun...@mlu.mine.nu> wrote: > I have been giving this a lot of thought, and I would like to suggest a > compromise :) > > I dont have the code with me right now so some of some function names > ´might be a bit off but the idea should be clear. > >> One problem about jtag_add_end_state() is that it's effectively >> setting a global variable. >> >> This makes it hard to tell, reading some code, what is expected >> to happen after a JTAG scan. >> >> Some other calling code invoked jtag_add_end_state() with some >> end state. > > True, but for some parts of the code, the job is to send a certain > sequence through the DR scan chain without worring about end states, while > some other section handles the logic of rest states, if we must pass idle > a certain number of times, or not, etc. > > So it happens that this is a feature, example in the arm_adi low level > scan functions, the end state is really a "dont care, unless top level has > a strong opinion". And there are several layers betwen the top layer and > the generation of the scan structures. In the worst case, every call to > memap_read/write_memory functions must supply an end state, and this must > propagate all the way down to the scan_inout funtions.
My thinking is that this global variable belongs in the arm_adi code and not in the jtag api then. >> Other than running the debugger, I don't know how to figure out >> what the end state is. > > We can call get_end_state() The idea was to be able to read code and understand what it does. I know how to figure out what the end state is in the debugger. >> Wouldn't it be better if the code had to pass in the end state >> as an argument to the scan operations? > > Not always, TAP_INVALID is really TAP_DONTCARE So why not use TAP_RTI as don't care? Why not use a *specific* state when it's don't care instead of some random state? > And my alternative suggestion is: > > - ONLY call jtag_add_endstate() from target layers, never inside jtag > drivers. Why not move this global variable into the target code? Why does this global variable have to reside in the JTAG code? -- Øyvind Harboe Embedded software and hardware consulting services http://consulting.zylin.com _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development