OpenOCD
|
Support functions to access arbitrary bits in a byte array. More...
Go to the source code of this file.
Data Structures | |
struct | bit_copy_queue |
struct | bit_copy_queue_entry |
Functions | |
static void | bit_copy (uint8_t *dst, unsigned dst_offset, const uint8_t *src, unsigned src_offset, unsigned bit_count) |
void | bit_copy_discard (struct bit_copy_queue *q) |
void | bit_copy_execute (struct bit_copy_queue *q) |
void | bit_copy_queue_init (struct bit_copy_queue *q) |
int | bit_copy_queued (struct bit_copy_queue *q, uint8_t *dst, unsigned dst_offset, const uint8_t *src, unsigned src_offset, unsigned bit_count) |
bool | buf_cmp (const void *buf1, const void *buf2, unsigned size) |
bool | buf_cmp_mask (const void *buf1, const void *buf2, const void *mask, unsigned size) |
void * | buf_cpy (const void *from, void *to, unsigned size) |
Copies size bits out of from and into to . More... | |
static uint32_t | buf_get_u32 (const uint8_t *_buffer, unsigned first, unsigned num) |
Retrieves num bits from _buffer , starting at the first bit, returning the bits in a 32-bit word. More... | |
static uint64_t | buf_get_u64 (const uint8_t *_buffer, unsigned first, unsigned num) |
Retrieves num bits from _buffer , starting at the first bit, returning the bits in a 64-bit word. More... | |
void * | buf_set_buf (const void *src, unsigned src_start, void *dst, unsigned dst_start, unsigned len) |
void * | buf_set_ones (void *buf, unsigned size) |
Set the contents of buf with count bits, all set to 1. More... | |
static void | buf_set_u32 (uint8_t *_buffer, unsigned first, unsigned num, uint32_t value) |
Sets num bits in _buffer , starting at the first bit, using the bits in value . More... | |
static void | buf_set_u64 (uint8_t *_buffer, unsigned first, unsigned num, uint64_t value) |
Sets num bits in _buffer , starting at the first bit, using the bits in value . More... | |
char * | buf_to_hex_str (const void *buf, unsigned size) |
void | buffer_shr (void *_buf, unsigned buf_len, unsigned count) |
static uint32_t | fast_target_buffer_get_u32 (const void *p, bool le) |
uint32_t | flip_u32 (uint32_t value, unsigned width) |
Inverts the ordering of bits inside a 32-bit word (e.g. More... | |
size_t | hexify (char *hex, const uint8_t *bin, size_t count, size_t out_maxlen) |
Convert binary data into a string of hexadecimal pairs. More... | |
int | str_to_buf (const char *str, unsigned len, void *bin_buf, unsigned buf_size, unsigned radix) |
size_t | unhexify (uint8_t *bin, const char *hex, size_t count) |
Convert a string of hexadecimal pairs into its binary representation. More... | |
Support functions to access arbitrary bits in a byte array.
Definition in file binarybuffer.h.
|
inlinestatic |
Definition at line 201 of file binarybuffer.h.
References buf_set_buf().
Referenced by bit_copy_execute(), buffer_write(), cmsis_dap_add_jtag_sequence(), cmsis_dap_cmd_dap_swj_sequence(), cmsis_dap_execute_scan(), cmsis_dap_flush(), ftdi_execute_scan(), jlink_execute_scan(), jlink_queue_data_out(), mpsse_clock_tms_cs(), xds110_flush(), and xds110_queue_scan().
void bit_copy_discard | ( | struct bit_copy_queue * | q | ) |
Definition at line 332 of file binarybuffer.c.
References bit_copy_queue_entry::list, bit_copy_queue::list, list_del(), and list_for_each_entry_safe.
Referenced by mpsse_close(), mpsse_flush(), and mpsse_purge().
void bit_copy_execute | ( | struct bit_copy_queue * | q | ) |
Definition at line 321 of file binarybuffer.c.
References bit_copy(), bit_copy_queue_entry::bit_count, bit_copy_queue_entry::dst, bit_copy_queue_entry::dst_offset, bit_copy_queue_entry::list, bit_copy_queue::list, list_del(), list_for_each_entry_safe, bit_copy_queue_entry::src, and bit_copy_queue_entry::src_offset.
Referenced by mpsse_flush().
void bit_copy_queue_init | ( | struct bit_copy_queue * | q | ) |
Definition at line 299 of file binarybuffer.c.
References INIT_LIST_HEAD(), and bit_copy_queue::list.
Referenced by mpsse_open().
int bit_copy_queued | ( | struct bit_copy_queue * | q, |
uint8_t * | dst, | ||
unsigned | dst_offset, | ||
const uint8_t * | src, | ||
unsigned | src_offset, | ||
unsigned | bit_count | ||
) |
Definition at line 304 of file binarybuffer.c.
References bit_copy_queue_entry::bit_count, bit_copy_queue_entry::dst, bit_copy_queue_entry::dst_offset, ERROR_FAIL, ERROR_OK, bit_copy_queue_entry::list, bit_copy_queue::list, list_add_tail(), bit_copy_queue_entry::src, and bit_copy_queue_entry::src_offset.
Referenced by buffer_add_read().
bool buf_cmp | ( | const void * | buf1, |
const void * | buf2, | ||
unsigned | size | ||
) |
Definition at line 70 of file binarybuffer.c.
References buf_cmp_trailing(), and size.
Referenced by jtag_check_value_inner().
bool buf_cmp_mask | ( | const void * | buf1, |
const void * | buf2, | ||
const void * | mask, | ||
unsigned | size | ||
) |
Definition at line 87 of file binarybuffer.c.
References buf_cmp_masked(), buf_cmp_trailing(), mask, and size.
Referenced by jtag_check_value_inner(), and svf_check_tdo().
void* buf_cpy | ( | const void * | from, |
void * | to, | ||
unsigned | size | ||
) |
Copies size
bits out of from
and into to
.
Any extra bits in the final byte will be set to zero.
from | The buffer to copy into to . |
to | The buffer that will receive the copy of from . |
size | The number of bits to copy. |
Definition at line 43 of file binarybuffer.c.
References DIV_ROUND_UP, NULL, and size.
Referenced by armv7m_read_core_reg(), armv7m_set_core_reg(), armv7m_write_core_reg(), cortex_m_fast_read_all_regs(), esirisc_read_memory(), interface_add_tms_seq(), interface_jtag_add_ir_scan(), jtag_add_plain_scan(), jtag_read_buffer(), jtag_scan_field_clone(), riscv_run_algorithm(), rtos_generic_stack_read(), xscale_get_reg(), xtensa_canonical_to_windowbase_offset(), xtensa_fetch_all_regs(), zephyr_get_arc_state(), and zephyr_get_arm_state().
|
inlinestatic |
Retrieves num
bits from _buffer
, starting at the first
bit, returning the bits in a 32-bit word.
This routine fast-paths reads of little-endian, byte-aligned, 32-bit words.
_buffer | The buffer whose bits will be read. |
first | The bit offset in _buffer to start reading (0-31). |
num | The number of bits from _buffer to read (1-32). |
_buffer
. Definition at line 98 of file binarybuffer.h.
References buffer.
Referenced by adapter_debug_entry(), adapter_poll(), adapter_resume(), adapter_step(), aduc702x_write_block(), aducm360_write_block_async(), aducm360_write_block_sync(), amt_jtagaccel_scan(), arc_jtag_enque_write_ir(), arc_jtag_read_memory(), arc_jtag_read_registers(), arc_jtag_status(), arc_reg_get_field(), arc_step(), arm11_add_ir(), arm11_nextpc(), arm720t_soft_reset_halt(), arm7_9_bulk_write_memory(), arm7_9_debug_entry(), arm7_9_enable_eice_step(), arm7_9_execute_sys_speed(), arm7_9_full_context(), arm7_9_handle_target_request(), arm7_9_poll(), arm7_9_read_core_reg(), arm7_9_read_memory(), arm7_9_restore_context(), arm7_9_resume(), arm7_9_soft_reset_halt(), arm7_9_step(), arm7_9_write_core_reg(), arm7_9_write_memory(), arm7tdmi_branch_resume_thumb(), arm920t_soft_reset_halt(), arm926ejs_cp15_read(), arm926ejs_cp15_write(), arm926ejs_examine_debug_reason(), arm926ejs_soft_reset_halt(), arm9tdmi_branch_resume_thumb(), arm_arch_state(), arm_blank_check_memory(), arm_checksum_memory(), arm_dpm_modeswitch(), arm_jtag_set_instr(), arm_semihosting(), armjtagew_get_status(), armjtagew_speed(), armjtagew_tap_execute(), armv4_5_get_cpsr(), armv4_5_get_reg(), armv4_5_get_reg_mode(), armv4_5_run_algorithm_completion(), armv4_5_run_algorithm_inner(), armv7m_arch_state(), armv7m_checksum_memory(), armv7m_start_algorithm(), armv7m_wait_algorithm(), armv7m_write_core_reg(), armv8_aarch64_state(), armv8_dpm_modeswitch(), avr32_ap7k_resume(), avr32_jtag_mwa_read_data(), avr32_jtag_mwa_set_address(), avr32_jtag_mwa_write_data(), avr32_jtag_nexus_read_data(), avr32_jtag_nexus_set_address(), avr32_jtag_nexus_write_data(), avr32_jtag_set_instr(), avr32_write_core_reg(), bitbang_swd_read_reg(), bitbang_swd_write_reg(), bluenrgx_write(), calcaddr_physfromlin(), cc3220sf_write(), cfi_intel_write_block(), cfi_spansion_write_block(), cfi_spansion_write_block_mips(), COMMAND_HANDLER(), cortex_a_internal_restore(), cortex_a_step(), cortex_m_debug_entry(), cortex_m_dwt_set_reg(), cortex_m_resume(), cortex_m_step(), dbus_scan(), dmi_scan(), dpm_write_pc_core_state(), dpm_write_reg(), dpm_write_reg_u64(), dsp563xx_read_memory(), dsp563xx_read_memory_core(), dsp563xx_run_algorithm(), dsp563xx_write_core_reg(), dsp563xx_write_memory(), dtmcontrol_scan(), dtmcontrol_scan_via_bscan(), efm32x_write_block(), em357_write_block(), embeddedice_build_reg_cache(), embeddedice_handshake(), embeddedice_set_reg_w_exec(), embeddedice_store_reg(), esirisc_arch_state(), esirisc_debug_entry(), esirisc_jtag_set_instr(), esirisc_resume_or_step(), esirisc_trace_buf_get_u32(), esirisc_write_csr(), esirisc_write_memory(), esirisc_write_reg(), esp_xtensa_semihosting(), etb_getbuf(), etb_init(), etb_read_trace(), etb_set_instr(), etb_set_reg_w_exec(), etb_status(), etm_build_reg_cache(), etm_set_reg_w_exec(), etm_setup(), etm_store_reg(), feroceon_branch_resume_thumb(), feroceon_bulk_write_memory(), fm3_write_block(), fm4_flash_erase(), fm4_flash_write(), ftdi_swd_run_queue(), get_tapstatus(), gw16012_scan(), halt_prep(), idcode_scan(), ipdbg_shift_data(), ipdbg_shift_instr(), jlink_swd_run_queue(), jtag_examine_chain(), jtag_examine_chain_end(), kinetis_ke_write_words(), kinetis_write_block(), lakemont_arch_state(), lakemont_get_core_reg(), lakemont_poll(), lakemont_resume(), lakemont_step(), log_dap_cmd(), lpc2000_write(), ls1_sap_set_instr(), mdr_write_block(), mips32_arch_state(), mips32_blank_check_memory(), mips32_checksum_memory(), mips32_pracc_queue_exec(), mips32_run_algorithm(), mips32_run_and_wait(), mips32_set_core_reg(), mips32_write_core_reg(), mips_ejtag_drscan_32(), mips_ejtag_set_instr(), mips_m4k_debug_entry(), mips_m4k_internal_restore(), mips_m4k_step(), nds32_get_core_reg(), nds32_get_mapped_reg(), nds32_restore_context(), nds32_set_core_reg(), niietcm4_write_block(), nulink_usb_write_mem32(), nulink_usb_write_mem8(), or1k_resume_or_step(), or1k_write_core_reg(), osbdm_swap(), pic32mx_write_block(), post_result(), qspi_read_write_block(), qspi_verify(), read_hw_reg(), read_mem(), read_rtt_channel(), riscv_address_translate(), riscv_batch_get_dmi_read_data(), riscv_batch_get_dmi_read_op(), riscv_checksum_memory(), rp2040_call_rom_func(), rsl10_ll_flash_erase(), rsl10_ll_flash_write(), rsl10_mass_erase(), scans_get_u32(), set_debug_regs(), sim3x_write_block(), stlink_usb_xfer_v1_get_status(), stm32x_write_block(), stm32x_write_block_async(), stm32x_write_block_riscv(), stm8_arch_state(), stm8_debug_entry(), stm8_resume(), stm8_run_algorithm(), stm8_run_and_wait(), stm8_set_core_reg(), stm8_step(), stm8_write_core_reg(), str7x_write_block(), str9x_write_block(), str9xpec_blank_check(), str9xpec_protect_check(), str9xpec_set_instr(), str9xpec_write(), target_profiling_default(), target_rtt_read_control_block(), unset_debug_regs(), virtex2_set_instr(), write_hw_reg(), write_hw_reg_from_cache(), write_mem(), x86_32_common_read_io(), x86_32_common_virt2phys(), x86_32_common_write_io(), x86_32_get_gdb_reg_list(), xlnx_pcie_xvc_execute_scan(), xlnx_pcie_xvc_execute_tms(), xlnx_pcie_xvc_swd_sequence(), xscale_debug_entry(), xscale_disable_mmu_caches(), xscale_enable_mmu_caches(), xscale_enable_single_step(), xscale_get_ttb(), xscale_getbuf(), xscale_jtag_set_instr(), xscale_read_memory(), xscale_read_trace(), xscale_receive(), xscale_restore_banked(), xscale_resume(), xscale_set_reg(), xscale_set_watchpoint(), xscale_step(), xscale_step_inner(), xscale_unset_watchpoint(), xscale_write_memory(), xtensa_canonical_to_windowbase_offset(), xtensa_dm_core_status_read(), xtensa_dm_device_id_read(), xtensa_dm_perfmon_dump(), xtensa_dm_power_status_read(), xtensa_dm_trace_config_read(), xtensa_dm_trace_status_read(), xtensa_dm_trace_stop(), xtensa_fetch_all_regs(), xtensa_pc_in_winexc(), xtensa_reg_get_value(), xtensa_smpbreak_read(), xtensa_window_state_save(), xtensa_write_dirty_registers(), and xtensa_write_memory().
|
inlinestatic |
Retrieves num
bits from _buffer
, starting at the first
bit, returning the bits in a 64-bit word.
This routine fast-paths reads of little-endian, byte-aligned, 64-bit words.
_buffer | The buffer whose bits will be read. |
first | The bit offset in _buffer to start reading (0-63). |
num | The number of bits from _buffer to read (1-64). |
_buffer
. Definition at line 127 of file binarybuffer.h.
References buffer.
Referenced by aarch64_restore_one(), arm_semihosting(), armv7m_read_core_reg(), armv7m_write_core_reg(), armv8_aarch64_state(), dbus_scan(), dpmv8_write_reg(), dump_field(), execute_resume(), fespi_write(), jtag_validate_ircapture(), mips64_arch_state(), mips64_set_core_reg(), mips64_write_core_reg(), mips_ejtag_drscan_64(), mips_mips64_debug_entry(), mips_mips64_resume(), mips_mips64_step(), nds32_restore_context(), post_result(), reg_cache_get(), register_set(), riscv013_set_register_buf(), riscv_address_translate(), riscv_get_register(), riscv_run_algorithm(), scans_get_u64(), write_memory_abstract(), write_memory_bus_v0(), and write_memory_progbuf().
void* buf_set_buf | ( | const void * | src, |
unsigned | src_start, | ||
void * | dst, | ||
unsigned | dst_start, | ||
unsigned | len | ||
) |
Definition at line 121 of file binarybuffer.c.
Referenced by armjtagew_tap_execute(), bit_copy(), buspirate_tap_execute(), esirisc_jtag_recv(), jlink_clock_data(), jlink_flush(), jtag_build_buffer(), jtag_read_buffer(), opendous_tap_execute(), osbdm_add_tms(), osbdm_flush(), and vsllink_jtag_execute().
void* buf_set_ones | ( | void * | buf, |
unsigned | size | ||
) |
Set the contents of buf
with count
bits, all set to 1.
buf | The buffer to fill with ones. |
size | The number of bits. |
buf
). Definition at line 106 of file binarybuffer.c.
Referenced by interface_jtag_add_ir_scan(), jtag_reset_callback(), jtag_tap_init(), and jtag_validate_ircapture().
|
inlinestatic |
Sets num
bits in _buffer
, starting at the first
bit, using the bits in value
.
This routine fast-paths writes of little-endian, byte-aligned, 32-bit words.
_buffer | The buffer whose bits will be set. Do not use uninitialized buffer or clang static analyzer emits a warning. |
first | The bit offset in _buffer to start writing (0-31). |
num | The number of bits from value to copy (1-32). |
value | Up to 32 bits that will be copied to _buffer. |
Definition at line 30 of file binarybuffer.h.
References buffer.
Referenced by aarch64_set_breakpoint(), adapter_resume(), adapter_step(), adi_jtag_dp_scan_cmd(), adi_jtag_dp_scan_u32(), aduc702x_write_block(), aducm360_write_block_async(), aducm360_write_block_sync(), amt_jtagaccel_scan(), arc_jtag_enque_set_transaction(), arc_jtag_enque_write_dr(), arc_jtag_enque_write_ir(), arc_set_register_value(), arc_step(), arm11_nextpc(), arm720t_scan_cp15(), arm720t_soft_reset_halt(), arm7_9_bulk_write_memory(), arm7_9_clear_halt(), arm7_9_debug_entry(), arm7_9_execute_fast_sys_speed(), arm7_9_full_context(), arm7_9_halt(), arm7_9_read_core_reg(), arm7_9_resume(), arm7_9_setup_semihosting(), arm7_9_soft_reset_halt(), arm7_9_step(), arm7_9_write_memory(), arm7tdmi_clock_out_inner(), arm920t_execute_cp15(), arm920t_soft_reset_halt(), arm920t_write_cp15_physical(), arm926ejs_cp15_read(), arm926ejs_cp15_write(), arm926ejs_soft_reset_halt(), arm946e_write_cp15(), arm966e_write_cp15(), arm9tdmi_clock_out(), arm9tdmi_disable_single_step(), arm9tdmi_enable_single_step(), arm_blank_check_memory(), arm_checksum_memory(), arm_dpm_read_reg(), arm_jtag_scann_inner(), arm_jtag_set_instr_inner(), arm_nandread(), arm_nandwrite(), arm_set_cpsr(), armjtagew_speed(), armjtagew_tap_execute(), armv4_5_run_algorithm_inner(), armv4_5_set_reg(), armv4_5_set_reg_mode(), armv7m_blank_check_memory(), armv7m_checksum_memory(), armv7m_read_core_reg(), armv7m_start_algorithm(), armv7m_wait_algorithm(), armv8_set_cpsr(), avr32_jtag_mwa_set_address(), avr32_jtag_mwa_write_data(), avr32_jtag_nexus_set_address(), avr32_jtag_nexus_write_data(), avr32_jtag_set_instr(), avr32_read_core_reg(), bitbang_swd_write_reg(), bluenrgx_write(), buspirate_swd_write_reg(), cc26xx_erase(), cc26xx_mass_erase(), cc26xx_write(), cc3220sf_write(), cfi_intel_write_block(), cfi_spansion_write_block(), cfi_spansion_write_block_mips(), COMMAND_HANDLER(), cortex_a_internal_restore(), cortex_a_set_breakpoint(), cortex_a_step(), cortex_m_dwt_get_reg(), cortex_m_fast_read_all_regs(), cortex_m_resume(), cortex_m_set_breakpoint(), cortex_m_step(), dmi_scan(), dpm_read_reg_u64(), dsp563xx_read_core_reg(), dsp563xx_read_memory(), dsp563xx_run_algorithm(), dsp563xx_write_memory(), dtmcontrol_scan(), dtmcontrol_scan_via_bscan(), efm32x_write_block(), em357_write_block(), embeddedice_send(), embeddedice_set_reg(), embeddedice_setup(), embeddedice_write_reg_inner(), esirisc_jtag_set_instr(), esirisc_read_csr(), esirisc_read_reg(), esirisc_resume_or_step(), esp32_queue_tdi_idle(), etb_read_ram(), etb_read_reg_w_check(), etb_scann(), etb_set_instr(), etb_set_reg(), etb_write_reg(), etm_read_reg_w_check(), etm_set_reg(), etm_setup(), etm_write_reg(), feroceon_bulk_write_memory(), feroceon_dummy_clock_out(), feroceon_set_dbgrq(), fill_buffer(), FLASH_BANK_COMMAND_HANDLER(), fm3_chip_erase(), fm3_erase(), fm3_write_block(), fm4_flash_erase(), fm4_flash_write(), ftdi_execute_pathmove(), ftdi_swd_queue_cmd(), gdb_read_smp_packet(), gw16012_scan(), ipdbg_shift_data(), ipdbg_shift_instr(), ipdbg_shift_vir(), jtag_examine_chain_execute(), jtag_tap_init(), jtag_vpi_path_move(), jtagspi_set_ir(), kinetis_disable_wdog_algo(), kinetis_ke_write_words(), kinetis_write_block(), lakemont_poll(), lakemont_resume(), lakemont_step(), lpc2000_iap_call(), lpc2000_write(), lpc2900_write(), lpcspifi_erase(), lpcspifi_set_hw_mode(), lpcspifi_write(), ls1_sap_set_addr_high(), ls1_sap_set_instr(), max32xxx_write_block(), mdr_read(), mdr_write_block(), mips32_blank_check_memory(), mips32_checksum_memory(), mips32_read_core_reg(), mips32_run_algorithm(), mips32_set_core_reg(), mips_ejtag_add_scan_96(), mips_ejtag_drscan_32_queued(), mips_ejtag_fastdata_scan(), mips_ejtag_set_instr(), mips_m4k_internal_restore(), mips_m4k_step(), mrvlqspi_flash_write(), msp432_erase(), msp432_exec_cmd(), msp432_init(), msp432_init_params(), msp432_mass_erase(), msp432_write(), nds32_arch_state(), nds32_get_core_reg(), nds32_set_core_reg(), nds32_set_mapped_reg(), niietcm4_write_block(), nrf5_ll_flash_write(), numicro_writeblock(), or1k_read_core_reg(), or1k_resume_or_step(), or1k_tap_vjtag_init(), osbdm_add_pathmove(), osbdm_add_scan(), osbdm_add_statemove(), osbdm_swap(), pic32mx_write_block(), post_result(), psoc4_sysreq(), qspi_read_write_block(), qspi_verify(), read_hw_reg(), read_memory_bus_v0(), read_memory_bus_v1(), read_memory_bus_word(), riscv_add_breakpoint(), rp2040_call_rom_func(), rsl10_ll_flash_erase(), rsl10_ll_flash_write(), rsl10_mass_erase(), same5_modify_user_row(), same5_protect(), set_debug_regs(), sh_qspi_read(), sh_qspi_write(), sim3x_write_block(), sromalgo_prepare(), stellaris_write_block(), stlink_usb_set_cbw_transfer_datalength(), stlink_usb_xfer_v1_create_cmd(), stm32l4_write_block(), stm32lx_write_half_pages(), stm32x_write_block(), stm32x_write_block_async(), stm32x_write_block_riscv(), stm8_blank_check_memory(), stm8_read_core_reg(), stm8_resume(), stm8_run_algorithm(), stm8_set_core_reg(), stm8_step(), stmqspi_blank_check(), str7x_write_block(), str9x_write_block(), str9xpec_blank_check(), str9xpec_erase_area(), str9xpec_protect(), str9xpec_set_instr(), str9xpec_write_options(), ulink_queue_pathmove(), unset_debug_regs(), vdebug_jtag_path_move(), vdebug_socket_open(), virtex2_send_32(), virtex2_set_instr(), write_hw_reg(), xlnx_pcie_xvc_execute_scan(), xmc1xxx_erase(), xmc1xxx_erase_check(), xmc1xxx_write(), xscale_assert_reset(), xscale_deassert_reset(), xscale_debug_entry(), xscale_full_context(), xscale_invalidate_ic_line(), xscale_jtag_set_instr(), xscale_load_ic(), xscale_read_dcsr(), xscale_resume(), xscale_send(), xscale_send_u32(), xscale_set_reg(), xscale_set_reg_u32(), xscale_step(), xscale_write_dcsr(), xscale_write_dcsr_sw(), xtensa_dm_add_set_ir(), and xtensa_reg_set_value().
|
inlinestatic |
Sets num
bits in _buffer
, starting at the first
bit, using the bits in value
.
This routine fast-paths writes of little-endian, byte-aligned, 64-bit words.
_buffer | The buffer whose bits will be set. Do not use uninitialized buffer or clang static analyzer emits a warning. |
first | The bit offset in _buffer to start writing (0-63). |
num | The number of bits from value to copy (1-64). |
value | Up to 64 bits that will be copied to _buffer. |
Definition at line 60 of file binarybuffer.h.
References buffer.
Referenced by aarch64_restore_one(), add_dbus_scan(), COMMAND_HANDLER(), dbus_scan(), dpmv8_read_reg(), fespi_write(), ls1_sap_memory_cmd(), mips64_ejtag_fastdata_scan(), mips64_read_core_reg(), mips64_set_core_reg(), mips_ejtag_drscan_64(), mips_mips64_resume(), mips_mips64_step(), nds32_get_core_reg_64(), post_result(), read_memory_abstract(), read_memory_progbuf(), read_memory_progbuf_inner(), read_memory_progbuf_one(), reg_cache_set(), register_get(), register_read(), register_write_direct(), riscv013_fill_dmi_nop_u64(), riscv013_fill_dmi_read_u64(), riscv013_fill_dmi_write_u64(), riscv013_get_register_buf(), riscv_checksum_memory(), riscv_run_algorithm(), riscv_set_register(), sample_memory_bus_v1(), and submit_pir().
char* buf_to_hex_str | ( | const void * | buf, |
unsigned | size | ||
) |
Definition at line 192 of file binarybuffer.c.
References DIV_ROUND_UP, and hex_digits.
Referenced by COMMAND_HANDLER(), default_interface_jtag_execute_queue(), handle_bp_command_list(), jim_command_drscan(), jtag_build_buffer(), jtag_check_value_inner(), jtag_read_buffer(), jtag_validate_ircapture(), jtag_vpi_queue_tdi_xfer(), jtag_vpi_send_cmd(), register_get(), register_set(), and target_jim_get_reg().
void buffer_shr | ( | void * | _buf, |
unsigned | buf_len, | ||
unsigned | count | ||
) |
Definition at line 410 of file binarybuffer.c.
References count.
Referenced by adbg_wb_burst_read(), dmi_scan(), and riscv_batch_run().
|
inlinestatic |
Definition at line 196 of file binarybuffer.h.
References be_to_h_u32(), and le_to_h_u32().
Referenced by arm7_9_dcc_completion(), and embeddedice_write_dcc().
uint32_t flip_u32 | ( | uint32_t | value, |
unsigned | width | ||
) |
Inverts the ordering of bits inside a 32-bit word (e.g.
31..0 -> 0..31). This routine can be used to flip smaller data types by using smaller values for width
.
value | The word to flip. |
width | The number of bits in value (2-32). |
value
in reversed bit-order. size_t hexify | ( | char * | hex, |
const uint8_t * | bin, | ||
size_t | count, | ||
size_t | length | ||
) |
Convert binary data into a string of hexadecimal pairs.
[out] | hex | Buffer to store string of hexadecimal pairs. The buffer size must be at least length . |
[in] | bin | Buffer with binary data to convert into hexadecimal pairs. |
[in] | count | Number of bytes to convert. |
[in] | length | Maximum number of characters, including null-terminator, to store into hex . |
Definition at line 392 of file binarybuffer.c.
References count, hex_digits, and length.
Referenced by COMMAND_HANDLER(), gdb_output_con(), gdb_query_packet(), gdb_read_memory_packet(), gdb_read_smp_packet(), icdi_send_remote_cmd(), icdi_usb_write_reg(), linux_thread_extra_info(), rtos_put_gdb_reg_list(), rtos_qsymbol(), rtos_thread_packet(), and tcl_target_callback_trace_handler().
int str_to_buf | ( | const char * | str, |
unsigned | len, | ||
void * | bin_buf, | ||
unsigned | buf_size, | ||
unsigned | radix | ||
) |
Definition at line 233 of file binarybuffer.c.
References ceil_f_to_u32(), DIV_ROUND_UP, str_radix_guess(), and strndup().
Referenced by COMMAND_HANDLER(), jim_command_drscan(), and target_jim_set_reg().
size_t unhexify | ( | uint8_t * | bin, |
const char * | hex, | ||
size_t | count | ||
) |
Convert a string of hexadecimal pairs into its binary representation.
[out] | bin | Buffer to store binary representation. The buffer size must be at least count . |
[in] | hex | String with hexadecimal pairs to convert into its binary representation. |
[in] | count | Number of hexadecimal pairs to convert. |
Definition at line 354 of file binarybuffer.c.
References count.
Referenced by COMMAND_HANDLER(), gdb_query_packet(), gdb_write_memory_packet(), icdi_get_cmd_result(), icdi_usb_read_reg(), icdi_usb_version(), next_hex_encoded_field(), nuttx_thread_packet(), and rtos_qsymbol().