You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: oharboe at B. <oh...@ma...> - 2009-05-07 15:40:12
|
Author: oharboe Date: 2009-05-07 15:40:11 +0200 (Thu, 07 May 2009) New Revision: 1643 Modified: trunk/src/target/arm9tdmi.c Log: remove in_handler usage Modified: trunk/src/target/arm9tdmi.c =================================================================== --- trunk/src/target/arm9tdmi.c 2009-05-07 13:36:35 UTC (rev 1642) +++ trunk/src/target/arm9tdmi.c 2009-05-07 13:40:11 UTC (rev 1643) @@ -128,33 +128,33 @@ fields[0].tap = arm7_9->jtag_info.tap; fields[0].num_bits = 32; fields[0].out_value = NULL; - + fields[0].in_value = databus; - - + + fields[0].in_handler = NULL; - + fields[1].tap = arm7_9->jtag_info.tap; fields[1].num_bits = 3; fields[1].out_value = NULL; - + fields[1].in_value = &debug_reason; - - + + fields[1].in_handler = NULL; - + fields[2].tap = arm7_9->jtag_info.tap; fields[2].num_bits = 32; fields[2].out_value = NULL; - + fields[2].in_value = instructionbus; - - + + fields[2].in_handler = NULL; - + if((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK) { return retval; @@ -216,43 +216,35 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 32; fields[0].out_value = out_buf; - fields[0].in_value = NULL; - if (in) - { - fields[0].in_handler = arm_jtag_buf_to_u32; /* deprecated! invoke this from user code! */ - fields[0].in_handler_priv = in; - } - else - { - fields[0].in_handler = NULL; - - } - - + fields[0].in_handler = NULL; fields[1].tap = jtag_info->tap; fields[1].num_bits = 3; fields[1].out_value = &sysspeed_buf; - fields[1].in_value = NULL; - - fields[1].in_handler = NULL; - + fields[2].tap = jtag_info->tap; fields[2].num_bits = 32; fields[2].out_value = instr_buf; - fields[2].in_value = NULL; - - fields[2].in_handler = NULL; - - jtag_add_dr_scan(3, fields, TAP_INVALID); + if (in) + { + u8 tmp[4]; + fields[0].in_value=tmp; + jtag_add_dr_scan_now(3, fields, TAP_INVALID); + *in=flip_u32(le_to_h_u32(tmp), 32); + } + else + { + jtag_add_dr_scan(3, fields, TAP_INVALID); + } + jtag_add_runtest(0, TAP_INVALID); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ @@ -291,33 +283,33 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 32; fields[0].out_value = NULL; - + fields[0].in_value = NULL; fields[0].in_handler = arm_jtag_buf_to_u32; /* deprecated! invoke this from user code! */ fields[0].in_handler_priv = in; - - + + fields[1].tap = jtag_info->tap; fields[1].num_bits = 3; fields[1].out_value = NULL; - + fields[1].in_value = NULL; fields[1].in_handler = NULL; - - - + + + fields[2].tap = jtag_info->tap; fields[2].num_bits = 32; fields[2].out_value = NULL; - + fields[2].in_value = NULL; - - + + fields[2].in_handler = NULL; - + jtag_add_dr_scan(3, fields, TAP_INVALID); jtag_add_runtest(0, TAP_INVALID); @@ -363,7 +355,7 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 32; fields[0].out_value = NULL; - + fields[0].in_value = NULL; switch (size) { @@ -378,29 +370,29 @@ break; } fields[0].in_handler_priv = in; - - + + fields[1].tap = jtag_info->tap; fields[1].num_bits = 3; fields[1].out_value = NULL; - + fields[1].in_value = NULL; fields[1].in_handler = NULL; - - - + + + fields[2].tap = jtag_info->tap; fields[2].num_bits = 32; fields[2].out_value = NULL; - + fields[2].in_value = NULL; - - + + fields[2].in_handler = NULL; - + jtag_add_dr_scan(3, fields, TAP_INVALID); jtag_add_runtest(0, TAP_INVALID); @@ -1032,11 +1024,11 @@ { int retval; command_t *arm9tdmi_cmd; - + retval = arm7_9_register_commands(cmd_ctx); arm9tdmi_cmd = register_command(cmd_ctx, NULL, "arm9tdmi", NULL, COMMAND_ANY, "arm9tdmi specific commands"); register_command(cmd_ctx, arm9tdmi_cmd, "vector_catch", handle_arm9tdmi_catch_vectors_command, COMMAND_EXEC, "catch arm920t vectors ['all'|'none'|'<vec1 vec2 ...>']"); - + return retval; } |
From: oharboe at B. <oh...@ma...> - 2009-05-07 15:36:36
|
Author: oharboe Date: 2009-05-07 15:36:35 +0200 (Thu, 07 May 2009) New Revision: 1642 Modified: trunk/src/target/arm966e.c Log: remove in_handler usage Modified: trunk/src/target/arm966e.c =================================================================== --- trunk/src/target/arm966e.c 2009-05-07 13:31:34 UTC (rev 1641) +++ trunk/src/target/arm966e.c 2009-05-07 13:36:35 UTC (rev 1642) @@ -187,40 +187,31 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 32; fields[0].out_value = NULL; - fields[0].in_value = NULL; - - fields[0].in_handler = NULL; - fields[1].tap = jtag_info->tap; fields[1].num_bits = 6; fields[1].out_value = ®_addr_buf; - fields[1].in_value = NULL; - - fields[1].in_handler = NULL; - fields[2].tap = jtag_info->tap; fields[2].num_bits = 1; fields[2].out_value = &nr_w_buf; - fields[2].in_value = NULL; - - fields[2].in_handler = NULL; - jtag_add_dr_scan(3, fields, TAP_INVALID); - fields[0].in_handler_priv = value; - fields[0].in_handler = arm_jtag_buf_to_u32; /* deprecated! invoke this from user code! */ + u8 tmp[4]; + fields[1].in_value = tmp; - jtag_add_dr_scan(3, fields, TAP_INVALID); + jtag_add_dr_scan_now(3, fields, TAP_INVALID); + *value=flip_u32(le_to_h_u32(tmp), 32); + + #ifdef _DEBUG_INSTRUCTION_EXECUTION_ if((retval = jtag_execute_queue()) != ERROR_OK) { @@ -255,33 +246,33 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 32; fields[0].out_value = value_buf; - + fields[0].in_value = NULL; - - + + fields[0].in_handler = NULL; - + fields[1].tap = jtag_info->tap; fields[1].num_bits = 6; fields[1].out_value = ®_addr_buf; - + fields[1].in_value = NULL; - - + + fields[1].in_handler = NULL; - + fields[2].tap = jtag_info->tap; fields[2].num_bits = 1; fields[2].out_value = &nr_w_buf; - + fields[2].in_value = NULL; - - + + fields[2].in_handler = NULL; - + jtag_add_dr_scan(3, fields, TAP_INVALID); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ |
From: oharboe at B. <oh...@ma...> - 2009-05-07 15:31:34
|
Author: oharboe Date: 2009-05-07 15:31:34 +0200 (Thu, 07 May 2009) New Revision: 1641 Modified: trunk/src/target/arm11_dbgtap.c trunk/src/target/arm920t.c Log: remove in_handler usage Modified: trunk/src/target/arm11_dbgtap.c =================================================================== --- trunk/src/target/arm11_dbgtap.c 2009-05-07 13:26:35 UTC (rev 1640) +++ trunk/src/target/arm11_dbgtap.c 2009-05-07 13:31:34 UTC (rev 1641) @@ -183,7 +183,7 @@ jtag_execute_queue_noclear(); - arm11_in_handler_SCAN_N(tmp); /* deprecated! invoke this from user code! */ + arm11_in_handler_SCAN_N(tmp); } /** Write an instruction into the ITR register Modified: trunk/src/target/arm920t.c =================================================================== --- trunk/src/target/arm920t.c 2009-05-07 13:26:35 UTC (rev 1640) +++ trunk/src/target/arm920t.c 2009-05-07 13:31:34 UTC (rev 1641) @@ -113,51 +113,37 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 1; fields[0].out_value = &access_type_buf; - fields[0].in_value = NULL; - - fields[0].in_handler = NULL; - fields[1].tap = jtag_info->tap; fields[1].num_bits = 32; fields[1].out_value = NULL; - fields[1].in_value = NULL; - - fields[1].in_handler = NULL; - fields[2].tap = jtag_info->tap; fields[2].num_bits = 6; fields[2].out_value = ®_addr_buf; - fields[2].in_value = NULL; - - fields[2].in_handler = NULL; - fields[3].tap = jtag_info->tap; fields[3].num_bits = 1; fields[3].out_value = &nr_w_buf; - fields[3].in_value = NULL; - - fields[3].in_handler = NULL; - jtag_add_dr_scan(4, fields, TAP_INVALID); - fields[1].in_handler_priv = value; - fields[1].in_handler = arm_jtag_buf_to_u32; /* deprecated! invoke this from user code! */ + u8 tmp[4]; + fields[1].in_value = tmp; - jtag_add_dr_scan(4, fields, TAP_INVALID); + jtag_add_dr_scan_now(4, fields, TAP_INVALID); -#ifdef _DEBUG_INSTRUCTION_EXECUTION_ + *value=le_to_h_u32(tmp); + + #ifdef _DEBUG_INSTRUCTION_EXECUTION_ jtag_execute_queue(); LOG_DEBUG("addr: 0x%x value: %8.8x", reg_addr, *value); #endif @@ -185,43 +171,43 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 1; fields[0].out_value = &access_type_buf; - + fields[0].in_value = NULL; - - + + fields[0].in_handler = NULL; - + fields[1].tap = jtag_info->tap; fields[1].num_bits = 32; fields[1].out_value = value_buf; - + fields[1].in_value = NULL; - - + + fields[1].in_handler = NULL; - + fields[2].tap = jtag_info->tap; fields[2].num_bits = 6; fields[2].out_value = ®_addr_buf; - + fields[2].in_value = NULL; - - + + fields[2].in_handler = NULL; - + fields[3].tap = jtag_info->tap; fields[3].num_bits = 1; fields[3].out_value = &nr_w_buf; - + fields[3].in_value = NULL; - - + + fields[3].in_handler = NULL; - + jtag_add_dr_scan(4, fields, TAP_INVALID); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ @@ -252,43 +238,43 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 1; fields[0].out_value = &access_type_buf; - + fields[0].in_value = NULL; - - + + fields[0].in_handler = NULL; - + fields[1].tap = jtag_info->tap; fields[1].num_bits = 32; fields[1].out_value = cp15_opcode_buf; - + fields[1].in_value = NULL; - - + + fields[1].in_handler = NULL; - + fields[2].tap = jtag_info->tap; fields[2].num_bits = 6; fields[2].out_value = ®_addr_buf; - + fields[2].in_value = NULL; - - + + fields[2].in_handler = NULL; - + fields[3].tap = jtag_info->tap; fields[3].num_bits = 1; fields[3].out_value = &nr_w_buf; - + fields[3].in_value = NULL; - - + + fields[3].in_handler = NULL; - + jtag_add_dr_scan(4, fields, TAP_INVALID); arm9tdmi_clock_out(jtag_info, arm_opcode, 0, NULL, 0); |
From: oharboe at B. <oh...@ma...> - 2009-05-07 15:26:36
|
Author: oharboe Date: 2009-05-07 15:26:35 +0200 (Thu, 07 May 2009) New Revision: 1640 Modified: trunk/src/target/arm720t.c Log: remove in_handler usage Modified: trunk/src/target/arm720t.c =================================================================== --- trunk/src/target/arm720t.c 2009-05-07 13:23:14 UTC (rev 1639) +++ trunk/src/target/arm720t.c 2009-05-07 13:26:35 UTC (rev 1640) @@ -112,32 +112,25 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 1; fields[0].out_value = &instruction_buf; - fields[0].in_value = NULL; - - fields[0].in_handler = NULL; - fields[1].tap = jtag_info->tap; fields[1].num_bits = 32; fields[1].out_value = out_buf; - fields[1].in_value = NULL; + fields[1].in_handler = NULL; if (in) { - fields[1].in_handler = arm_jtag_buf_to_u32_flip; /* deprecated! invoke this from user code! */ - fields[1].in_handler_priv = in; + u8 tmp[4]; + fields[1].in_value = tmp; + jtag_add_dr_scan_now(2, fields, TAP_INVALID); + *in=flip_u32(le_to_h_u32(tmp), 32); } else { - fields[1].in_handler = NULL; - + jtag_add_dr_scan(2, fields, TAP_INVALID); } - - - jtag_add_dr_scan(2, fields, TAP_INVALID); - if (clock) jtag_add_runtest(0, TAP_INVALID); |
From: oharboe at B. <oh...@ma...> - 2009-05-07 15:23:15
|
Author: oharboe Date: 2009-05-07 15:23:14 +0200 (Thu, 07 May 2009) New Revision: 1639 Modified: trunk/src/target/arm11_dbgtap.c Log: stop using in_handler Modified: trunk/src/target/arm11_dbgtap.c =================================================================== --- trunk/src/target/arm11_dbgtap.c 2009-05-07 13:04:13 UTC (rev 1638) +++ trunk/src/target/arm11_dbgtap.c 2009-05-07 13:23:14 UTC (rev 1639) @@ -130,7 +130,7 @@ * arm11_add_debug_SCAN_N(). * */ -static int arm11_in_handler_SCAN_N(u8 *in_value, void *priv, struct scan_field_s *field) +static void arm11_in_handler_SCAN_N(u8 *in_value) { /** \todo TODO: clarify why this isnt properly masked in jtag.c jtag_read_buffer() */ u8 v = *in_value & 0x1F; @@ -138,11 +138,10 @@ if (v != 0x10) { LOG_ERROR("'arm11 target' JTAG communication error SCREG SCAN OUT 0x%02x (expected 0x10)", v); - return ERROR_FAIL; + jtag_set_error(ERROR_FAIL); } JTAG_DEBUG("SCREG SCAN OUT 0x%02x", v); - return ERROR_OK; } /** Select and write to Scan Chain Register (SCREG) @@ -177,11 +176,14 @@ scan_field_t field; - arm11_setup_field(arm11, 5, &chain, NULL, &field); + u8 tmp[1]; + arm11_setup_field(arm11, 5, &chain, &tmp, &field); - field.in_handler = arm11_in_handler_SCAN_N; /* deprecated! invoke this from user code! */ + arm11_add_dr_scan_vc(1, &field, state == ARM11_TAP_DEFAULT ? TAP_DRPAUSE : state); - arm11_add_dr_scan_vc(1, &field, state == ARM11_TAP_DEFAULT ? TAP_DRPAUSE : state); + jtag_execute_queue_noclear(); + + arm11_in_handler_SCAN_N(tmp); /* deprecated! invoke this from user code! */ } /** Write an instruction into the ITR register |
From: oharboe at B. <oh...@ma...> - 2009-05-07 15:04:14
|
Author: oharboe Date: 2009-05-07 15:04:13 +0200 (Thu, 07 May 2009) New Revision: 1638 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: jtag API error handling refactoring. Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-07 12:33:26 UTC (rev 1637) +++ trunk/src/jtag/jtag.c 2009-05-07 13:04:13 UTC (rev 1638) @@ -42,8 +42,8 @@ #include <strings.h> #endif -static void jtag_execute_queue_noclear(void); + /* note that this is not marked as static as it must be available from outside jtag.c for those that implement the jtag_xxx() minidriver layer */ @@ -1446,7 +1446,7 @@ return retval; } -static void jtag_execute_queue_noclear(void) +void jtag_execute_queue_noclear(void) { int retval=interface_jtag_execute_queue(); /* we keep the first error */ Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-05-07 12:33:26 UTC (rev 1637) +++ trunk/src/jtag/jtag.h 2009-05-07 13:04:13 UTC (rev 1638) @@ -700,6 +700,9 @@ */ extern int jtag_execute_queue(void); +/* same as jtag_execute_queue() but does not clear the error flag */ +extern void jtag_execute_queue_noclear(void); + /* this flag is set when an error occurs while executing the queue. cleared * by jtag_execute_queue() * @@ -708,8 +711,18 @@ */ extern int jtag_error; +static __inline__ void jtag_set_error(int error) +{ + if ((error==ERROR_OK)||(jtag_error!=ERROR_OK)) + { + /* keep first error */ + return; + } + jtag_error=error; +} + /* can be implemented by hw+sw */ extern int interface_jtag_execute_queue(void); extern int jtag_power_dropout(int* dropout); |
From: oharboe at B. <oh...@ma...> - 2009-05-07 14:33:29
|
Author: oharboe Date: 2009-05-07 14:33:26 +0200 (Thu, 07 May 2009) New Revision: 1637 Modified: trunk/src/target/arm_adi_v5.c Log: remove in_handler usage Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-05-07 12:29:31 UTC (rev 1636) +++ trunk/src/target/arm_adi_v5.c 2009-05-07 12:33:26 UTC (rev 1637) @@ -77,23 +77,23 @@ fields[0].num_bits = 3; buf_set_u32(&out_addr_buf, 0, 3, ((reg_addr >> 1) & 0x6) | (RnW & 0x1)); fields[0].out_value = &out_addr_buf; - + fields[0].in_value = ack; - - + + fields[0].in_handler = NULL; - + fields[1].tap = jtag_info->tap; fields[1].num_bits = 32; fields[1].out_value = outvalue; - + fields[1].in_value = invalue; fields[1].in_handler = NULL; - - - + + + jtag_add_dr_scan(2, fields, TAP_INVALID); return ERROR_OK; @@ -113,34 +113,30 @@ fields[0].num_bits = 3; buf_set_u32(&out_addr_buf, 0, 3, ((reg_addr >> 1) & 0x6) | (RnW & 0x1)); fields[0].out_value = &out_addr_buf; - fields[0].in_value = ack; - - fields[0].in_handler = NULL; - + fields[1].tap = jtag_info->tap; fields[1].num_bits = 32; buf_set_u32(out_value_buf, 0, 32, outvalue); fields[1].out_value = out_value_buf; - fields[1].in_value = NULL; + fields[1].in_handler = NULL; + if (invalue) { - fields[1].in_handler = arm_jtag_buf_to_u32; /* deprecated! invoke this from user code! */ - fields[1].in_handler_priv = invalue; - } - else + u8 tmp[4]; + fields[1].in_value = tmp; + jtag_add_dr_scan_now(2, fields, TAP_INVALID); + + *invalue=flip_u32(le_to_h_u32(tmp), 32); + } else { - fields[1].in_handler = NULL; - + + jtag_add_dr_scan(2, fields, TAP_INVALID); } - - - jtag_add_dr_scan(2, fields, TAP_INVALID); - return ERROR_OK; } @@ -296,7 +292,7 @@ { return scan_inout_check_u32(swjdp, SWJDP_IR_DPACC, reg_addr, DPAP_READ, 0, value); } - + int dap_ap_select(swjdp_common_t *swjdp,u8 apsel) { u32 select; @@ -1012,7 +1008,7 @@ u32 dbgbase,apid; int romtable_present = 0; - u8 mem_ap; + u8 mem_ap; u32 apselold; apselold = swjdp->apsel; @@ -1028,23 +1024,23 @@ switch (apid&0x0F) { case 0: - command_print(cmd_ctx, "\tType is jtag-ap"); + command_print(cmd_ctx, "\tType is jtag-ap"); break; case 1: - command_print(cmd_ctx, "\tType is mem-ap AHB"); + command_print(cmd_ctx, "\tType is mem-ap AHB"); break; case 2: - command_print(cmd_ctx, "\tType is mem-ap APB"); + command_print(cmd_ctx, "\tType is mem-ap APB"); break; default: - command_print(cmd_ctx, "\tUnknown AP-type"); + command_print(cmd_ctx, "\tUnknown AP-type"); break; } command_print(cmd_ctx, "ap debugbase 0x%8.8x", dbgbase); } else { - command_print(cmd_ctx, "No AP found at this apsel 0x%x", apsel); + command_print(cmd_ctx, "No AP found at this apsel 0x%x", apsel); } romtable_present = ((mem_ap)&&(dbgbase != 0xFFFFFFFF)); @@ -1062,11 +1058,11 @@ command_print(cmd_ctx, "\tROM table in legacy format" ); } /* Now we read ROM table ID registers, ref. ARM IHI 0029B sec */ - mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFF0, &cid0); - mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFF4, &cid1); - mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFF8, &cid2); - mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFFC, &cid3); - mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFCC, &memtype); + mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFF0, &cid0); + mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFF4, &cid1); + mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFF8, &cid2); + mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFFC, &cid3); + mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFCC, &memtype); swjdp_transaction_endcheck(swjdp); command_print(cmd_ctx, "\tCID3 0x%x, CID2 0x%x, CID1 0x%x, CID0, 0x%x",cid3,cid2,cid1,cid0); if (memtype&0x01) @@ -1077,10 +1073,10 @@ { command_print(cmd_ctx, "\tMEMTYPE system memory not present. Dedicated debug bus" ); } - + /* Now we read ROM table entries from dbgbase&0xFFFFF000)|0x000 until we get 0x00000000 */ entry_offset = 0; - do + do { mem_ap_read_atomic_u32(swjdp, (dbgbase&0xFFFFF000)|entry_offset, &romentry); command_print(cmd_ctx, "\tROMTABLE[0x%x] = 0x%x",entry_offset,romentry); @@ -1107,16 +1103,16 @@ else { if (romentry) - command_print(cmd_ctx, "\t\tComponent not present"); + command_print(cmd_ctx, "\t\tComponent not present"); else - command_print(cmd_ctx, "\t\tEnd of ROM table"); + command_print(cmd_ctx, "\t\tEnd of ROM table"); } entry_offset += 4; } while (romentry>0); } else { - command_print(cmd_ctx, "\tNo ROM table present"); + command_print(cmd_ctx, "\tNo ROM table present"); } dap_ap_select(swjdp, apselold); |
From: oharboe at B. <oh...@ma...> - 2009-05-07 14:29:32
|
Author: oharboe Date: 2009-05-07 14:29:31 +0200 (Thu, 07 May 2009) New Revision: 1636 Modified: trunk/src/pld/virtex2.c Log: remove in_handler usage Modified: trunk/src/pld/virtex2.c =================================================================== --- trunk/src/pld/virtex2.c 2009-05-07 10:59:06 UTC (rev 1635) +++ trunk/src/pld/virtex2.c 2009-05-07 12:29:31 UTC (rev 1636) @@ -98,12 +98,6 @@ return ERROR_OK; } -int virtex2_jtag_buf_to_u32(u8 *in_buf, void *priv, struct scan_field_s *field) -{ - u32 *dest = priv; - *dest = flip_u32(le_to_h_u32(in_buf), 32); - return ERROR_OK; -} int virtex2_receive_32(struct pld_device_s *pld_device, int num_words, u32 *words) { @@ -113,15 +107,17 @@ scan_field.tap = virtex2_info->tap; scan_field.num_bits = 32; scan_field.out_value = NULL; - scan_field.in_value = NULL; - scan_field.in_handler = virtex2_jtag_buf_to_u32; /* deprecated! invoke this from user code! */ + u8 tmp[4]; + scan_field.in_value = tmp; + scan_field.in_handler = NULL; virtex2_set_instr(virtex2_info->tap, 0x4); /* CFG_OUT */ while (num_words--) { - scan_field.in_handler_priv = words++; - jtag_add_dr_scan(1, &scan_field, TAP_DRPAUSE); + jtag_add_dr_scan_now(1, &scan_field, TAP_DRPAUSE); + + *words++=flip_u32(le_to_h_u32(tmp), 32); } return ERROR_OK; |
From: oharboe at B. <oh...@ma...> - 2009-05-07 12:59:08
|
Author: oharboe Date: 2009-05-07 12:59:06 +0200 (Thu, 07 May 2009) New Revision: 1635 Modified: trunk/src/target/oocd_trace.c Log: David Brownell david-b at pacbell.net fix warnings Modified: trunk/src/target/oocd_trace.c =================================================================== --- trunk/src/target/oocd_trace.c 2009-05-07 09:57:13 UTC (rev 1634) +++ trunk/src/target/oocd_trace.c 2009-05-07 10:59:06 UTC (rev 1635) @@ -98,7 +98,7 @@ if ((bytes_read = read(oocd_trace->tty_fd, ((u8*)data) + (size * 16) - bytes_to_read, bytes_to_read)) < 0) { - LOG_DEBUG("read() returned %i (%s)", bytes_read, strerror(errno)); + LOG_DEBUG("read() returned %zi (%s)", bytes_read, strerror(errno)); } else bytes_to_read -= bytes_read; @@ -148,7 +148,7 @@ * read up any leftover characters to ensure communication is in sync */ while ((bytes_read = read(oocd_trace->tty_fd, trash, sizeof(trash))) > 0) { - LOG_DEBUG("%i bytes read\n", bytes_read); + LOG_DEBUG("%zi bytes read\n", bytes_read); }; return ERROR_OK; |
From: oharboe at B. <oh...@ma...> - 2009-05-07 11:57:13
|
Author: oharboe Date: 2009-05-07 11:57:13 +0200 (Thu, 07 May 2009) New Revision: 1634 Modified: trunk/src/target/target/ti_dm355.cfg Log: fix line endings Modified: trunk/src/target/target/ti_dm355.cfg =================================================================== --- trunk/src/target/target/ti_dm355.cfg 2009-05-07 08:19:07 UTC (rev 1633) +++ trunk/src/target/target/ti_dm355.cfg 2009-05-07 09:57:13 UTC (rev 1634) @@ -1,63 +1,63 @@ -# -# Texas Instruments DaVinci family: TMS320DM355 -# -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - set _CHIPNAME dm355 -} -if { [info exists ENDIAN] } { - set _ENDIAN $ENDIAN -} else { - set _ENDIAN little -} - -# -# For now, expect EMU0/EMU1 jumpered LOW (not TI's default) so ARM and ETB -# are enabled without making ICEpick route ARM and ETB into the JTAG chain. -# -# Also note: when running without RTCK before the PLLs are set up, you -# may need to slow the JTAG clock down quite a lot (under 2 MHz). -# - -# Subsidiary TAP: ARM ETB11, with scan chain for 4K of ETM trace buffer -if { [info exists ETB_TAPID ] } { - set _ETB_TAPID $ETB_TAPID -} else { - set _ETB_TAPID 0x2b900f0f -} -jtag newtap $_CHIPNAME etb -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_ETB_TAPID - -# Subsidiary TAP: ARM926ejs with scan chains for ARM Debug, EmbeddedICE-RT, ETM. -if { [info exists CPU_TAPID ] } { - set _CPU_TAPID $CPU_TAPID -} else { - set _CPU_TAPID 0x07926001 -} -jtag newtap $_CHIPNAME arm -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPU_TAPID - -# Primary TAP: ICEpick (JTAG route controller) and boundary scan -if { [info exists JRC_TAPID ] } { - set _JRC_TAPID $JRC_TAPID -} else { - set _JRC_TAPID 0x0b73b02f -} -jtag newtap $_CHIPNAME jrc -irlen 6 -ircapture 0x1 -irmask 0x3f -expected-id $_JRC_TAPID - -# GDB target: the ARM, using SRAM1 for scratch. SRAM0 (also 16K) -# and the ETB memory (4K) are other options, while trace is unused. -set _TARGETNAME $_CHIPNAME.arm - -target create $_TARGETNAME arm926ejs -endian $_ENDIAN -chain-position $_TARGETNAME -$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x00014000 -work-area-size 0x4000 -work-area-backup 0 - -arm7_9 dbgrq enable -arm7_9 fast_memory_access enable -arm7_9 dcc_downloads enable - -# trace setup -# FIXME we ought to be able to say "... config $_TARGETNAME ..." -# (not "config 0") facilitating additional targets (e.g. other chips) -etm config 0 16 normal full etb -etb config 0 $_CHIPNAME.etb - +# +# Texas Instruments DaVinci family: TMS320DM355 +# +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME dm355 +} +if { [info exists ENDIAN] } { + set _ENDIAN $ENDIAN +} else { + set _ENDIAN little +} + +# +# For now, expect EMU0/EMU1 jumpered LOW (not TI's default) so ARM and ETB +# are enabled without making ICEpick route ARM and ETB into the JTAG chain. +# +# Also note: when running without RTCK before the PLLs are set up, you +# may need to slow the JTAG clock down quite a lot (under 2 MHz). +# + +# Subsidiary TAP: ARM ETB11, with scan chain for 4K of ETM trace buffer +if { [info exists ETB_TAPID ] } { + set _ETB_TAPID $ETB_TAPID +} else { + set _ETB_TAPID 0x2b900f0f +} +jtag newtap $_CHIPNAME etb -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_ETB_TAPID + +# Subsidiary TAP: ARM926ejs with scan chains for ARM Debug, EmbeddedICE-RT, ETM. +if { [info exists CPU_TAPID ] } { + set _CPU_TAPID $CPU_TAPID +} else { + set _CPU_TAPID 0x07926001 +} +jtag newtap $_CHIPNAME arm -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPU_TAPID + +# Primary TAP: ICEpick (JTAG route controller) and boundary scan +if { [info exists JRC_TAPID ] } { + set _JRC_TAPID $JRC_TAPID +} else { + set _JRC_TAPID 0x0b73b02f +} +jtag newtap $_CHIPNAME jrc -irlen 6 -ircapture 0x1 -irmask 0x3f -expected-id $_JRC_TAPID + +# GDB target: the ARM, using SRAM1 for scratch. SRAM0 (also 16K) +# and the ETB memory (4K) are other options, while trace is unused. +set _TARGETNAME $_CHIPNAME.arm + +target create $_TARGETNAME arm926ejs -endian $_ENDIAN -chain-position $_TARGETNAME +$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x00014000 -work-area-size 0x4000 -work-area-backup 0 + +arm7_9 dbgrq enable +arm7_9 fast_memory_access enable +arm7_9 dcc_downloads enable + +# trace setup +# FIXME we ought to be able to say "... config $_TARGETNAME ..." +# (not "config 0") facilitating additional targets (e.g. other chips) +etm config 0 16 normal full etb +etb config 0 $_CHIPNAME.etb + Property changes on: trunk/src/target/target/ti_dm355.cfg ___________________________________________________________________ Name: svn:eol-style + native |
From: oharboe at B. <oh...@ma...> - 2009-05-07 10:19:07
|
Author: oharboe Date: 2009-05-07 10:19:07 +0200 (Thu, 07 May 2009) New Revision: 1633 Added: trunk/src/target/target/ti_dm355.cfg Log: David Brownell <da...@pa...> DaVinci DM355 SoC support Added: trunk/src/target/target/ti_dm355.cfg =================================================================== --- trunk/src/target/target/ti_dm355.cfg 2009-05-07 06:58:52 UTC (rev 1632) +++ trunk/src/target/target/ti_dm355.cfg 2009-05-07 08:19:07 UTC (rev 1633) @@ -0,0 +1,63 @@ +# +# Texas Instruments DaVinci family: TMS320DM355 +# +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME dm355 +} +if { [info exists ENDIAN] } { + set _ENDIAN $ENDIAN +} else { + set _ENDIAN little +} + +# +# For now, expect EMU0/EMU1 jumpered LOW (not TI's default) so ARM and ETB +# are enabled without making ICEpick route ARM and ETB into the JTAG chain. +# +# Also note: when running without RTCK before the PLLs are set up, you +# may need to slow the JTAG clock down quite a lot (under 2 MHz). +# + +# Subsidiary TAP: ARM ETB11, with scan chain for 4K of ETM trace buffer +if { [info exists ETB_TAPID ] } { + set _ETB_TAPID $ETB_TAPID +} else { + set _ETB_TAPID 0x2b900f0f +} +jtag newtap $_CHIPNAME etb -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_ETB_TAPID + +# Subsidiary TAP: ARM926ejs with scan chains for ARM Debug, EmbeddedICE-RT, ETM. +if { [info exists CPU_TAPID ] } { + set _CPU_TAPID $CPU_TAPID +} else { + set _CPU_TAPID 0x07926001 +} +jtag newtap $_CHIPNAME arm -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPU_TAPID + +# Primary TAP: ICEpick (JTAG route controller) and boundary scan +if { [info exists JRC_TAPID ] } { + set _JRC_TAPID $JRC_TAPID +} else { + set _JRC_TAPID 0x0b73b02f +} +jtag newtap $_CHIPNAME jrc -irlen 6 -ircapture 0x1 -irmask 0x3f -expected-id $_JRC_TAPID + +# GDB target: the ARM, using SRAM1 for scratch. SRAM0 (also 16K) +# and the ETB memory (4K) are other options, while trace is unused. +set _TARGETNAME $_CHIPNAME.arm + +target create $_TARGETNAME arm926ejs -endian $_ENDIAN -chain-position $_TARGETNAME +$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x00014000 -work-area-size 0x4000 -work-area-backup 0 + +arm7_9 dbgrq enable +arm7_9 fast_memory_access enable +arm7_9 dcc_downloads enable + +# trace setup +# FIXME we ought to be able to say "... config $_TARGETNAME ..." +# (not "config 0") facilitating additional targets (e.g. other chips) +etm config 0 16 normal full etb +etb config 0 $_CHIPNAME.etb + |
From: oharboe at B. <oh...@ma...> - 2009-05-07 08:58:53
|
Author: oharboe Date: 2009-05-07 08:58:52 +0200 (Thu, 07 May 2009) New Revision: 1632 Removed: trunk/src/flash/at91sam7_old.c trunk/src/flash/at91sam7_old.h Modified: trunk/src/flash/Makefile.am trunk/src/flash/flash.c Log: Deleted at9sam7_old driver. Nobody has complained about the new one yet. Modified: trunk/src/flash/Makefile.am =================================================================== --- trunk/src/flash/Makefile.am 2009-05-07 06:51:27 UTC (rev 1631) +++ trunk/src/flash/Makefile.am 2009-05-07 06:58:52 UTC (rev 1632) @@ -6,13 +6,13 @@ METASOURCES = AUTO noinst_LIBRARIES = libflash.a libflash_a_SOURCES = \ - flash.c lpc2000.c cfi.c non_cfi.c at91sam7.c at91sam7_old.c \ + flash.c lpc2000.c cfi.c non_cfi.c at91sam7.c \ str7x.c str9x.c aduc702x.c nand.c nand_ecc.c \ lpc3180_nand_controller.c stellaris.c str9xpec.c stm32x.c tms470.c \ ecos.c orion_nand.c s3c24xx_nand.c s3c2410_nand.c s3c2412_nand.c \ s3c2440_nand.c s3c2443_nand.c lpc288x.c ocl.c mflash.c pic32mx.c avrf.c noinst_HEADERS = \ - flash.h lpc2000.h cfi.h non_cfi.h at91sam7.h at91sam7_old.h str7x.h \ + flash.h lpc2000.h cfi.h non_cfi.h at91sam7.h str7x.h \ str9x.h nand.h lpc3180_nand_controller.h stellaris.h str9xpec.h \ stm32x.h tms470.h s3c24xx_nand.h s3c24xx_regs_nand.h lpc288x.h \ mflash.h ocl.h pic32mx.h avrf.h Deleted: trunk/src/flash/at91sam7_old.c =================================================================== --- trunk/src/flash/at91sam7_old.c 2009-05-07 06:51:27 UTC (rev 1631) +++ trunk/src/flash/at91sam7_old.c 2009-05-07 06:58:52 UTC (rev 1632) @@ -1,956 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Magnus Lundin * - * lu...@ml... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -/*************************************************************************** -There are some things to notice - -* AT91SAM7S64 is tested -* All AT91SAM7Sxx and AT91SAM7Xxx should work but is not tested -* All parameters are identified from onchip configuartion registers -* -* The flash controller handles erases automatically on a page (128/265 byte) basis -* Only an EraseAll command is supported by the controller -* Partial erases can be implemented in software by writing one 0xFFFFFFFF word to -* some location in every page in the region to be erased -* -* Lock regions (sectors) are 32 or 64 pages -* - ***************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "replacements.h" - -#include "at91sam7_old.h" - -#include "flash.h" -#include "target.h" -#include "log.h" -#include "binarybuffer.h" -#include "types.h" - -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -static int at91sam7_old_register_commands(struct command_context_s *cmd_ctx); -static int at91sam7_old_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int at91sam7_old_erase(struct flash_bank_s *bank, int first, int last); -static int at91sam7_old_protect(struct flash_bank_s *bank, int set, int first, int last); -static int at91sam7_old_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count); -static int at91sam7_old_probe(struct flash_bank_s *bank); -//static int at91sam7_old_auto_probe(struct flash_bank_s *bank); -static int at91sam7_old_erase_check(struct flash_bank_s *bank); -static int at91sam7_old_protect_check(struct flash_bank_s *bank); -static int at91sam7_old_info(struct flash_bank_s *bank, char *buf, int buf_size); - -static u32 at91sam7_old_get_flash_status(flash_bank_t *bank, u8 flashplane); -static void at91sam7_old_set_flash_mode(flash_bank_t *bank, u8 flashplane, int mode); -static u32 at91sam7_old_wait_status_busy(flash_bank_t *bank, u8 flashplane, u32 waitbits, int timeout); -static int at91sam7_old_flash_command(struct flash_bank_s *bank, u8 flashplane, u8 cmd, u16 pagen); -static int at91sam7_old_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -flash_driver_t at91sam7_old_flash = -{ - .name = "at91sam7", - .register_commands = at91sam7_old_register_commands, - .flash_bank_command = at91sam7_old_flash_bank_command, - .erase = at91sam7_old_erase, - .protect = at91sam7_old_protect, - .write = at91sam7_old_write, - .probe = at91sam7_old_probe, - .auto_probe = at91sam7_old_probe, - .erase_check = at91sam7_old_erase_check, - .protect_check = at91sam7_old_protect_check, - .info = at91sam7_old_info -}; - -static u32 MC_FMR_old[4] = { 0xFFFFFF60, 0xFFFFFF70, 0xFFFFFF80, 0xFFFFFF90 }; -static u32 MC_FCR_old[4] = { 0xFFFFFF64, 0xFFFFFF74, 0xFFFFFF84, 0xFFFFFF94 }; -static u32 MC_FSR_old[4] = { 0xFFFFFF68, 0xFFFFFF78, 0xFFFFFF88, 0xFFFFFF98 }; - -static char * EPROC_old[8]= {"Unknown","ARM946-E","ARM7TDMI","Unknown","ARM920T","ARM926EJ-S","Unknown","Unknown"}; -static long NVPSIZ_old[16] = { - 0, - 0x2000, /* 8K */ - 0x4000, /* 16K */ - 0x8000, /* 32K */ - -1, - 0x10000, /* 64K */ - -1, - 0x20000, /* 128K */ - -1, - 0x40000, /* 256K */ - 0x80000, /* 512K */ - -1, - 0x100000, /* 1024K */ - -1, - 0x200000, /* 2048K */ - -1 -}; - -#if 0 -static long SRAMSIZ_old[16] = { - -1, - 0x0400, /* 1K */ - 0x0800, /* 2K */ - -1, - 0x1c000, /* 112K */ - 0x1000, /* 4K */ - 0x14000, /* 80K */ - 0x28000, /* 160K */ - 0x2000, /* 8K */ - 0x4000, /* 16K */ - 0x8000, /* 32K */ - 0x10000, /* 64K */ - 0x20000, /* 128K */ - 0x40000, /* 256K */ - 0x18000, /* 96K */ - 0x80000, /* 512K */ -}; -#endif - -static int at91sam7_old_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *at91sam7_old_cmd = register_command(cmd_ctx, NULL, "at91sam7", NULL, COMMAND_ANY, NULL); - register_command(cmd_ctx, at91sam7_old_cmd, "gpnvm", at91sam7_old_handle_gpnvm_command, COMMAND_EXEC, - "at91sam7 gpnvm <num> <bit> set|clear, set or clear at91sam7 gpnvm bit"); - - return ERROR_OK; -} - -static u32 at91sam7_old_get_flash_status(flash_bank_t *bank, u8 flashplane) -{ - target_t *target = bank->target; - u32 fsr; - - target_read_u32(target, MC_FSR_old[flashplane], &fsr); - - return fsr; -} - -/* Read clock configuration and set at91sam7_old_info->usec_clocks*/ -static void at91sam7_old_read_clock_info(flash_bank_t *bank) -{ - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - target_t *target = bank->target; - u32 mckr, mcfr, pllr; - unsigned long tmp = 0, mainfreq; - int flashplane; - - /* Read main clock freqency register */ - target_read_u32(target, CKGR_MCFR_old, &mcfr); - /* Read master clock register */ - target_read_u32(target, PMC_MCKR_old, &mckr); - /* Read Clock Generator PLL Register */ - target_read_u32(target, CKGR_PLLR_old, &pllr); - - at91sam7_old_info->mck_valid = 0; - switch (mckr & PMC_MCKR_CSS_old) - { - case 0: /* Slow Clock */ - at91sam7_old_info->mck_valid = 1; - mainfreq = RC_FREQ_old / 16ul * (mcfr & 0xffff); - tmp = mainfreq; - break; - case 1: /* Main Clock */ - if (mcfr & CKGR_MCFR_MAINRDY_old) - { - at91sam7_old_info->mck_valid = 1; - mainfreq = RC_FREQ_old / 16ul * (mcfr & 0xffff); - tmp = mainfreq; - } - break; - - case 2: /* Reserved */ - break; - case 3: /* PLL Clock */ - if (mcfr & CKGR_MCFR_MAINRDY_old) - { - target_read_u32(target, CKGR_PLLR_old, &pllr); - if (!(pllr & CKGR_PLLR_DIV_old)) - break; /* 0 Hz */ - at91sam7_old_info->mck_valid = 1; - mainfreq = RC_FREQ_old / 16ul * (mcfr & 0xffff); - /* Integer arithmetic should have sufficient precision - as long as PLL is properly configured. */ - tmp = mainfreq / (pllr & CKGR_PLLR_DIV_old) * - (((pllr & CKGR_PLLR_MUL_old) >> 16) + 1); - } - break; - } - - /* Prescaler adjust */ - if (((mckr & PMC_MCKR_PRES_old) >> 2) == 7) - at91sam7_old_info->mck_valid = 0; - else - at91sam7_old_info->mck_freq = tmp >> ((mckr & PMC_MCKR_PRES_old) >> 2); - - /* Forget old flash timing */ - for (flashplane = 0; flashplane<at91sam7_old_info->num_planes; flashplane++) - { - at91sam7_old_set_flash_mode(bank, flashplane, FMR_TIMING_NONE_old); - } -} - -/* Setup the timimg registers for nvbits or normal flash */ -static void at91sam7_old_set_flash_mode(flash_bank_t *bank, u8 flashplane, int mode) -{ - u32 fmr, fmcn = 0, fws = 0; - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - target_t *target = bank->target; - - if (mode && (mode != at91sam7_old_info->flashmode[flashplane])) - { - /* Always round up (ceil) */ - if (mode==FMR_TIMING_NVBITS_old) - { - if (at91sam7_old_info->cidr_arch == 0x60) - { - /* AT91SAM7A3 uses master clocks in 100 ns */ - fmcn = (at91sam7_old_info->mck_freq/10000000ul)+1; - } - else - { - /* master clocks in 1uS for ARCH 0x7 types */ - fmcn = (at91sam7_old_info->mck_freq/1000000ul)+1; - } - } - else if (mode==FMR_TIMING_FLASH_old) - /* main clocks in 1.5uS */ - fmcn = (at91sam7_old_info->mck_freq/666666ul)+1; - - /* Only allow fmcn=0 if clock period is > 30 us = 33kHz. */ - if (at91sam7_old_info->mck_freq <= 33333ul) - fmcn = 0; - /* Only allow fws=0 if clock frequency is < 30 MHz. */ - if (at91sam7_old_info->mck_freq > 30000000ul) - fws = 1; - - LOG_DEBUG("fmcn[%i]: %i", flashplane, fmcn); - fmr = fmcn << 16 | fws << 8; - target_write_u32(target, MC_FMR_old[flashplane], fmr); - } - - at91sam7_old_info->flashmode[flashplane] = mode; -} - -static u32 at91sam7_old_wait_status_busy(flash_bank_t *bank, u8 flashplane, u32 waitbits, int timeout) -{ - u32 status; - - while ((!((status = at91sam7_old_get_flash_status(bank,flashplane)) & waitbits)) && (timeout-- > 0)) - { - LOG_DEBUG("status[%i]: 0x%x", flashplane, status); - alive_sleep(1); - } - - LOG_DEBUG("status[%i]: 0x%x", flashplane, status); - - if (status & 0x0C) - { - LOG_ERROR("status register: 0x%x", status); - if (status & 0x4) - LOG_ERROR("Lock Error Bit Detected, Operation Abort"); - if (status & 0x8) - LOG_ERROR("Invalid command and/or bad keyword, Operation Abort"); - if (status & 0x10) - LOG_ERROR("Security Bit Set, Operation Abort"); - } - - return status; -} - - -/* Send one command to the AT91SAM flash controller */ -static int at91sam7_old_flash_command(struct flash_bank_s *bank, u8 flashplane, u8 cmd, u16 pagen) -{ - u32 fcr; - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - target_t *target = bank->target; - - fcr = (0x5A<<24) | ((pagen&0x3FF)<<8) | cmd; - target_write_u32(target, MC_FCR_old[flashplane], fcr); - LOG_DEBUG("Flash command: 0x%x, flashplane: %i, pagenumber:%u", fcr, flashplane, pagen); - - if ((at91sam7_old_info->cidr_arch == 0x60)&&((cmd==SLB_old)|(cmd==CLB_old))) - { - /* Lock bit manipulation on AT91SAM7A3 waits for FC_FSR bit 1, EOL */ - if (at91sam7_old_wait_status_busy(bank, flashplane, MC_FSR_EOL_old, 10)&0x0C) - { - return ERROR_FLASH_OPERATION_FAILED; - } - return ERROR_OK; - } - - if (at91sam7_old_wait_status_busy(bank, flashplane, MC_FSR_FRDY_old, 10)&0x0C) - { - return ERROR_FLASH_OPERATION_FAILED; - } - return ERROR_OK; -} - -/* Read device id register, main clock frequency register and fill in driver info structure */ -static int at91sam7_old_read_part_info(struct flash_bank_s *bank) -{ - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - target_t *target = bank->target; - u32 cidr, status; - int sectornum; - - if (at91sam7_old_info->cidr != 0) - return ERROR_OK; /* already probed, multiple probes may cause memory leak, not allowed */ - - /* Read and parse chip identification register */ - target_read_u32(target, DBGU_CIDR_old, &cidr); - - if (cidr == 0) - { - LOG_WARNING("Cannot identify target as an AT91SAM"); - return ERROR_FLASH_OPERATION_FAILED; - } - - at91sam7_old_info->cidr = cidr; - at91sam7_old_info->cidr_ext = (cidr>>31)&0x0001; - at91sam7_old_info->cidr_nvptyp = (cidr>>28)&0x0007; - at91sam7_old_info->cidr_arch = (cidr>>20)&0x00FF; - at91sam7_old_info->cidr_sramsiz = (cidr>>16)&0x000F; - at91sam7_old_info->cidr_nvpsiz2 = (cidr>>12)&0x000F; - at91sam7_old_info->cidr_nvpsiz = (cidr>>8)&0x000F; - at91sam7_old_info->cidr_eproc = (cidr>>5)&0x0007; - at91sam7_old_info->cidr_version = cidr&0x001F; - bank->size = NVPSIZ_old[at91sam7_old_info->cidr_nvpsiz]; - at91sam7_old_info->target_name = "Unknown"; - - /* Support just for bulk erase of a single flash plane, whole device if flash size <= 256k */ - if (NVPSIZ_old[at91sam7_old_info->cidr_nvpsiz]<0x80000) /* Flash size less than 512K, one flash plane */ - { - bank->num_sectors = 1; - bank->sectors = malloc(sizeof(flash_sector_t)); - bank->sectors[0].offset = 0; - bank->sectors[0].size = bank->size; - bank->sectors[0].is_erased = -1; - bank->sectors[0].is_protected = -1; - } - else /* Flash size 512K or larger, several flash planes */ - { - bank->num_sectors = NVPSIZ_old[at91sam7_old_info->cidr_nvpsiz]/0x40000; - bank->sectors = malloc(bank->num_sectors*sizeof(flash_sector_t)); - for (sectornum=0; sectornum<bank->num_sectors; sectornum++) - { - bank->sectors[sectornum].offset = sectornum*0x40000; - bank->sectors[sectornum].size = 0x40000; - bank->sectors[sectornum].is_erased = -1; - bank->sectors[sectornum].is_protected = -1; - } - } - - - - LOG_DEBUG("nvptyp: 0x%3.3x, arch: 0x%4.4x", at91sam7_old_info->cidr_nvptyp, at91sam7_old_info->cidr_arch ); - - /* Read main and master clock freqency register */ - at91sam7_old_read_clock_info(bank); - - at91sam7_old_info->num_planes = 1; - status = at91sam7_old_get_flash_status(bank, 0); - at91sam7_old_info->securitybit = (status>>4)&0x01; - at91sam7_old_protect_check(bank); /* TODO Check the protect check */ - - if (at91sam7_old_info->cidr_arch == 0x70 ) - { - at91sam7_old_info->num_nvmbits = 2; - at91sam7_old_info->nvmbits = (status>>8)&0x03; - bank->base = 0x100000; - bank->bus_width = 4; - if (bank->size==0x80000) /* AT91SAM7S512 */ - { - at91sam7_old_info->target_name = "AT91SAM7S512"; - at91sam7_old_info->num_planes = 2; - if (at91sam7_old_info->num_planes != bank->num_sectors) - LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");; - at91sam7_old_info->num_lockbits = 2*16; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 2*16*64; - } - if (bank->size==0x40000) /* AT91SAM7S256 */ - { - at91sam7_old_info->target_name = "AT91SAM7S256"; - at91sam7_old_info->num_lockbits = 16; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 16*64; - } - if (bank->size==0x20000) /* AT91SAM7S128 */ - { - at91sam7_old_info->target_name = "AT91SAM7S128"; - at91sam7_old_info->num_lockbits = 8; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 8*64; - } - if (bank->size==0x10000) /* AT91SAM7S64 */ - { - at91sam7_old_info->target_name = "AT91SAM7S64"; - at91sam7_old_info->num_lockbits = 16; - at91sam7_old_info->pagesize = 128; - at91sam7_old_info->pages_in_lockregion = 32; - at91sam7_old_info->num_pages = 16*32; - } - if (bank->size==0x08000) /* AT91SAM7S321/32 */ - { - at91sam7_old_info->target_name = "AT91SAM7S321/32"; - at91sam7_old_info->num_lockbits = 8; - at91sam7_old_info->pagesize = 128; - at91sam7_old_info->pages_in_lockregion = 32; - at91sam7_old_info->num_pages = 8*32; - } - - return ERROR_OK; - } - - if (at91sam7_old_info->cidr_arch == 0x71 ) - { - at91sam7_old_info->num_nvmbits = 3; - at91sam7_old_info->nvmbits = (status>>8)&0x07; - bank->base = 0x100000; - bank->bus_width = 4; - if (bank->size==0x80000) /* AT91SAM7XC512 */ - { - at91sam7_old_info->target_name = "AT91SAM7XC512"; - at91sam7_old_info->num_planes = 2; - if (at91sam7_old_info->num_planes != bank->num_sectors) - LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");; - at91sam7_old_info->num_lockbits = 2*16; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 2*16*64; - } - if (bank->size==0x40000) /* AT91SAM7XC256 */ - { - at91sam7_old_info->target_name = "AT91SAM7XC256"; - at91sam7_old_info->num_lockbits = 16; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 16*64; - } - if (bank->size==0x20000) /* AT91SAM7XC128 */ - { - at91sam7_old_info->target_name = "AT91SAM7XC128"; - at91sam7_old_info->num_lockbits = 8; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 8*64; - } - - return ERROR_OK; - } - - if (at91sam7_old_info->cidr_arch == 0x72 ) - { - at91sam7_old_info->num_nvmbits = 3; - at91sam7_old_info->nvmbits = (status>>8)&0x07; - bank->base = 0x100000; - bank->bus_width = 4; - if (bank->size==0x80000) /* AT91SAM7SE512 */ - { - at91sam7_old_info->target_name = "AT91SAM7SE512"; - at91sam7_old_info->num_planes = 2; - if (at91sam7_old_info->num_planes != bank->num_sectors) - LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");; - at91sam7_old_info->num_lockbits = 32; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 32*64; - } - if (bank->size==0x40000) - { - at91sam7_old_info->target_name = "AT91SAM7SE256"; - at91sam7_old_info->num_lockbits = 16; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 16*64; - } - if (bank->size==0x08000) - { - at91sam7_old_info->target_name = "AT91SAM7SE32"; - at91sam7_old_info->num_lockbits = 8; - at91sam7_old_info->pagesize = 128; - at91sam7_old_info->pages_in_lockregion = 32; - at91sam7_old_info->num_pages = 8*32; - } - - return ERROR_OK; - } - - if (at91sam7_old_info->cidr_arch == 0x75 ) - { - at91sam7_old_info->num_nvmbits = 3; - at91sam7_old_info->nvmbits = (status>>8)&0x07; - bank->base = 0x100000; - bank->bus_width = 4; - if (bank->size==0x80000) /* AT91SAM7X512 */ - { - at91sam7_old_info->target_name = "AT91SAM7X512"; - at91sam7_old_info->num_planes = 2; - if (at91sam7_old_info->num_planes != bank->num_sectors) - LOG_WARNING("Internal error: Number of flash planes and erase sectors does not match, please report");; - at91sam7_old_info->num_lockbits = 32; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 2*16*64; - LOG_DEBUG("Support for AT91SAM7X512 is experimental in this version!"); - } - if (bank->size==0x40000) /* AT91SAM7X256 */ - { - at91sam7_old_info->target_name = "AT91SAM7X256"; - at91sam7_old_info->num_lockbits = 16; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 16*64; - } - if (bank->size==0x20000) /* AT91SAM7X128 */ - { - at91sam7_old_info->target_name = "AT91SAM7X128"; - at91sam7_old_info->num_lockbits = 8; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 64; - at91sam7_old_info->num_pages = 8*64; - } - - return ERROR_OK; - } - - if (at91sam7_old_info->cidr_arch == 0x60 ) - { - at91sam7_old_info->num_nvmbits = 3; - at91sam7_old_info->nvmbits = (status>>8)&0x07; - bank->base = 0x100000; - bank->bus_width = 4; - - if (bank->size == 0x40000) /* AT91SAM7A3 */ - { - at91sam7_old_info->target_name = "AT91SAM7A3"; - at91sam7_old_info->num_lockbits = 16; - at91sam7_old_info->pagesize = 256; - at91sam7_old_info->pages_in_lockregion = 16; - at91sam7_old_info->num_pages = 16*64; - } - return ERROR_OK; - } - - LOG_WARNING("at91sam7_old flash only tested for AT91SAM7Sxx series"); - return ERROR_OK; -} - -int at91sam7_old_erase_check(struct flash_bank_s *bank) -{ - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - - if (!at91sam7_old_info->working_area_size) - { - } - else - { - } - - return ERROR_OK; -} - -static int at91sam7_old_protect_check(struct flash_bank_s *bank) -{ - u32 status; - int flashplane; - - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - - if (at91sam7_old_info->cidr == 0) - { - return ERROR_FLASH_BANK_NOT_PROBED; - } - - if (bank->target->state != TARGET_HALTED) - { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - for (flashplane=0;flashplane<at91sam7_old_info->num_planes;flashplane++) - { - status = at91sam7_old_get_flash_status(bank, flashplane); - at91sam7_old_info->lockbits[flashplane] = (status >> 16); - } - - return ERROR_OK; -} - -/* flash_bank at91sam7_old 0 0 0 0 <target#> - */ -int at91sam7_old_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) -{ - at91sam7_old_flash_bank_t *at91sam7_old_info; - int i; - - if (argc < 6) - { - LOG_WARNING("incomplete flash_bank at91sam7_old configuration"); - return ERROR_FLASH_BANK_INVALID; - } - - at91sam7_old_info = malloc(sizeof(at91sam7_old_flash_bank_t)); - bank->driver_priv = at91sam7_old_info; - - /* part wasn't probed for info yet */ - at91sam7_old_info->cidr = 0; - for (i=0;i<4;i++) - at91sam7_old_info->flashmode[i]=0; - - return ERROR_OK; -} - -static int at91sam7_old_erase(struct flash_bank_s *bank, int first, int last) -{ - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - u8 flashplane; - - if (at91sam7_old_info->cidr == 0) - { - return ERROR_FLASH_BANK_NOT_PROBED; - } - - if (bank->target->state != TARGET_HALTED) - { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - if ((first < 0) || (last < first) || (last >= bank->num_sectors)) - { - if ((first == 0) && (last == (at91sam7_old_info->num_lockbits-1))) - { - LOG_WARNING("Sector numbers based on lockbit count, probably a deprecated script"); - last = bank->num_sectors-1; - } - else return ERROR_FLASH_SECTOR_INVALID; - } - - /* Configure the flash controller timing */ - at91sam7_old_read_clock_info(bank); - for (flashplane = first; flashplane<=last; flashplane++) - { - /* Configure the flash controller timing */ - at91sam7_old_set_flash_mode(bank, flashplane, FMR_TIMING_FLASH_old); - if (at91sam7_old_flash_command(bank, flashplane, EA_old, 0) != ERROR_OK) - { - return ERROR_FLASH_OPERATION_FAILED; - } - } - return ERROR_OK; - -} - -int at91sam7_old_protect(struct flash_bank_s *bank, int set, int first, int last) -{ - u32 cmd, pagen; - u8 flashplane; - int lockregion; - - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - - if (at91sam7_old_info->cidr == 0) - { - return ERROR_FLASH_BANK_NOT_PROBED; - } - - if (bank->target->state != TARGET_HALTED) - { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - if ((first < 0) || (last < first) || (last >= at91sam7_old_info->num_lockbits)) - { - return ERROR_FLASH_SECTOR_INVALID; - } - - at91sam7_old_read_clock_info(bank); - - for (lockregion=first;lockregion<=last;lockregion++) - { - pagen = lockregion*at91sam7_old_info->pages_in_lockregion; - flashplane = (pagen>>10)&0x03; - /* Configure the flash controller timing */ - at91sam7_old_set_flash_mode(bank, flashplane, FMR_TIMING_NVBITS_old); - - if (set) - cmd = SLB_old; - else - cmd = CLB_old; - - if (at91sam7_old_flash_command(bank, flashplane, cmd, pagen) != ERROR_OK) - { - return ERROR_FLASH_OPERATION_FAILED; - } - } - - at91sam7_old_protect_check(bank); - - return ERROR_OK; -} - - -static int at91sam7_old_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count) -{ - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - target_t *target = bank->target; - u32 dst_min_alignment, wcount, bytes_remaining = count; - u32 first_page, last_page, pagen, buffer_pos; - u8 flashplane; - - if (at91sam7_old_info->cidr == 0) - { - return ERROR_FLASH_BANK_NOT_PROBED; - } - - if (bank->target->state != TARGET_HALTED) - { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - if (offset + count > bank->size) - return ERROR_FLASH_DST_OUT_OF_BANK; - - dst_min_alignment = at91sam7_old_info->pagesize; - - if (offset % dst_min_alignment) - { - LOG_WARNING("offset 0x%x breaks required alignment 0x%x", offset, dst_min_alignment); - return ERROR_FLASH_DST_BREAKS_ALIGNMENT; - } - - if (at91sam7_old_info->cidr_arch == 0) - return ERROR_FLASH_BANK_NOT_PROBED; - - first_page = offset/dst_min_alignment; - last_page = CEIL(offset + count, dst_min_alignment); - - LOG_DEBUG("first_page: %i, last_page: %i, count %i", first_page, last_page, count); - - at91sam7_old_read_clock_info(bank); - - for (pagen=first_page; pagen<last_page; pagen++) - { - if (bytes_remaining<dst_min_alignment) - count = bytes_remaining; - else - count = dst_min_alignment; - bytes_remaining -= count; - - /* Write one block to the PageWriteBuffer */ - buffer_pos = (pagen-first_page)*dst_min_alignment; - wcount = CEIL(count,4); - target->type->write_memory(target, bank->base+pagen*dst_min_alignment, 4, wcount, buffer+buffer_pos); - flashplane = (pagen>>10)&0x3; - - /* Configure the flash controller timing */ - at91sam7_old_set_flash_mode(bank, flashplane, FMR_TIMING_FLASH_old); - /* Send Write Page command to Flash Controller */ - if (at91sam7_old_flash_command(bank, flashplane, WP_old, pagen) != ERROR_OK) - { - return ERROR_FLASH_OPERATION_FAILED; - } - LOG_DEBUG("Write flash plane:%i page number:%i", flashplane, pagen); - } - - return ERROR_OK; -} - - -static int at91sam7_old_probe(struct flash_bank_s *bank) -{ - /* we can't probe on an at91sam7_old - * if this is an at91sam7_old, it has the configured flash - */ - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - int retval; - - if (at91sam7_old_info->cidr != 0) - { - return ERROR_OK; /* already probed */ - } - - if (bank->target->state != TARGET_HALTED) - { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - retval = at91sam7_old_read_part_info(bank); - if (retval != ERROR_OK) - return retval; - - return ERROR_OK; -} - - -static int at91sam7_old_info(struct flash_bank_s *bank, char *buf, int buf_size) -{ - int printed, flashplane; - at91sam7_old_flash_bank_t *at91sam7_old_info = bank->driver_priv; - - if (at91sam7_old_info->cidr == 0) - { - return ERROR_FLASH_BANK_NOT_PROBED; - } - - printed = snprintf(buf, buf_size, "\nat91sam7_old information: Chip is %s\n",at91sam7_old_info->target_name); - buf += printed; - buf_size -= printed; - - printed = snprintf(buf, buf_size, "cidr: 0x%8.8x, arch: 0x%4.4x, eproc: %s, version:0x%3.3x, flashsize: 0x%8.8x\n", - at91sam7_old_info->cidr, at91sam7_old_info->cidr_arch, EPROC_old[at91sam7_old_info->cidr_eproc], at91sam7_old_info->cidr_version, bank->size); - buf += printed; - buf_size -= printed; - - printed = snprintf(buf, buf_size, "master clock(estimated): %ikHz \n", at91sam7_old_info->mck_freq / 1000); - buf += printed; - buf_size -= printed; - - if (at91sam7_old_info->num_planes>1) { - printed = snprintf(buf, buf_size, "flashplanes: %i, pagesize: %i, lock regions: %i, pages in lock region: %i \n", - at91sam7_old_info->num_planes, at91sam7_old_info->pagesize, at91sam7_old_info->num_lockbits, at91sam7_old_info->num_pages/at91sam7_old_info->num_lockbits); - buf += printed; - buf_size -= printed; - for (flashplane=0; flashplane<at91sam7_old_info->num_planes; flashplane++) - { - printed = snprintf(buf, buf_size, "lockbits[%i]: 0x%4.4x, ", flashplane, at91sam7_old_info->lockbits[flashplane]); - buf += printed; - buf_size -= printed; - } - } - else - if (at91sam7_old_info->num_lockbits>0) { - printed = snprintf(buf, buf_size, "pagesize: %i, lockbits: %i 0x%4.4x, pages in lock region: %i \n", - at91sam7_old_info->pagesize, at91sam7_old_info->num_lockbits, at91sam7_old_info->lockbits[0], at91sam7_old_info->num_pages/at91sam7_old_info->num_lockbits); - buf += printed; - buf_size -= printed; - } - - printed = snprintf(buf, buf_size, "securitybit: %i, nvmbits(%i): 0x%1.1x\n", at91sam7_old_info->securitybit, at91sam7_old_info->num_nvmbits, at91sam7_old_info->nvmbits); - buf += printed; - buf_size -= printed; - - return ERROR_OK; -} - -/* -* On AT91SAM7S: When the gpnvm bits are set with -* > at91sam7_old gpnvm 0 bitnr set -* the changes are not visible in the flash controller status register MC_FSR_old -* until the processor has been reset. -* On the Olimex board this requires a power cycle. -* Note that the AT91SAM7S has the following errata (doc6175.pdf sec 14.1.3): -* The maximum number of write/erase cycles for Non Volatile Memory bits is 100. This includes -* Lock Bits (LOCKx), General Purpose NVM bits (GPNVMx) and the Security Bit. -*/ -static int at91sam7_old_handle_gpnvm_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) -{ - flash_bank_t *bank; - int bit; - u8 flashcmd; - u32 status; - char *value; - at91sam7_old_flash_bank_t *at91sam7_old_info; - int retval; - - if (argc < 3) - { - command_print(cmd_ctx, "at91sam7_old gpnvm <num> <bit> <set|clear>"); - return ERROR_OK; - } - - bank = get_flash_bank_by_num_noprobe(strtoul(args[0], NULL, 0)); - bit = atoi(args[1]); - value = args[2]; - - if (bank == NULL) - { - return ERROR_FLASH_BANK_INVALID; - } - - if (bank->driver != &at91sam7_old_flash) - { - command_print(cmd_ctx, "not an at91sam7_old flash bank '%s'", args[0]); - return ERROR_FLASH_BANK_INVALID; - } - - if (strcmp(value, "set") == 0) - { - flashcmd = SGPB_old; - } - else if (strcmp(value, "clear") == 0) - { - flashcmd = CGPB_old; - } - else - { - return ERROR_COMMAND_SYNTAX_ERROR; - } - - at91sam7_old_info = bank->driver_priv; - - if (bank->target->state != TARGET_HALTED) - { - LOG_ERROR("target has to be halted to perform flash operation"); - return ERROR_TARGET_NOT_HALTED; - } - - if (at91sam7_old_info->cidr == 0) - { - retval = at91sam7_old_read_part_info(bank); - if (retval != ERROR_OK) { - return retval; - } - } - - if ((bit<0) || (at91sam7_old_info->num_nvmbits <= bit)) - { - command_print(cmd_ctx, "gpnvm bit '#%s' is out of bounds for target %s", args[1],at91sam7_old_info->target_name); - return ERROR_OK; - } - - /* Configure the flash controller timing */ - at91sam7_old_read_clock_info(bank); - at91sam7_old_set_flash_mode(bank, 0, FMR_TIMING_NVBITS_old); - - if (at91sam7_old_flash_command(bank, 0, flashcmd, (u16)(bit)) != ERROR_OK) - { - return ERROR_FLASH_OPERATION_FAILED; - } - - status = at91sam7_old_get_flash_status(bank, 0); - LOG_DEBUG("at91sam7_handle_gpnvm_command: cmd 0x%x, value 0x%x, status 0x%x \n",flashcmd,bit,status); - at91sam7_old_info->nvmbits = (status>>8)&((1<<at91sam7_old_info->num_nvmbits)-1); - - return ERROR_OK; -} Deleted: trunk/src/flash/at91sam7_old.h =================================================================== --- trunk/src/flash/at91sam7_old.h 2009-05-07 06:51:27 UTC (rev 1631) +++ trunk/src/flash/at91sam7_old.h 2009-05-07 06:58:52 UTC (rev 1632) @@ -1,98 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006 by Magnus Lundin * - * lu...@ml... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef AT91SAM7_OLD_H -#define AT91SAM7_OLD_H - -#include "flash.h" -#include "target.h" - -typedef struct at91sam7_old_flash_bank_s -{ - u32 working_area; - u32 working_area_size; - - /* chip id register */ - u32 cidr; - u16 cidr_ext; - u16 cidr_nvptyp; - u16 cidr_arch; - u16 cidr_sramsiz; - u16 cidr_nvpsiz; - u16 cidr_nvpsiz2; - u16 cidr_eproc; - u16 cidr_version; - char * target_name; - - /* flash geometry */ - u16 num_pages; - u16 pagesize; - u16 pages_in_lockregion; - u8 num_erase_regions; - u8 num_planes; - u32 *erase_region_info; - - /* nv memory bits */ - u16 num_lockbits; - u16 lockbits[4]; - u16 num_nvmbits; - u16 nvmbits; - u8 securitybit; - u8 flashmode[4]; /* 0: not init, 1: fmcn for nvbits (1uS), 2: fmcn for flash (1.5uS) */ - - /* main clock status */ - u8 mck_valid; - u32 mck_freq; - -} at91sam7_old_flash_bank_t; - -/* AT91SAM7 control registers */ -#define DBGU_CIDR_old 0xFFFFF240 -#define CKGR_MCFR_old 0xFFFFFC24 -#define CKGR_MCFR_MAINRDY_old 0x10000 -#define CKGR_PLLR_old 0xFFFFFC2c -#define CKGR_PLLR_DIV_old 0xff -#define CKGR_PLLR_MUL_old 0x07ff0000 -#define PMC_MCKR_old 0xFFFFFC30 -#define PMC_MCKR_CSS_old 0x03 -#define PMC_MCKR_PRES_old 0x1c - -/* Flash Controller Commands */ -#define WP_old 0x01 -#define SLB_old 0x02 -#define WPL_old 0x03 -#define CLB_old 0x04 -#define EA_old 0x08 -#define SGPB_old 0x0B -#define CGPB_old 0x0D -#define SSB_old 0x0F - -/* MC_FSR bit definitions */ -#define MC_FSR_FRDY_old 1 -#define MC_FSR_EOL_old 2 - -/* AT91SAM7 constants */ -#define RC_FREQ_old 32000 - -/* FLASH_TIMING_MODES */ -#define FMR_TIMING_NONE_old 0 -#define FMR_TIMING_NVBITS_old 1 -#define FMR_TIMING_FLASH_old 2 - -#endif /* AT91SAM7_OLD_H */ Modified: trunk/src/flash/flash.c =================================================================== --- trunk/src/flash/flash.c 2009-05-07 06:51:27 UTC (rev 1631) +++ trunk/src/flash/flash.c 2009-05-07 06:58:52 UTC (rev 1632) @@ -65,7 +65,6 @@ extern flash_driver_t lpc2000_flash; extern flash_driver_t cfi_flash; extern flash_driver_t at91sam7_flash; -extern flash_driver_t at91sam7_old_flash; extern flash_driver_t str7x_flash; extern flash_driver_t str9x_flash; extern flash_driver_t aduc702x_flash; @@ -83,7 +82,6 @@ &lpc2000_flash, &cfi_flash, &at91sam7_flash, - &at91sam7_old_flash, &str7x_flash, &str9x_flash, &aduc702x_flash, |
From: oharboe at B. <oh...@ma...> - 2009-05-07 08:51:27
|
Author: oharboe Date: 2009-05-07 08:51:27 +0200 (Thu, 07 May 2009) New Revision: 1631 Modified: trunk/src/target/arm7tdmi.c Log: slightly increase readability of code Modified: trunk/src/target/arm7tdmi.c =================================================================== --- trunk/src/target/arm7tdmi.c 2009-05-07 06:47:09 UTC (rev 1630) +++ trunk/src/target/arm7tdmi.c 2009-05-07 06:51:27 UTC (rev 1631) @@ -265,28 +265,29 @@ jtag_add_dr_scan_now(2, fields, TAP_INVALID); + u32 readback=flip_u32(le_to_h_u32(tmp), 32); switch (size) { case 4: if (be) { - h_u32_to_be(((u8*)in), flip_u32(le_to_h_u32(tmp), 32)); + h_u32_to_be(((u8*)in), readback); } else { - h_u32_to_le(((u8*)in), flip_u32(le_to_h_u32(tmp), 32)); + h_u32_to_le(((u8*)in), readback); } break; case 2: if (be) { - h_u16_to_be(((u8*)in), flip_u32(le_to_h_u32(tmp), 32) & 0xffff); + h_u16_to_be(((u8*)in), readback & 0xffff); } else { - h_u16_to_le(((u8*)in), flip_u32(le_to_h_u32(tmp), 32) & 0xffff); + h_u16_to_le(((u8*)in), readback & 0xffff); } break; case 1: - *((u8 *)in)= flip_u32(le_to_h_u32(tmp), 32) & 0xff; + *((u8 *)in)= readback & 0xff; break; } |
From: oharboe at B. <oh...@ma...> - 2009-05-07 08:47:10
|
Author: oharboe Date: 2009-05-07 08:47:09 +0200 (Thu, 07 May 2009) New Revision: 1630 Modified: trunk/src/target/arm7tdmi.c Log: another example of removing in_handler usage Modified: trunk/src/target/arm7tdmi.c =================================================================== --- trunk/src/target/arm7tdmi.c 2009-05-07 06:29:08 UTC (rev 1629) +++ trunk/src/target/arm7tdmi.c 2009-05-07 06:47:09 UTC (rev 1630) @@ -256,29 +256,40 @@ fields[0].in_value = NULL; fields[0].in_handler = NULL; - fields[1].tap = jtag_info->tap; fields[1].num_bits = 32; fields[1].out_value = NULL; - fields[1].in_value = NULL; + u8 tmp[4]; + fields[1].in_value = tmp; + fields[1].in_handler = NULL; + + jtag_add_dr_scan_now(2, fields, TAP_INVALID); + switch (size) { case 4: - fields[1].in_handler = (be) ? arm_jtag_buf_to_be32_flip : arm_jtag_buf_to_le32_flip; /* deprecated! invoke this from user code! */ + if (be) + { + h_u32_to_be(((u8*)in), flip_u32(le_to_h_u32(tmp), 32)); + } else + { + h_u32_to_le(((u8*)in), flip_u32(le_to_h_u32(tmp), 32)); + } break; case 2: - fields[1].in_handler = (be) ? arm_jtag_buf_to_be16_flip : arm_jtag_buf_to_le16_flip; /* deprecated! invoke this from user code! */ + if (be) + { + h_u16_to_be(((u8*)in), flip_u32(le_to_h_u32(tmp), 32) & 0xffff); + } else + { + h_u16_to_le(((u8*)in), flip_u32(le_to_h_u32(tmp), 32) & 0xffff); + } break; case 1: - fields[1].in_handler = arm_jtag_buf_to_8_flip; /* deprecated! invoke this from user code! */ + *((u8 *)in)= flip_u32(le_to_h_u32(tmp), 32) & 0xff; break; } - fields[1].in_handler_priv = in; - - - jtag_add_dr_scan(2, fields, TAP_INVALID); - jtag_add_runtest(0, TAP_INVALID); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ |
From: oharboe at B. <oh...@ma...> - 2009-05-07 08:29:10
|
Author: oharboe Date: 2009-05-07 08:29:08 +0200 (Thu, 07 May 2009) New Revision: 1629 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h trunk/src/jtag/zy1000.c trunk/src/target/arm7tdmi.c Log: added template for removing in_handler Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-07 01:26:56 UTC (rev 1628) +++ trunk/src/jtag/jtag.c 2009-05-07 06:29:08 UTC (rev 1629) @@ -42,6 +42,8 @@ #include <strings.h> #endif +static void jtag_execute_queue_noclear(void); + /* note that this is not marked as static as it must be available from outside jtag.c for those that implement the jtag_xxx() minidriver layer */ @@ -670,6 +672,12 @@ jtag_error=retval; } +void jtag_add_dr_scan_now(int num_fields, scan_field_t *fields, tap_state_t state) +{ + jtag_add_dr_scan(num_fields, fields, state); + jtag_execute_queue_noclear(); +} + int MINIDRIVER(interface_jtag_add_dr_scan)(int num_fields, scan_field_t *fields, tap_state_t state) { int j; @@ -1438,13 +1446,21 @@ return retval; } -int jtag_execute_queue(void) +static void jtag_execute_queue_noclear(void) { int retval=interface_jtag_execute_queue(); - if (retval==ERROR_OK) + /* we keep the first error */ + if ((jtag_error==ERROR_OK)&&(retval!=ERROR_OK)) { - retval=jtag_error; + jtag_error=retval; } +} + +int jtag_execute_queue(void) +{ + int retval; + jtag_execute_queue_noclear(); + retval=jtag_error; jtag_error=ERROR_OK; return retval; } @@ -1485,10 +1501,10 @@ field.tap = NULL; field.num_bits = sizeof(idcode_buffer) * 8; field.out_value = idcode_buffer; - + field.in_value = idcode_buffer; - - + + field.in_handler = NULL; for (i = 0; i < JTAG_MAX_CHAIN_SIZE; i++) @@ -1662,10 +1678,7 @@ field.tap = NULL; field.num_bits = total_ir_length; field.out_value = ir_test; - field.in_value = ir_test; - - field.in_handler = NULL; jtag_add_plain_ir_scan(1, &field, TAP_RESET); Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-05-07 01:26:56 UTC (rev 1628) +++ trunk/src/jtag/jtag.h 2009-05-07 06:29:08 UTC (rev 1629) @@ -561,6 +561,10 @@ extern void jtag_add_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); extern int interface_jtag_add_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); extern void jtag_add_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); +/* same as jtag_add_dr_scan but the scan is executed immediately. sets jtag_error if there + * was a failure. + */ +extern void jtag_add_dr_scan_now(int num_fields, scan_field_t* fields, tap_state_t endstate); extern int interface_jtag_add_dr_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); extern void jtag_add_plain_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); extern int interface_jtag_add_plain_ir_scan(int num_fields, scan_field_t* fields, tap_state_t endstate); @@ -696,6 +700,16 @@ */ extern int jtag_execute_queue(void); +/* this flag is set when an error occurs while executing the queue. cleared + * by jtag_execute_queue() + * + * this flag can also be set from application code if some error happens + * during processing that should be reported during jtag_execute_queue(). + */ +extern int jtag_error; + + + /* can be implemented by hw+sw */ extern int interface_jtag_execute_queue(void); extern int jtag_power_dropout(int* dropout); Modified: trunk/src/jtag/zy1000.c =================================================================== --- trunk/src/jtag/zy1000.c 2009-05-07 01:26:56 UTC (rev 1628) +++ trunk/src/jtag/zy1000.c 2009-05-07 06:29:08 UTC (rev 1629) @@ -39,8 +39,6 @@ #define ZYLIN_OPENOCD_VERSION "Zylin JTAG ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE " " ZYLIN_TIME const char *zylin_config_dir="/config/settings"; -extern int jtag_error; - /* low level command set */ int zy1000_read(void); Modified: trunk/src/target/arm7tdmi.c =================================================================== --- trunk/src/target/arm7tdmi.c 2009-05-07 01:26:56 UTC (rev 1628) +++ trunk/src/target/arm7tdmi.c 2009-05-07 06:29:08 UTC (rev 1629) @@ -5,6 +5,9 @@ * Copyright (C) 2008 by Spencer Oliver * * sp...@sp... * * * + * Copyright (C) 2007,2008 vind Harboe * + * oyv...@zy... * + * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * @@ -111,22 +114,14 @@ fields[0].tap = arm7_9->jtag_info.tap; fields[0].num_bits = 1; fields[0].out_value = NULL; - fields[0].in_value = &breakpoint; - - fields[0].in_handler = NULL; - fields[1].tap = arm7_9->jtag_info.tap; fields[1].num_bits = 32; fields[1].out_value = NULL; - fields[1].in_value = databus; - - fields[1].in_handler = NULL; - if((retval = arm_jtag_scann(&arm7_9->jtag_info, 0x1)) != ERROR_OK) { @@ -198,25 +193,24 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 1; fields[0].out_value = NULL; - fields[0].in_value = NULL; - - fields[0].in_handler = NULL; - + fields[1].tap = jtag_info->tap; fields[1].num_bits = 32; fields[1].out_value = NULL; - - fields[1].in_value = NULL; - fields[1].in_handler = arm_jtag_buf_to_u32_flip; /* deprecated! invoke this from user code! */ - fields[1].in_handler_priv = in; - - + u8 tmp[4]; + fields[1].in_value = tmp; + fields[1].in_handler = NULL; - jtag_add_dr_scan(2, fields, TAP_INVALID); + jtag_add_dr_scan_now(2, fields, TAP_INVALID); + if (jtag_error==ERROR_OK) + { + *in=flip_u32(le_to_h_u32(tmp), 32); + } + jtag_add_runtest(0, TAP_INVALID); #ifdef _DEBUG_INSTRUCTION_EXECUTION_ @@ -259,17 +253,13 @@ fields[0].tap = jtag_info->tap; fields[0].num_bits = 1; fields[0].out_value = NULL; - fields[0].in_value = NULL; - - fields[0].in_handler = NULL; - + fields[1].tap = jtag_info->tap; fields[1].num_bits = 32; fields[1].out_value = NULL; - fields[1].in_value = NULL; switch (size) { @@ -284,9 +274,9 @@ break; } fields[1].in_handler_priv = in; - - + + jtag_add_dr_scan(2, fields, TAP_INVALID); jtag_add_runtest(0, TAP_INVALID); |
From: <zw...@ma...> - 2009-05-07 03:27:04
|
Author: zwelch Date: 2009-05-07 03:26:56 +0200 (Thu, 07 May 2009) New Revision: 1628 Modified: trunk/src/target/arm11.c Log: Fix most pointer cast alignment warnings in arm11.c; fix u16 memory reads.. Modified: trunk/src/target/arm11.c =================================================================== --- trunk/src/target/arm11.c 2009-05-07 00:58:38 UTC (rev 1627) +++ trunk/src/target/arm11.c 2009-05-07 01:26:56 UTC (rev 1628) @@ -1144,10 +1144,7 @@ { arm11->reg_list[ARM11_RC_R1].dirty = 1; - u16 * buf16 = (u16*)buffer; - - {size_t i; - for (i = 0; i < count; i++) + for (size_t i = 0; i < count; i++) { /* ldrh r1, [r0], #2 */ arm11_run_instr_no_data1(arm11, @@ -1158,20 +1155,24 @@ /* MCR p14,0,R1,c0,c5,0 */ arm11_run_instr_data_from_core(arm11, 0xEE001E15, &res, 1); - *buf16++ = res; - }} + u16 svalue = res; + memcpy(buffer + count * sizeof(u16), &svalue, sizeof(u16)); + } break; } case 4: + { + u32 instr = !arm11_config_memrw_no_increment ? 0xecb05e01 : 0xed905e00; + /** \todo TODO: buffer cast to u32* causes alignment warnings */ + u32 *words = (u32 *)buffer; /* LDC p14,c5,[R0],#4 */ /* LDC p14,c5,[R0] */ - arm11_run_instr_data_from_core(arm11, - (!arm11_config_memrw_no_increment ? 0xecb05e01 : 0xed905e00), - (u32 *)buffer, count); + arm11_run_instr_data_from_core(arm11, instr, words, count); break; + } } arm11_run_instr_data_finish(arm11); @@ -1223,45 +1224,45 @@ { arm11->reg_list[ARM11_RC_R1].dirty = 1; - u16 * buf16 = (u16*)buffer; + for (size_t i = 0; i < count; i++) + { + u16 value; + memcpy(&value, buffer + count * sizeof(u16), sizeof(u16)); - {size_t i; - for (i = 0; i < count; i++) - { /* MRC p14,0,r1,c0,c5,0 */ - arm11_run_instr_data_to_core1(arm11, 0xee101e15, *buf16++); + arm11_run_instr_data_to_core1(arm11, 0xee101e15, value); /* strh r1, [r0], #2 */ /* strh r1, [r0] */ arm11_run_instr_no_data1(arm11, !arm11_config_memrw_no_increment ? 0xe0c010b2 : 0xe1c010b0); - }} + } break; } - case 4: - /** \todo TODO: check if buffer cast to u32* might cause alignment problems */ + case 4: { + u32 instr = !arm11_config_memrw_no_increment ? 0xeca05e01 : 0xed805e00; + /** \todo TODO: buffer cast to u32* causes alignment warnings */ + u32 *words = (u32*)buffer; + if (!arm11_config_memwrite_burst) { /* STC p14,c5,[R0],#4 */ /* STC p14,c5,[R0]*/ - arm11_run_instr_data_to_core(arm11, - (!arm11_config_memrw_no_increment ? 0xeca05e01 : 0xed805e00), - (u32 *)buffer, count); + arm11_run_instr_data_to_core(arm11, instr, words, count); } else { /* STC p14,c5,[R0],#4 */ /* STC p14,c5,[R0]*/ - arm11_run_instr_data_to_core_noack(arm11, - (!arm11_config_memrw_no_increment ? 0xeca05e01 : 0xed805e00), - (u32 *)buffer, count); + arm11_run_instr_data_to_core_noack(arm11, instr, words, count); } break; } + } #if 1 /* r0 verification */ |
From: <zw...@ma...> - 2009-05-07 02:58:43
|
Author: zwelch Date: 2009-05-07 02:58:38 +0200 (Thu, 07 May 2009) New Revision: 1627 Modified: trunk/src/target/arm_adi_v5.c Log: Fix pointer cast alignment warnings in arm_adi_v5.c Modified: trunk/src/target/arm_adi_v5.c =================================================================== --- trunk/src/target/arm_adi_v5.c 2009-05-07 00:21:59 UTC (rev 1626) +++ trunk/src/target/arm_adi_v5.c 2009-05-07 00:58:38 UTC (rev 1627) @@ -45,6 +45,7 @@ #include "log.h" #include "time_support.h" #include <stdlib.h> +#include <string.h> /* * Transaction Mode: @@ -448,7 +449,6 @@ *****************************************************************************/ int mem_ap_write_buf_u32(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address) { - u32 outvalue; int wcount, blocksize, writecount, errorcount = 0, retval = ERROR_OK; u32 adr = address; u8* pBuffer = buffer; @@ -464,7 +464,8 @@ for (writecount = 0; writecount < count; writecount++) { int i; - outvalue = *((u32*)pBuffer); + u32 outvalue; + memcpy(&outvalue, pBuffer, sizeof(u32)); for (i = 0; i < 4; i++ ) { @@ -472,7 +473,7 @@ outvalue >>= 8; adr++; } - pBuffer += 4; + pBuffer += sizeof(u32); } } @@ -517,7 +518,6 @@ int mem_ap_write_buf_packed_u16(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address) { - u32 outvalue; int retval = ERROR_OK; int wcount, blocksize, writecount, i; @@ -558,7 +558,8 @@ } else { - outvalue = *((u32*)buffer); + u32 outvalue; + memcpy(&outvalue, buffer, sizeof(u32)); for (i = 0; i < nbytes; i++ ) { @@ -567,7 +568,7 @@ address++; } - outvalue = *((u32*)buffer); + memcpy(&outvalue, buffer, sizeof(u32)); dap_ap_write_reg_u32(swjdp, AP_REG_DRW, outvalue); if (swjdp_transaction_endcheck(swjdp) != ERROR_OK) { @@ -588,7 +589,6 @@ int mem_ap_write_buf_u16(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address) { - u32 outvalue; int retval = ERROR_OK; if (count >= 4) @@ -599,7 +599,9 @@ while (count > 0) { dap_setup_accessport(swjdp, CSW_16BIT | CSW_ADDRINC_SINGLE, address); - outvalue = *((u16*)buffer) << 8 * (address & 0x3); + u16 svalue; + memcpy(&svalue, buffer, sizeof(u16)); + u32 outvalue = (u32)svalue << 8 * (address & 0x3); dap_ap_write_reg_u32(swjdp, AP_REG_DRW, outvalue ); retval = swjdp_transaction_endcheck(swjdp); count -= 2; @@ -612,7 +614,6 @@ int mem_ap_write_buf_packed_u8(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address) { - u32 outvalue; int retval = ERROR_OK; int wcount, blocksize, writecount, i; @@ -649,7 +650,8 @@ } else { - outvalue = *((u32*)buffer); + u32 outvalue; + memcpy(&outvalue, buffer, sizeof(u32)); for (i = 0; i < nbytes; i++ ) { @@ -658,7 +660,7 @@ address++; } - outvalue = *((u32*)buffer); + memcpy(&outvalue, buffer, sizeof(u32)); dap_ap_write_reg_u32(swjdp, AP_REG_DRW, outvalue); if (swjdp_transaction_endcheck(swjdp) != ERROR_OK) { @@ -679,7 +681,6 @@ int mem_ap_write_buf_u8(swjdp_common_t *swjdp, u8 *buffer, int count, u32 address) { - u32 outvalue; int retval = ERROR_OK; if (count >= 4) @@ -690,7 +691,7 @@ while (count > 0) { dap_setup_accessport(swjdp, CSW_8BIT | CSW_ADDRINC_SINGLE, address); - outvalue = *((u8*)buffer) << 8 * (address & 0x3); + u32 outvalue = (u32)*buffer << 8 * (address & 0x3); dap_ap_write_reg_u32(swjdp, AP_REG_DRW, outvalue ); retval = swjdp_transaction_endcheck(swjdp); count--; @@ -766,7 +767,8 @@ for (readcount = 0; readcount < count; readcount++) { int i; - u32 data = *((u32*)pBuffer); + u32 data; + memcpy(&data, pBuffer, sizeof(u32)); for (i = 0; i < 4; i++ ) { @@ -858,7 +860,8 @@ } else { - *((u16*)buffer) = (invalue >> 8 * (address & 0x3)); + u16 svalue = (invalue >> 8 * (address & 0x3)); + memcpy(buffer, &svalue, sizeof(u16)); address += 2; buffer += 2; } |
From: <zw...@ma...> - 2009-05-07 02:22:25
|
Author: zwelch Date: 2009-05-07 02:21:59 +0200 (Thu, 07 May 2009) New Revision: 1626 Modified: trunk/src/flash/pic32mx.c trunk/src/flash/stm32x.c Log: Fix stm32x and pic32mx flash pointer cast alignment warnings, simplify their last word handling. Modified: trunk/src/flash/pic32mx.c =================================================================== --- trunk/src/flash/pic32mx.c 2009-05-06 23:31:50 UTC (rev 1625) +++ trunk/src/flash/pic32mx.c 2009-05-07 00:21:59 UTC (rev 1626) @@ -463,9 +463,10 @@ while(count > 0) { - u32 status; + u32 value; + memcpy(&value, buffer, sizeof(u32)); - status = pic32mx_write_word(bank, address, *(u32*)buffer); + u32 status = pic32mx_write_word(bank, address, value); if( status & NVMCON_NVMERR ) { LOG_ERROR("Flash write error NVMERR (status=0x%08x)", status); retval = ERROR_FLASH_OPERATION_FAILED; @@ -568,8 +569,10 @@ while (words_remaining > 0) { - status = pic32mx_write_word(bank, address, *(u32*)(buffer + bytes_written)); + u32 value; + memcpy(&value, buffer + bytes_written, sizeof(u32)); + status = pic32mx_write_word(bank, address, value); if( status & NVMCON_NVMERR ) return ERROR_FLASH_OPERATION_FAILED; if( status & NVMCON_LVDERR ) @@ -582,19 +585,10 @@ if (bytes_remaining) { - u8 last_word[4] = {0xff, 0xff, 0xff, 0xff}; - int i = 0; + u32 value = 0xffffffff; + memcpy(&value, buffer + bytes_written, bytes_remaining); - while(bytes_remaining > 0) - { - /* Assumes little endian */ - last_word[i++] = *(buffer + bytes_written); - bytes_remaining--; - bytes_written++; - } - - status = pic32mx_write_word(bank, address, *(u32*)last_word); - + status = pic32mx_write_word(bank, address, value); if( status & NVMCON_NVMERR ) return ERROR_FLASH_OPERATION_FAILED; if( status & NVMCON_LVDERR ) Modified: trunk/src/flash/stm32x.c =================================================================== --- trunk/src/flash/stm32x.c 2009-05-06 23:31:50 UTC (rev 1625) +++ trunk/src/flash/stm32x.c 2009-05-07 00:21:59 UTC (rev 1626) @@ -658,8 +658,11 @@ while (words_remaining > 0) { + u16 value; + memcpy(&value, buffer + bytes_written, sizeof(u16)); + target_write_u32(target, STM32_FLASH_CR, FLASH_PG); - target_write_u16(target, address, *(u16*)(buffer + bytes_written)); + target_write_u16(target, address, value); status = stm32x_wait_status_busy(bank, 5); @@ -681,18 +684,11 @@ if (bytes_remaining) { - u8 last_halfword[2] = {0xff, 0xff}; - int i = 0; - - while(bytes_remaining > 0) - { - last_halfword[i++] = *(buffer + bytes_written); - bytes_remaining--; - bytes_written++; - } - + u16 value = 0xffff; + memcpy(&value, buffer + bytes_written, bytes_remaining); + target_write_u32(target, STM32_FLASH_CR, FLASH_PG); - target_write_u16(target, address, *(u16*)last_halfword); + target_write_u16(target, address, value); status = stm32x_wait_status_busy(bank, 5); |
From: <zw...@ma...> - 2009-05-07 01:31:56
|
Author: zwelch Date: 2009-05-07 01:31:50 +0200 (Thu, 07 May 2009) New Revision: 1625 Modified: trunk/src/target/xscale.c Log: Fix pointer cast alignment warning in XScale miniIC loader parity calc. Modified: trunk/src/target/xscale.c =================================================================== --- trunk/src/target/xscale.c 2009-05-06 23:28:38 UTC (rev 1624) +++ trunk/src/target/xscale.c 2009-05-06 23:31:50 UTC (rev 1625) @@ -833,7 +833,11 @@ for (word = 0; word < 8; word++) { buf_set_u32(packet, 0, 32, buffer[word]); - cmd = parity(*((u32*)packet)); + + u32 value; + memcpy(&value, packet, sizeof(u32)); + cmd = parity(value); + jtag_add_dr_scan(2, fields, TAP_INVALID); } |
From: <zw...@ma...> - 2009-05-07 01:28:42
|
Author: zwelch Date: 2009-05-07 01:28:38 +0200 (Thu, 07 May 2009) New Revision: 1624 Modified: trunk/src/target/image.c Log: Fix pointer cast alignment warnings in target/image.c. Modified: trunk/src/target/image.c =================================================================== --- trunk/src/target/image.c 2009-05-06 23:25:27 UTC (rev 1623) +++ trunk/src/target/image.c 2009-05-06 23:28:38 UTC (rev 1624) @@ -217,7 +217,9 @@ while (count-- > 0) { - sscanf(&lpszLine[bytes_read], "%2x", (u32*)&ihex->buffer[cooked_bytes]); + unsigned value; + sscanf(&lpszLine[bytes_read], "%2x", &value); + ihex->buffer[cooked_bytes] = (u8)value; cal_checksum += (u8)ihex->buffer[cooked_bytes]; bytes_read += 2; cooked_bytes += 1; @@ -594,7 +596,9 @@ while (count-- > 0) { - sscanf(&lpszLine[bytes_read], "%2x", (u32*)&mot->buffer[cooked_bytes]); + unsigned value; + sscanf(&lpszLine[bytes_read], "%2x", &value); + mot->buffer[cooked_bytes] = (u8)value; cal_checksum += (u8)mot->buffer[cooked_bytes]; bytes_read += 2; cooked_bytes += 1; |
From: <zw...@ma...> - 2009-05-07 01:25:35
|
Author: zwelch Date: 2009-05-07 01:25:27 +0200 (Thu, 07 May 2009) New Revision: 1623 Modified: trunk/src/target/armv7m.c trunk/src/target/register.h Log: Change reg_s value field from u8 * to void *; it must always be cast. Modified: trunk/src/target/armv7m.c =================================================================== --- trunk/src/target/armv7m.c 2009-05-06 23:05:57 UTC (rev 1622) +++ trunk/src/target/armv7m.c 2009-05-06 23:25:27 UTC (rev 1623) @@ -289,7 +289,7 @@ /* ARMV7M is always in thumb mode, try to make GDB understand this * if it does not support this arch */ - armv7m->core_cache->reg_list[15].value[0] |= 1; + *((char*)armv7m->core_cache->reg_list[15].value) |= 1; #else (*reg_list)[25] = &armv7m->core_cache->reg_list[ARMV7M_xPSR]; #endif Modified: trunk/src/target/register.h =================================================================== --- trunk/src/target/register.h 2009-05-06 23:05:57 UTC (rev 1622) +++ trunk/src/target/register.h 2009-05-06 23:25:27 UTC (rev 1623) @@ -37,7 +37,7 @@ typedef struct reg_s { char *name; - u8 *value; + void *value; int dirty; int valid; u32 size; |
From: <zw...@ma...> - 2009-05-07 01:06:10
|
Author: zwelch Date: 2009-05-07 01:05:57 +0200 (Thu, 07 May 2009) New Revision: 1622 Modified: trunk/src/svf/svf.c Log: Fix pointer cast alignment issues in svf.c Modified: trunk/src/svf/svf.c =================================================================== --- trunk/src/svf/svf.c 2009-05-06 21:48:39 UTC (rev 1621) +++ trunk/src/svf/svf.c 2009-05-06 23:05:57 UTC (rev 1622) @@ -653,11 +653,17 @@ { if ((svf_tdi_buffer[index + j] & svf_mask_buffer[index + j]) != svf_tdo_buffer[index + j]) { - LOG_ERROR("tdo check error at line %d, read = 0x%X, want = 0x%X, mask = 0x%X", + unsigned bitmask = (1 << svf_check_tdo_para[i].bit_len) - 1; + unsigned received, expected, tapmask; + memcpy(&received, svf_tdi_buffer + index, sizeof(unsigned)); + memcpy(&expected, svf_tdo_buffer + index, sizeof(unsigned)); + memcpy(&tapmask, svf_mask_buffer + index, sizeof(unsigned)); + LOG_ERROR("tdo check error at line %d, " + "read = 0x%X, want = 0x%X, mask = 0x%X", svf_check_tdo_para[i].line_num, - (*(int*)(svf_tdi_buffer + index)) & ((1 << svf_check_tdo_para[i].bit_len) - 1), - (*(int*)(svf_tdo_buffer + index)) & ((1 << svf_check_tdo_para[i].bit_len) - 1), - (*(int*)(svf_mask_buffer + index)) & ((1 << svf_check_tdo_para[i].bit_len) - 1)); + received & bitmask, + expected & bitmask, + tapmask & bitmask); return ERROR_FAIL; } } @@ -1381,8 +1387,11 @@ // output debug info if ((SIR == command) || (SDR == command)) { + int read_value; + memcpy(&read_value, svf_tdi_buffer, sizeof(int)); // in debug mode, data is from index 0 - LOG_DEBUG("\tTDO read = 0x%X", (*(int*)svf_tdi_buffer) & ((1 << (svf_check_tdo_para[0].bit_len)) - 1)); + int read_mask = (1 << (svf_check_tdo_para[0].bit_len)) - 1; + LOG_DEBUG("\tTDO read = 0x%X", read_value & read_mask); } } } |
From: <zw...@ma...> - 2009-05-06 23:48:43
|
Author: zwelch Date: 2009-05-06 23:48:39 +0200 (Wed, 06 May 2009) New Revision: 1621 Modified: trunk/configure.in Log: Add configure script check to enable C99 build option. Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-05-06 21:21:18 UTC (rev 1620) +++ trunk/configure.in 2009-05-06 21:48:39 UTC (rev 1621) @@ -781,6 +781,7 @@ AC_LANG_C AC_PROG_CC +AC_PROG_CC_C99 AM_PROG_CC_C_O AC_PROG_RANLIB |
From: <zw...@ma...> - 2009-05-06 23:21:22
|
Author: zwelch Date: 2009-05-06 23:21:18 +0200 (Wed, 06 May 2009) New Revision: 1620 Modified: trunk/src/helper/jim.c Log: Fix pointer cast alignment warnings in jim.c. Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-05-06 18:47:15 UTC (rev 1619) +++ trunk/src/helper/jim.c 2009-05-06 21:21:18 UTC (rev 1620) @@ -7650,6 +7650,8 @@ scanned += 1; break; case 'd': case 'o': case 'x': case 'u': case 'i': { + jim_wide jwvalue; + long lvalue; char *endp; /* Position where the number finished */ int base = descr->type == 'o' ? 8 : descr->type == 'x' ? 16 @@ -7659,16 +7661,22 @@ do { /* Try to scan a number with the given base */ if (descr->modifier == 'l') + { #ifdef HAVE_LONG_LONG - *(jim_wide*)value = JimStrtoll(tok, &endp, base); + jwvalue = JimStrtoll(tok, &endp, base), #else - *(jim_wide*)value = strtol(tok, &endp, base); + jwvalue = strtol(tok, &endp, base), #endif + memcpy(value, &jwvalue, sizeof(jim_wide)); + } else + { if (descr->type == 'u') - *(long*)value = strtoul(tok, &endp, base); + lvalue = strtoul(tok, &endp, base); else - *(long*)value = strtol(tok, &endp, base); + lvalue = strtol(tok, &endp, base); + memcpy(value, &lvalue, sizeof(lvalue)); + } /* If scanning failed, and base was undetermined, simply * put it to 10 and try once more. This should catch the * case where %i begin to parse a number prefix (e.g. @@ -7680,9 +7688,9 @@ if (endp != tok) { /* There was some number sucessfully scanned! */ if (descr->modifier == 'l') - *valObjPtr = Jim_NewIntObj(interp, *(jim_wide*)value); + *valObjPtr = Jim_NewIntObj(interp, jwvalue); else - *valObjPtr = Jim_NewIntObj(interp, *(long*)value); + *valObjPtr = Jim_NewIntObj(interp, lvalue); /* Adjust the number-of-chars scanned so far */ scanned += endp - tok; } else { @@ -7701,10 +7709,11 @@ case 'e': case 'f': case 'g': { char *endp; - *(double*)value = strtod(tok, &endp); + double dvalue = strtod(tok, &endp); + memcpy(value, &dvalue, sizeof(double)); if (endp != tok) { /* There was some number sucessfully scanned! */ - *valObjPtr = Jim_NewDoubleObj(interp, *(double*)value); + *valObjPtr = Jim_NewDoubleObj(interp, dvalue); /* Adjust the number-of-chars scanned so far */ scanned += endp - tok; } else { |
From: <ml...@ma...> - 2009-05-06 20:47:16
|
Author: mlu Date: 2009-05-06 20:47:15 +0200 (Wed, 06 May 2009) New Revision: 1619 Modified: trunk/src/jtag/jtag.c Log: Added (BUILD_JLINK==1) condition to us new tables with JLink Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-05-06 18:24:24 UTC (rev 1618) +++ trunk/src/jtag/jtag.c 2009-05-06 18:47:15 UTC (rev 1619) @@ -3116,7 +3116,7 @@ #define B8(bits,count) { ((u8)B8__(HEX__(bits))), (count) } -#if 0 && ((BUILD_FT2232_FTD2XX==1) || (BUILD_FT2232_LIBFTDI==1)) +#if 0 && ((BUILD_FT2232_FTD2XX==1) || (BUILD_FT2232_LIBFTDI==1) || (BUILD_JLINK==1)) /* this is the table submitted by Jeff Williams on 3/30/2009 with this comment: OK, I added Peter's version of the state table, and it works OK for |