remove in_handler usage

git-svn-id: svn://svn.berlios.de/openocd/trunk@1637 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
oharboe 2009-05-07 12:33:26 +00:00
parent a1777c6bcf
commit 146b6462a3
1 changed files with 37 additions and 41 deletions

View File

@ -77,22 +77,22 @@ int adi_jtag_dp_scan(arm_jtag_t *jtag_info, u8 instr, u8 reg_addr, u8 RnW, u8 *o
fields[0].num_bits = 3; fields[0].num_bits = 3;
buf_set_u32(&out_addr_buf, 0, 3, ((reg_addr >> 1) & 0x6) | (RnW & 0x1)); buf_set_u32(&out_addr_buf, 0, 3, ((reg_addr >> 1) & 0x6) | (RnW & 0x1));
fields[0].out_value = &out_addr_buf; fields[0].out_value = &out_addr_buf;
fields[0].in_value = ack; fields[0].in_value = ack;
fields[0].in_handler = NULL; fields[0].in_handler = NULL;
fields[1].tap = jtag_info->tap; fields[1].tap = jtag_info->tap;
fields[1].num_bits = 32; fields[1].num_bits = 32;
fields[1].out_value = outvalue; fields[1].out_value = outvalue;
fields[1].in_value = invalue; fields[1].in_value = invalue;
fields[1].in_handler = NULL; fields[1].in_handler = NULL;
jtag_add_dr_scan(2, fields, TAP_INVALID); jtag_add_dr_scan(2, fields, TAP_INVALID);
@ -113,33 +113,29 @@ int adi_jtag_dp_scan_u32(arm_jtag_t *jtag_info, u8 instr, u8 reg_addr, u8 RnW, u
fields[0].num_bits = 3; fields[0].num_bits = 3;
buf_set_u32(&out_addr_buf, 0, 3, ((reg_addr >> 1) & 0x6) | (RnW & 0x1)); buf_set_u32(&out_addr_buf, 0, 3, ((reg_addr >> 1) & 0x6) | (RnW & 0x1));
fields[0].out_value = &out_addr_buf; fields[0].out_value = &out_addr_buf;
fields[0].in_value = ack; fields[0].in_value = ack;
fields[0].in_handler = NULL; fields[0].in_handler = NULL;
fields[1].tap = jtag_info->tap; fields[1].tap = jtag_info->tap;
fields[1].num_bits = 32; fields[1].num_bits = 32;
buf_set_u32(out_value_buf, 0, 32, outvalue); buf_set_u32(out_value_buf, 0, 32, outvalue);
fields[1].out_value = out_value_buf; fields[1].out_value = out_value_buf;
fields[1].in_value = NULL; fields[1].in_value = NULL;
fields[1].in_handler = NULL;
if (invalue) if (invalue)
{ {
fields[1].in_handler = arm_jtag_buf_to_u32; /* deprecated! invoke this from user code! */ u8 tmp[4];
fields[1].in_handler_priv = invalue; fields[1].in_value = tmp;
} jtag_add_dr_scan_now(2, fields, TAP_INVALID);
else
{
fields[1].in_handler = NULL;
}
jtag_add_dr_scan(2, fields, TAP_INVALID); *invalue=flip_u32(le_to_h_u32(tmp), 32);
} else
{
jtag_add_dr_scan(2, fields, TAP_INVALID);
}
return ERROR_OK; return ERROR_OK;
} }
@ -296,7 +292,7 @@ int dap_dp_read_reg(swjdp_common_t *swjdp, u32 *value, u8 reg_addr)
{ {
return scan_inout_check_u32(swjdp, SWJDP_IR_DPACC, reg_addr, DPAP_READ, 0, value); 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) int dap_ap_select(swjdp_common_t *swjdp,u8 apsel)
{ {
u32 select; u32 select;
@ -1012,7 +1008,7 @@ int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, i
u32 dbgbase,apid; u32 dbgbase,apid;
int romtable_present = 0; int romtable_present = 0;
u8 mem_ap; u8 mem_ap;
u32 apselold; u32 apselold;
apselold = swjdp->apsel; apselold = swjdp->apsel;
@ -1028,23 +1024,23 @@ int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, i
switch (apid&0x0F) switch (apid&0x0F)
{ {
case 0: case 0:
command_print(cmd_ctx, "\tType is jtag-ap"); command_print(cmd_ctx, "\tType is jtag-ap");
break; break;
case 1: case 1:
command_print(cmd_ctx, "\tType is mem-ap AHB"); command_print(cmd_ctx, "\tType is mem-ap AHB");
break; break;
case 2: case 2:
command_print(cmd_ctx, "\tType is mem-ap APB"); command_print(cmd_ctx, "\tType is mem-ap APB");
break; break;
default: default:
command_print(cmd_ctx, "\tUnknown AP-type"); command_print(cmd_ctx, "\tUnknown AP-type");
break; break;
} }
command_print(cmd_ctx, "ap debugbase 0x%8.8x", dbgbase); command_print(cmd_ctx, "ap debugbase 0x%8.8x", dbgbase);
} }
else 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)); romtable_present = ((mem_ap)&&(dbgbase != 0xFFFFFFFF));
@ -1062,11 +1058,11 @@ int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, i
command_print(cmd_ctx, "\tROM table in legacy format" ); command_print(cmd_ctx, "\tROM table in legacy format" );
} }
/* Now we read ROM table ID registers, ref. ARM IHI 0029B sec */ /* 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)|0xFF0, &cid0);
mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFF4, &cid1); 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)|0xFF8, &cid2);
mem_ap_read_u32(swjdp, (dbgbase&0xFFFFF000)|0xFFC, &cid3); 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)|0xFCC, &memtype);
swjdp_transaction_endcheck(swjdp); swjdp_transaction_endcheck(swjdp);
command_print(cmd_ctx, "\tCID3 0x%x, CID2 0x%x, CID1 0x%x, CID0, 0x%x",cid3,cid2,cid1,cid0); command_print(cmd_ctx, "\tCID3 0x%x, CID2 0x%x, CID1 0x%x, CID0, 0x%x",cid3,cid2,cid1,cid0);
if (memtype&0x01) if (memtype&0x01)
@ -1077,10 +1073,10 @@ int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, i
{ {
command_print(cmd_ctx, "\tMEMTYPE system memory not present. Dedicated debug bus" ); 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 */ /* Now we read ROM table entries from dbgbase&0xFFFFF000)|0x000 until we get 0x00000000 */
entry_offset = 0; entry_offset = 0;
do do
{ {
mem_ap_read_atomic_u32(swjdp, (dbgbase&0xFFFFF000)|entry_offset, &romentry); mem_ap_read_atomic_u32(swjdp, (dbgbase&0xFFFFF000)|entry_offset, &romentry);
command_print(cmd_ctx, "\tROMTABLE[0x%x] = 0x%x",entry_offset,romentry); command_print(cmd_ctx, "\tROMTABLE[0x%x] = 0x%x",entry_offset,romentry);
@ -1107,16 +1103,16 @@ int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, i
else else
{ {
if (romentry) if (romentry)
command_print(cmd_ctx, "\t\tComponent not present"); command_print(cmd_ctx, "\t\tComponent not present");
else else
command_print(cmd_ctx, "\t\tEnd of ROM table"); command_print(cmd_ctx, "\t\tEnd of ROM table");
} }
entry_offset += 4; entry_offset += 4;
} while (romentry>0); } while (romentry>0);
} }
else else
{ {
command_print(cmd_ctx, "\tNo ROM table present"); command_print(cmd_ctx, "\tNo ROM table present");
} }
dap_ap_select(swjdp, apselold); dap_ap_select(swjdp, apselold);