From: kc8apf Date: Mon, 18 May 2009 17:06:36 +0000 (+0000) Subject: JTAG state table updates (short table still disabled). Provided by Dick Hollenbeck... X-Git-Tag: v0.2.0~698 X-Git-Url: https://review.openocd.org/gitweb?a=commitdiff_plain;h=4925bdd4d9c0602d32889190419c83a4afee3d8f;hp=a8daf2251d61b484092b369970649f90a3f32a49;p=openocd.git JTAG state table updates (short table still disabled). Provided by Dick Hollenbeck git-svn-id: svn://svn.berlios.de/openocd/trunk@1812 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index dd3cbf2465..f6ddd8df94 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -853,6 +853,9 @@ int MINIDRIVER(interface_jtag_add_dr_scan)(int num_fields, scan_field_t *fields, #endif } } + + /* field_count represents the true number of fields setup*/ + (*last_cmd)->cmd.scan->num_fields = field_count; return ERROR_OK; } @@ -1315,7 +1318,7 @@ int jtag_build_buffer(scan_command_t *cmd, u8 **buffer) int i; bit_count = jtag_scan_size(cmd); - *buffer = malloc(CEIL(bit_count, 8)); + *buffer = calloc(1,CEIL(bit_count, 8)); bit_count = 0; @@ -3298,23 +3301,23 @@ static struct /* to state: */ /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ /* from state: */ - { B8(1111111,7), B8(0,1), B8(00101,5), B8(01010,5), B8(001101,6), B8(010110,6) }, /* RESET */ - { B8(1111111,7), B8(0,1), B8(001,3), B8(0101,4), B8(0011,4), B8(01011,5) }, /* IDLE */ + { B8(1111111,7), B8(0000000,7), B8(00101,5), B8(01010,5), B8(001101,6), B8(010110,6) }, /* RESET */ + { B8(1111111,7), B8(0000000,7), B8(001,3), B8(0101,4), B8(0011,4), B8(01011,5) }, /* IDLE */ { B8(1111111,7), B8(011,3), B8(00111,5), B8(01,2), B8(001111,6), B8(0101111,7) }, /* DRSHIFT */ - { B8(1111111,7), B8(011,3), B8(01,2), B8(0,1), B8(001111,6), B8(0101111,7) }, /* DRPAUSE */ + { B8(1111111,7), B8(011,3), B8(01,2), B8(0,1), B8(001111,6), B8(0101111,7) }, /* DRPAUSE */ { B8(1111111,7), B8(011,3), B8(00111,5), B8(010111,6), B8(001111,6), B8(01,2) }, /* IRSHIFT */ { B8(1111111,7), B8(011,3), B8(00111,5), B8(010111,6), B8(01,2), B8(0,1) } /* IRPAUSE */ #else /* this is the old table, converted from hex and with the bit_count set to 7 for each combo, like before */ /* to state: */ - /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ /* from state: */ - { B8(1111111,7), B8(0000000,7), B8(0010111,7), B8(0001010,7), B8(0011011,7), B8(0010110,7) }, /* RESET */ - { B8(1111111,7), B8(0000000,7), B8(0100101,7), B8(0000101,7), B8(0101011,7), B8(0001011,7) }, /* IDLE */ - { B8(1111111,7), B8(0110001,7), B8(0000000,7), B8(0000001,7), B8(0001111,7), B8(0101111,7) }, /* DRSHIFT */ - { B8(1111111,7), B8(0110000,7), B8(0100000,7), B8(0010111,7), B8(0011110,7), B8(0101111,7) }, /* DRPAUSE */ - { B8(1111111,7), B8(0110001,7), B8(0000111,7), B8(0010111,7), B8(0000000,7), B8(0000001,7) }, /* IRSHIFT */ - { B8(1111111,7), B8(0110000,7), B8(0011100,7), B8(0010111,7), B8(0100000,7), B8(0101111,7) } /* IRPAUSE */ + /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ /* from state: */ + { B8(1111111,7), B8(0000000,7), B8(0010111,7), B8(0001010,7), B8(0011011,7), B8(0010110,7) }, /* RESET */ + { B8(1111111,7), B8(0000000,7), B8(0100101,7), B8(0000101,7), B8(0101011,7), B8(0001011,7) }, /* IDLE */ + { B8(1111111,7), B8(0110001,7), B8(0000000,7), B8(0000001,7), B8(0001111,7), B8(0101111,7) }, /* DRSHIFT */ + { B8(1111111,7), B8(0110000,7), B8(0100000,7), B8(0010111,7), B8(0011110,7), B8(0101111,7) }, /* DRPAUSE */ + { B8(1111111,7), B8(0110001,7), B8(0000111,7), B8(0010111,7), B8(0000000,7), B8(0000001,7) }, /* IRSHIFT */ + { B8(1111111,7), B8(0110000,7), B8(0011100,7), B8(0010111,7), B8(0011110,7), B8(0101111,7) }, /* IRPAUSE */ #endif