sharing for openocd beginner how FTDI usb work

ex: //remove hardware breakpoint

/root/openocd-0.9.0/src/target/cortex_a.c

cortex_a_unset_breakpoint(struct target *target, struct breakpoint *breakpoint)

retval = cortex_a_dap_write_memap_register_u32(target,

armv7a->debug_base + CPUDBG_BCR_BASE + 4 * brp_list[brp_i].BRPn,

brp_list[brp_i].control);

/////////////////

/root/downloads/openocd-0.9.0/src/target/arm_adi_v5.c

pass to

int mem_ap_write_atomic_u32(struct adiv5_dap *dap, uint32_t address, uint32_t value)

{

//write to dap_queue

int retval = mem_ap_write_u32(dap, address, value);

if (retval != ERROR_OK)

return retval;

return dap_run(dap); //run queue command

}

//////////////////////////

/root/openocd-0.9.0/src/target/adi_v5_jtag.c

pass to

static int jtagdp_transaction_endcheck(struct adiv5_dap *dap)

//send queue command

retval = jtag_execute_queue();

/////////////////////////

/root/openocd-0.9.0/src/jtag/core.c

pass to

int jtag_execute_queue(void)

jtag_execute_queue_noclear();

//////////////////////

/root/openocd-0.9.0/src/jtag/core.c

pass to

void jtag_execute_queue_noclear(void)

jtag_set_error(interface_jtag_execute_queue());

///////////////////

/root/downloads/openocd-0.9.0/src/jtag/drivers/driver.c

pass to

int interface_jtag_execute_queue(void)

int retval = default_interface_jtag_execute_queue();

////////////////

/root/openocd-0.9.0/src/jtag/core.c

pass to

return jtag->execute_queue();

//////////////

/root/openocd-0.9.0/src/jtag/drivers/ftdi.c

pass to

static int ftdi_execute_queue(void)

int retval = mpsse_flush(mpsse_ctx);

//////////////

/root/openocd-0.9.0/src/jtag/drivers/mpsse.c

pass to

int mpsse_flush(struct mpsse_ctx *ctx)

send queue date to usb

retval = libusb_submit_transfer(write_transfer);

Done~~~~~~~~~~~~~~~