#include "commands.h"
struct cmd_queue_page {
+ struct cmd_queue_page *next;
void *address;
size_t used;
- struct cmd_queue_page *next;
};
#define CMD_QUEUE_PAGE_SIZE (1024 * 1024)
static struct cmd_queue_page *cmd_queue_pages;
+static struct cmd_queue_page *cmd_queue_pages_tail;
struct jtag_command *jtag_command_queue;
static struct jtag_command **next_command_pointer = &jtag_command_queue;
/* Done... */
if (*p_page) {
- while ((*p_page)->next)
- p_page = &((*p_page)->next);
+ p_page = &cmd_queue_pages_tail;
if (CMD_QUEUE_PAGE_SIZE - (*p_page)->used < size)
p_page = &((*p_page)->next);
}
CMD_QUEUE_PAGE_SIZE : size;
(*p_page)->address = malloc(alloc_size);
(*p_page)->next = NULL;
+ cmd_queue_pages_tail = *p_page;
}
offset = (*p_page)->used;
}
cmd_queue_pages = NULL;
+ cmd_queue_pages_tail = NULL;
}
void jtag_command_queue_reset(void)