On May 17, 2009, at 1:51 AM, Michael Bruck wrote:

The code in jtag.c currently manipulates the command queue pointers
directly in every function. This increases potential for errors and
makes the code less readable by distracting the reader from the core
algorithm contained in every function.

This patch removes the (repetitive) direct command queue manipulation
from the functions in jtag and packs it into a function called
jtag_queue_command().

The main change looks like this:

-       jtag_command_t **last_cmd;
-       last_cmd = jtag_get_last_command_p();
-
-       *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t));
-       (*last_cmd)->next = NULL;
-       last_comand_pointer = &((*last_cmd)->next);
-       (*last_cmd)->type = JTAG_SCAN;

+       jtag_command_t * cmd = cmd_queue_alloc(sizeof(jtag_command_t));
+       
+       jtag_queue_command(cmd);
+       
+       cmd->type = JTAG_SCAN;



Patch 1 adds jtag_queue_command()

Patches 2-7 rewrite the functions in jtag.c to use jtag_queue_command()
They can be applied in any order. 2-6 are larger functions, 7 includes
all the remaining short functions

Patch 8 rewrites the direct jtag queue manipulation in svf/svf.c to
use jtag_queue_command()

Patch 9 can only be applied after 1-8 were applied. It changes
last_comand_pointer to last_command_pointer.


The patches should not change any algorithms.


Michael
<openocd-jtag-1.txt><openocd-jtag-2.txt><openocd-jtag-3.txt><openocd- jtag-4.txt><openocd-jtag-5.txt><openocd-jtag-6.txt><openocd- jtag-7.txt><openocd-jtag-8.txt><openocd- jtag-9.txt>_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development


Committed revision 1815 through 1823.

--
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