OpenOCD
rtt/rtt.c File Reference
Include dependency graph for rtt/rtt.c:

Go to the source code of this file.

Functions

static int adjust_sink_list (size_t length)
 
static int read_channel_callback (void *user_data)
 
bool rtt_configured (void)
 Get whether RTT is configured. More...
 
int rtt_exit (void)
 Shutdown Real-Time Transfer (RTT). More...
 
bool rtt_found_cb (void)
 Get whether RTT control block was found. More...
 
const struct rtt_controlrtt_get_control (void)
 Get the RTT control block. More...
 
int rtt_get_polling_interval (unsigned int *interval)
 Get the polling interval. More...
 
int rtt_init (void)
 Initialize Real-Time Transfer (RTT). More...
 
int rtt_read_channel_info (unsigned int channel_index, enum rtt_channel_type type, struct rtt_channel_info *info)
 Read channel information. More...
 
int rtt_register_sink (unsigned int channel_index, rtt_sink_read read, void *user_data)
 Register an RTT sink. More...
 
int rtt_register_source (const struct rtt_source source, struct target *target)
 Register an RTT source for a target. More...
 
int rtt_set_polling_interval (unsigned int interval)
 Set the polling interval. More...
 
int rtt_setup (target_addr_t address, size_t size, const char *id)
 Setup RTT. More...
 
int rtt_start (void)
 Start Real-Time Transfer (RTT). More...
 
bool rtt_started (void)
 Get whether RTT is started. More...
 
int rtt_stop (void)
 Stop Real-Time Transfer (RTT). More...
 
int rtt_unregister_sink (unsigned int channel_index, rtt_sink_read read, void *user_data)
 Unregister an RTT sink. More...
 
int rtt_write_channel (unsigned int channel_index, const uint8_t *buffer, size_t *length)
 Write to an RTT channel. More...
 

Variables

struct {
   target_addr_t   addr
 Start address to search for the control block. More...
 
   bool   changed
 Whether configuration changed. More...
 
   bool   configured
 Whether RTT is configured. More...
 
   struct rtt_control   ctrl
 Control block. More...
 
   bool   found_cb
 Whether the control block was found. More...
 
   char   id [RTT_CB_MAX_ID_LENGTH]
 Control block identifier. More...
 
   unsigned int   polling_interval
 
   struct rtt_sink_list **   sink_list
 
   size_t   sink_list_length
 
   size_t   size
 Size of the control block search area. More...
 
   struct rtt_source   source
 
   bool   started
 Whether RTT is started. More...
 
   struct target *   target
 
rtt
 

Function Documentation

◆ adjust_sink_list()

static int adjust_sink_list ( size_t  length)
static

Definition at line 185 of file rtt/rtt.c.

References ERROR_FAIL, ERROR_OK, length, NULL, and rtt.

Referenced by rtt_register_sink().

◆ read_channel_callback()

static int read_channel_callback ( void *  user_data)
static

Definition at line 72 of file rtt/rtt.c.

References ERROR_OK, NULL, rtt, and target_unregister_timer_callback().

Referenced by rtt_set_polling_interval(), rtt_start(), and rtt_stop().

◆ rtt_configured()

bool rtt_configured ( void  )

Get whether RTT is configured.

Returns
Whether RTT is configured.

Definition at line 305 of file rtt/rtt.c.

References rtt.

Referenced by COMMAND_HANDLER().

◆ rtt_exit()

int rtt_exit ( void  )

Shutdown Real-Time Transfer (RTT).

Returns
ERROR_OK on success, an error code on failure.

Definition at line 65 of file rtt/rtt.c.

References ERROR_OK, and rtt.

Referenced by openocd_main().

◆ rtt_found_cb()

bool rtt_found_cb ( void  )

Get whether RTT control block was found.

Returns
Whether RTT was found.

Definition at line 310 of file rtt/rtt.c.

References rtt.

Referenced by COMMAND_HANDLER(), and jim_channel_list().

◆ rtt_get_control()

const struct rtt_control* rtt_get_control ( void  )

Get the RTT control block.

Returns
The RTT control block.

Definition at line 315 of file rtt/rtt.c.

References rtt.

Referenced by COMMAND_HANDLER(), and jim_channel_list().

◆ rtt_get_polling_interval()

int rtt_get_polling_interval ( unsigned int *  interval)

Get the polling interval.

Parameters
[out]intervalPolling interval in milliseconds.
Returns
ERROR_OK on success, an error code on failure.

Definition at line 262 of file rtt/rtt.c.

References ERROR_FAIL, ERROR_OK, and rtt.

Referenced by COMMAND_HANDLER().

◆ rtt_init()

int rtt_init ( void  )

Initialize Real-Time Transfer (RTT).

Returns
ERROR_OK on success, an error code on failure.

Definition at line 48 of file rtt/rtt.c.

References ERROR_FAIL, ERROR_OK, NULL, and rtt.

Referenced by openocd_main().

◆ rtt_read_channel_info()

int rtt_read_channel_info ( unsigned int  channel_index,
enum rtt_channel_type  type,
struct rtt_channel_info info 
)

Read channel information.

Parameters
[in]channel_indexChannel index.
[in]typeChannel type.
[out]infoChannel information.
Returns
ERROR_OK on success, an error code on failure.

Definition at line 320 of file rtt/rtt.c.

Referenced by COMMAND_HANDLER(), and jim_channel_list().

◆ rtt_register_sink()

int rtt_register_sink ( unsigned int  channel_index,
rtt_sink_read  read,
void *  user_data 
)

Register an RTT sink.

Parameters
[in]channel_indexChannel index.
[in]readRead callback function.
[in,out]user_dataUser data to be passed to the callback function.
Returns
ERROR_OK on success, an error code on failure.

Definition at line 206 of file rtt/rtt.c.

References adjust_sink_list(), ERROR_FAIL, ERROR_OK, LOG_DEBUG, rtt_sink_list::next, rtt_sink_list::read, rtt, and rtt_sink_list::user_data.

Referenced by rtt_new_connection().

◆ rtt_register_source()

int rtt_register_source ( const struct rtt_source  source,
struct target target 
)

Register an RTT source for a target.

Parameters
[in]sourceRTT source.
[in,out]targetTarget.
Returns
ERROR_OK on success, an error code on failure.

Definition at line 106 of file rtt/rtt.c.

References ERROR_FAIL, ERROR_OK, rtt_source::find_cb, rtt_source::read, rtt_source::read_cb, rtt_source::read_channel_info, rtt, source, rtt_source::start, rtt_source::stop, target, and rtt_source::write.

Referenced by COMMAND_HANDLER().

◆ rtt_set_polling_interval()

int rtt_set_polling_interval ( unsigned int  interval)

Set the polling interval.

Parameters
[in]intervalPolling interval in milliseconds.
Returns
ERROR_OK on success, an error code on failure.

Definition at line 272 of file rtt/rtt.c.

References ERROR_FAIL, ERROR_OK, NULL, read_channel_callback(), rtt, target_register_timer_callback(), and target_unregister_timer_callback().

Referenced by COMMAND_HANDLER().

◆ rtt_setup()

int rtt_setup ( target_addr_t  address,
size_t  size,
const char *  id 
)

Setup RTT.

Parameters
[in]addressStart address to search for the control block.
[in]sizeSize of the control block search area.
[in]idIdentifier of the control block. Must be null-terminated.
Returns
ERROR_OK on success, an error code on failure.

Definition at line 88 of file rtt/rtt.c.

References ERROR_COMMAND_ARGUMENT_INVALID, ERROR_OK, LOG_ERROR, rtt, RTT_CB_MAX_ID_LENGTH, and size.

Referenced by COMMAND_HANDLER().

◆ rtt_start()

int rtt_start ( void  )

Start Real-Time Transfer (RTT).

Returns
ERROR_OK on success, an error code on failure.

Definition at line 124 of file rtt/rtt.c.

References addr, ERROR_OK, LOG_INFO, NULL, read_channel_callback(), rtt, TARGET_PRIxADDR, and target_register_timer_callback().

Referenced by COMMAND_HANDLER().

◆ rtt_started()

bool rtt_started ( void  )

Get whether RTT is started.

Returns
Whether RTT is started.

Definition at line 300 of file rtt/rtt.c.

References rtt.

◆ rtt_stop()

int rtt_stop ( void  )

Stop Real-Time Transfer (RTT).

Returns
ERROR_OK on success, an error code on failure.

Definition at line 165 of file rtt/rtt.c.

References ERROR_FAIL, ERROR_OK, LOG_ERROR, NULL, read_channel_callback(), rtt, and target_unregister_timer_callback().

Referenced by COMMAND_HANDLER().

◆ rtt_unregister_sink()

int rtt_unregister_sink ( unsigned int  channel_index,
rtt_sink_read  read,
void *  user_data 
)

Unregister an RTT sink.

Parameters
[in]channel_indexChannel index.
[in]readRead callback function.
[in,out]user_dataUser data to be passed to the callback function.
Returns
ERROR_OK on success, an error code on failure.

Definition at line 232 of file rtt/rtt.c.

References ERROR_FAIL, ERROR_OK, LOG_DEBUG, rtt_sink_list::next, rtt_sink_list::read, rtt, and rtt_sink_list::user_data.

Referenced by rtt_connection_closed().

◆ rtt_write_channel()

int rtt_write_channel ( unsigned int  channel_index,
const uint8_t *  buffer,
size_t *  length 
)

Write to an RTT channel.

Parameters
[in]channel_indexChannel index.
[in]bufferBuffer with data that should be written to the channel.
[in,out]lengthNumber of bytes to write. On success, the argument gets updated with the actual number of written bytes.
Returns
ERROR_OK on success, an error code on failure.

Definition at line 288 of file rtt/rtt.c.

References buffer, ERROR_OK, length, LOG_WARNING, NULL, and rtt.

Referenced by rtt_input().

Variable Documentation

◆ addr

Start address to search for the control block.

Definition at line 28 of file rtt/rtt.c.

Referenced by rtt_start().

◆ changed

bool changed

Whether configuration changed.

Definition at line 38 of file rtt/rtt.c.

Referenced by same5_modify_user_row_masked().

◆ configured

bool configured

Whether RTT is configured.

Definition at line 34 of file rtt/rtt.c.

◆ ctrl

◆ found_cb

bool found_cb

Whether the control block was found.

Definition at line 40 of file rtt/rtt.c.

◆ id

◆ polling_interval

unsigned int polling_interval

Definition at line 45 of file rtt/rtt.c.

◆ 

◆ sink_list

struct rtt_sink_list** sink_list

Definition at line 42 of file rtt/rtt.c.

◆ sink_list_length

size_t sink_list_length

Definition at line 43 of file rtt/rtt.c.

◆ size

size_t size

Size of the control block search area.

Definition at line 30 of file rtt/rtt.c.

Referenced by __attribute__(), aarch64_read_cpu_memory(), aarch64_read_cpu_memory_slow(), aarch64_read_memory(), aarch64_read_phys_memory(), aarch64_write_cpu_memory(), aarch64_write_cpu_memory_slow(), aarch64_write_memory(), aarch64_write_phys_memory(), access_register_command(), adapter_poll_trace(), adapter_read_memory(), adapter_write_memory(), adbg_wb_burst_read(), adbg_wb_burst_write(), aice_pipe_read_mem_unit(), aice_pipe_write_mem_unit(), aice_read_mem_unit(), aice_usb_read_memory_unit(), aice_usb_write_memory_unit(), aice_write_mem_unit(), alloc_block_array(), arc_mem_is_slow_memory(), arc_mem_read(), arc_mem_read_block(), arc_mem_write(), arm11_read_memory(), arm11_read_memory_inner(), arm11_write_memory(), arm11_write_memory_inner(), arm720t_read_memory(), arm720t_read_phys_memory(), arm720t_write_phys_memory(), arm7_9_endianness_callback(), arm7_9_read_memory(), arm7_9_target_request_data(), arm7_9_write_memory(), arm7_9_write_memory_no_opt(), arm7_9_write_memory_opt(), arm7tdmi_clock_data_in_endianness(), arm7tdmi_read_core_regs_target_buffer(), arm920t_read_memory(), arm920t_read_phys_memory(), arm920t_write_memory(), arm920t_write_phys_memory(), arm926ejs_read_phys_memory(), arm926ejs_write_memory(), arm926ejs_write_phys_memory(), arm946e_invalidate_dcache(), arm946e_invalidate_icache(), arm946e_read_memory(), arm946e_write_memory(), arm9tdmi_clock_data_in_endianness(), arm9tdmi_read_core_regs_target_buffer(), arm_blank_check_memory(), arm_code_to_working_area(), arm_nandread(), arm_nandwrite(), arm_tpiu_swo_poll_trace(), armv4_5_identify_cache(), armv4_5_mmu_read_physical(), armv4_5_mmu_write_physical(), armv4_5_run_algorithm_inner(), armv7a_cache_auto_flush_on_write(), armv7a_cache_flush_virt(), armv7a_l1_d_cache_clean_virt(), armv7a_l1_d_cache_flush_level(), armv7a_l1_d_cache_flush_virt(), armv7a_l1_d_cache_inval_virt(), armv7a_l1_i_cache_inval_virt(), armv7a_l2x_cache_clean_virt(), armv7a_l2x_cache_flush_virt(), armv7a_l2x_cache_inval_virt(), armv7m_blank_check_memory(), armv7m_get_gdb_reg_list(), armv7m_start_algorithm(), armv7m_wait_algorithm(), armv8_cache_d_inner_flush_level(), armv8_cache_d_inner_flush_virt(), armv8_cache_i_inner_inval_virt(), at91sam9_oob_init(), at91sam9_read_block_data(), at91sam9_write_block_data(), avr32_ap7k_read_memory(), avr32_ap7k_write_memory(), binprint(), buf_cmp(), buf_cmp_mask(), buf_cpy(), buf_set_ones(), buspirate_print_buffer(), buspirate_serial_read(), buspirate_serial_write(), cc26xx_write(), cc3220sf_probe(), clear_malloc(), cmd_queue_alloc(), cmsis_dap_poll_trace(), COMMAND_HANDLER(), cortex_a_read_buffer(), cortex_a_read_cpu_memory(), cortex_a_read_cpu_memory_slow(), cortex_a_read_memory(), cortex_a_read_phys_memory(), cortex_a_write_buffer(), cortex_a_write_cpu_memory(), cortex_a_write_cpu_memory_slow(), cortex_a_write_memory(), cortex_a_write_phys_memory(), cortex_m_read_memory(), cortex_m_target_request_data(), cortex_m_write_memory(), dap_info_cs_component(), dsp563xx_read_buffer_default(), dsp563xx_read_memory(), dsp563xx_read_memory_core(), dsp563xx_read_memory_default(), dsp563xx_run_algorithm(), dsp563xx_write_buffer_default(), dsp563xx_write_memory(), dsp563xx_write_memory_core(), dsp563xx_write_memory_default(), dsp5680xx_read(), dsp5680xx_read_buffer(), dsp5680xx_write(), dsp5680xx_write_buffer(), dtc_queue_enqueue_reply(), embeddedice_receive(), embeddedice_send(), esirisc_read_memory(), esirisc_trace_analyze(), esirisc_trace_analyze_buffer(), esirisc_trace_analyze_full(), esirisc_trace_analyze_memory(), esirisc_trace_analyze_simple(), esirisc_trace_buf_get_pc(), esirisc_trace_buf_get_u32(), esirisc_trace_dump(), esirisc_trace_dump_buffer(), esirisc_trace_dump_memory(), esirisc_trace_read_buffer(), esirisc_trace_read_memory(), esirisc_write_memory(), etmv1_data(), fa526_read_core_regs_target_buffer(), feroceon_read_core_regs_target_buffer(), fileio_fgets(), fileio_local_fgets(), fileio_local_read(), fileio_local_write(), fileio_read(), fileio_size(), fileio_write(), fill_malloc(), find_exe_path(), flash_write_unlock_verify(), gdb_breakpoint_watchpoint_packet(), gdb_generate_reg_type_description(), gdb_generate_target_description(), gdb_generate_thread_list(), gdb_get_register_packet(), gdb_get_registers_packet(), gdb_memory_map(), gdb_query_packet(), gdb_set_register_packet(), gdb_set_registers_packet(), handle_iod_output(), has_sufficient_progbuf(), hexdump(), hl_interface_poll_trace(), hl_target_request_data(), hwthread_get_thread_reg_list(), hwthread_read_buffer(), hwthread_write_buffer(), icdi_usb_read_mem(), icdi_usb_write_mem(), image_add_section(), image_elf32_read_section(), image_elf64_read_section(), image_elf_read_section(), image_read_section(), init_mem_param(), init_reg_param(), jtag_libusb_bulk_read(), jtag_libusb_bulk_write(), jtag_libusb_control_transfer(), kinetis_write_sections(), linux_read_memory(), ls1_sap_memory_cmd(), ls1_sap_memory_read(), ls1_sap_memory_write(), ls1_sap_read_memory(), mem_ap_read(), mem_ap_read_buf(), mem_ap_read_buf_noincr(), mem_ap_read_memory(), mem_ap_write(), mem_ap_write_buf(), mem_ap_write_buf_noincr(), mem_should_skip_abstract(), mem_should_skip_progbuf(), mem_should_skip_sysbus(), mips32_blank_check_memory(), mips32_dmaacc_read_mem(), mips32_dmaacc_write_mem(), mips32_pracc_read_mem(), mips32_pracc_write_mem(), mips32_pracc_write_mem_generic(), mips32_run_algorithm(), mips64_pracc_read_mem(), mips64_pracc_write_mem(), mips_m4k_read_memory(), mips_m4k_write_memory(), mips_mips64_read_memory(), mips_mips64_write_memory(), mqx_target_read_buffer(), msp432_probe(), msp432_write(), nand_read_data_page(), nand_write_data_page(), nds32_gdb_fileio_write_memory(), nds32_read_buffer(), nds32_read_memory(), nds32_read_phys_memory(), nds32_reg_set(), nds32_v2_read_buffer(), nds32_v2_read_memory(), nds32_v2_write_buffer(), nds32_v3_read_buffer(), nds32_v3_read_memory(), nds32_v3_write_buffer(), nds32_v3_write_memory(), nds32_write_buffer(), nds32_write_memory(), nds32_write_phys_memory(), npcx_write(), nulink1_usb_init_buffer(), nulink2_usb_init_buffer(), nulink_usb_init_buffer(), nulink_usb_read_mem(), nulink_usb_write_mem(), nulink_usb_xfer(), openjtag_buf_write(), openjtag_buf_write_cy7c65215(), openjtag_buf_write_standard(), or1k_adv_jtag_read_memory(), or1k_adv_jtag_write_memory(), or1k_read_memory(), or1k_write_memory(), orion_nand_fast_block_write(), orion_nand_slow_block_write(), poll_trace(), presto_read(), presto_write(), read_by_given_size(), read_mem(), read_memory(), read_memory_abstract(), read_memory_bus_v0(), read_memory_bus_v1(), read_memory_bus_word(), read_memory_progbuf(), read_memory_progbuf_inner(), read_memory_progbuf_one(), read_phys_mem(), register_read_abstract(), register_write_abstract(), riscv_read_by_any_size(), riscv_read_memory(), riscv_read_phys_memory(), riscv_write_by_any_size(), riscv_write_memory(), riscv_write_phys_memory(), rpc_hf_xfer(), rtos_generic_stack_read(), rtos_put_gdb_reg_list(), rtos_read_buffer(), rtos_thread_packet(), rtos_write_buffer(), rtt_setup(), semihosting_common(), semihosting_read(), semihosting_redirect_read(), semihosting_redirect_write(), semihosting_write(), setup_sector(), setup_write_memory(), stlink_cmd_allow_retry(), stlink_dap_trace_read(), stlink_get_com_freq(), stlink_swim_op_read_mem(), stlink_swim_op_write_mem(), stlink_tcp_read_trace(), stlink_tcp_xfer_noerrcheck(), stlink_usb_init_buffer(), stlink_usb_read_ap_mem(), stlink_usb_read_mem(), stlink_usb_read_trace(), stlink_usb_set_cbw_transfer_datalength(), stlink_usb_state(), stlink_usb_usb_read_trace(), stlink_usb_usb_xfer_noerrcheck(), stlink_usb_write_ap_mem(), stlink_usb_write_mem(), stlink_usb_xfer_errcheck(), stlink_usb_xfer_rw(), stlink_usb_xfer_v1_create_cmd(), stm32l4_write(), stm32x_probe(), stm8_adapter_read_memory(), stm8_adapter_write_memory(), stm8_blank_check_memory(), stm8_read_memory(), stm8_run_algorithm(), stm8_write_flash(), stm8_write_memory(), swim_read_mem(), swim_write_mem(), target_alloc_working_area(), target_alloc_working_area_try(), target_checksum_memory(), target_get_working_area_avail(), target_handle_md_output(), target_hexmsg(), target_read_buffer(), target_read_buffer_default(), target_read_memory(), target_read_phys_memory(), target_rtt_find_control_block(), target_split_working_area(), target_write_buffer(), target_write_buffer_default(), target_write_memory(), target_write_phys_memory(), ublast2_libusb_read(), ublast2_libusb_write(), ublast2_write_firmware_section(), ublast_buf_read(), ublast_buf_write(), ublast_ftdi_read(), ublast_ftdi_write(), ulink_allocate_payload(), ulink_write_firmware_section(), usb_bulk_read_ex(), usb_bulk_with_retries(), usb_bulk_write_ex(), usb_get_response(), usb_read(), usb_send_command(), usb_write(), usbprog_jtag_read_tdo(), usbprog_jtag_write_and_read(), usbprog_jtag_write_tdi(), usbprog_scan(), usbtopoll_checkfail(), usbtopoll_checkok(), usbtopoll_verifybuff(), versaloon_add_want_pos(), wrap_usb_bulk_write(), write_by_given_size(), write_mem(), write_memory(), write_memory_abstract(), write_memory_bus_v0(), write_memory_bus_v1(), write_memory_progbuf(), write_phys_mem(), x86_32_common_read_io(), x86_32_common_read_memory(), x86_32_common_read_phys_mem(), x86_32_common_write_io(), x86_32_common_write_memory(), x86_32_common_write_phys_mem(), xscale_read_memory(), xscale_read_phys_memory(), xscale_send(), xscale_write_memory(), xscale_write_phys_memory(), xtensa_dm_trace_data_read(), xtensa_fetch_all_regs(), xtensa_gdb_query_custom(), xtensa_memory_op_validate_range(), xtensa_read_memory(), xtensa_update_instruction(), xtensa_write_memory(), zephyr_array_append(), zephyr_get_arc_state(), and zephyr_get_arm_state().

◆ source

◆ started

bool started

Whether RTT is started.

Definition at line 36 of file rtt/rtt.c.

◆ target

struct target* target

Definition at line 26 of file rtt/rtt.c.

Referenced by __attribute__(), aarch64_halt_smp(), aarch64_prepare_halt_smp(), aarch64_resume(), aarch64_step_restart_smp(), aice_init_targets(), aice_scan_jtag_chain(), append_to_list_all_targets(), arm_build_reg_cache(), arm_init_arch_info(), armv7a_init_arch_info(), armv7m_build_reg_cache(), armv8_build_reg_cache(), armv8_init_arch_info(), at91sam7_read_part_info(), avr32_build_reg_cache(), COMMAND_HANDLER(), COMMAND_HELPER(), dsp563xx_build_reg_cache(), esirisc_target_create(), esp_xtensa_smp_update_halt_gdb(), find_target(), FLASH_BANK_COMMAND_HANDLER(), gdb_connection_closed(), gdb_handle_vcont_packet(), gdb_input_inner(), gdb_new_connection(), gdb_signal_reply(), gdb_target_start(), get_cortex_a(), get_current_target(), get_dm(), get_halted_esp_xtensa_smp(), get_mips_m4k(), get_target(), get_target_by_num(), get_target_with_common_rtos_type(), handle_target(), hwthread_find_thread(), hwthread_update_threads(), image_open(), jim_arc_add_reg(), jim_arc_add_reg_type_flags(), jim_arc_add_reg_type_struct(), jim_arc_get_aux_reg(), jim_arc_get_core_reg(), jim_arc_set_aux_reg(), kinetis_check_run_mode(), mips32_build_reg_cache(), mips64_build_reg_cache(), nds32_build_reg_cache(), nds32_init_arch_info(), or1k_build_reg_cache(), or1k_init_target(), os_alloc(), riscv_batch_alloc(), riscv_init_registers(), riscv_program_init(), rtt_register_source(), scans_new(), sim3x_erase_page(), sim3x_flash_erase(), sim3x_flash_protect(), sim3x_flash_write(), sim3x_init(), stm8_build_reg_cache(), target_configure(), target_create(), target_examine(), target_handle_event(), target_init(), target_process_reset(), target_quit(), update_halt_gdb(), xscale_build_reg_cache(), and xtensa_init_arch_info().