OpenOCD
bitbang.c File Reference
Include dependency graph for bitbang.c:

Go to the source code of this file.

Macros

#define CLOCK_IDLE()   0
 

Functions

static void bitbang_end_state (tap_state_t state)
 
int bitbang_execute_queue (void)
 
static int bitbang_execute_tms (struct jtag_command *cmd)
 Clock a bunch of TMS (or SWDIO) transitions, to change the JTAG (or SWD) state machine. More...
 
static int bitbang_path_move (struct pathmove_command *cmd)
 
static int bitbang_runtest (int num_cycles)
 
static int bitbang_scan (bool ir_scan, enum scan_type type, uint8_t *buffer, unsigned scan_size)
 
static int bitbang_stableclocks (int num_cycles)
 Function bitbang_stableclocks issues a number of clock cycles while staying in a stable state. More...
 
static int bitbang_state_move (int skip)
 
static void bitbang_swd_exchange (bool rnw, uint8_t buf[], unsigned int offset, unsigned int bit_cnt)
 
static int bitbang_swd_init (void)
 
static void bitbang_swd_read_reg (uint8_t cmd, uint32_t *value, uint32_t ap_delay_clk)
 
static int bitbang_swd_run_queue (void)
 
static int bitbang_swd_switch_seq (enum swd_special_seq seq)
 
static void bitbang_swd_write_reg (uint8_t cmd, uint32_t value, uint32_t ap_delay_clk)
 
static void swd_clear_sticky_errors (void)
 

Variables

struct bitbang_interfacebitbang_interface
 
const struct swd_driver bitbang_swd
 
static int queued_retval
 

Macro Definition Documentation

◆ CLOCK_IDLE

#define CLOCK_IDLE ( )    0

Definition at line 54 of file bitbang.c.

Function Documentation

◆ bitbang_end_state()

static void bitbang_end_state ( tap_state_t  state)
static

Definition at line 57 of file bitbang.c.

References state, tap_is_state_stable(), and tap_set_end_state().

Referenced by bitbang_execute_queue(), bitbang_runtest(), and bitbang_scan().

◆ bitbang_execute_queue()

◆ bitbang_execute_tms()

static int bitbang_execute_tms ( struct jtag_command cmd)
static

Clock a bunch of TMS (or SWDIO) transitions, to change the JTAG (or SWD) state machine.

Definition at line 87 of file bitbang.c.

References bits, CLOCK_IDLE, cmd, ERROR_FAIL, ERROR_OK, LOG_DEBUG_IO, and bitbang_interface::write.

Referenced by bitbang_execute_queue().

◆ bitbang_path_move()

static int bitbang_path_move ( struct pathmove_command cmd)
static

◆ bitbang_runtest()

static int bitbang_runtest ( int  num_cycles)
static

◆ bitbang_scan()

◆ bitbang_stableclocks()

static int bitbang_stableclocks ( int  num_cycles)
static

Function bitbang_stableclocks issues a number of clock cycles while staying in a stable state.

Because the TMS value required to stay in the RESET state is a 1, whereas the TMS value required to stay in any of the other stable states is a 0, this function checks the current stable state to decide on the value of TMS to use.

Definition at line 176 of file bitbang.c.

References ERROR_FAIL, ERROR_OK, tap_get_state(), TAP_RESET, and bitbang_interface::write.

Referenced by bitbang_execute_queue().

◆ bitbang_state_move()

static int bitbang_state_move ( int  skip)
static

◆ bitbang_swd_exchange()

static void bitbang_swd_exchange ( bool  rnw,
uint8_t  buf[],
unsigned int  offset,
unsigned int  bit_cnt 
)
static

◆ bitbang_swd_init()

static int bitbang_swd_init ( void  )
static

Definition at line 375 of file bitbang.c.

References ERROR_OK, and LOG_DEBUG.

◆ bitbang_swd_read_reg()

◆ bitbang_swd_run_queue()

static int bitbang_swd_run_queue ( void  )
static

Definition at line 557 of file bitbang.c.

◆ bitbang_swd_switch_seq()

◆ bitbang_swd_write_reg()

◆ swd_clear_sticky_errors()

static void swd_clear_sticky_errors ( void  )
static

Variable Documentation

◆ bitbang_interface

Definition at line 34 of file bitbang.c.

◆ bitbang_swd

const struct swd_driver bitbang_swd
Initial value:
= {
.switch_seq = bitbang_swd_switch_seq,
.read_reg = bitbang_swd_read_reg,
.write_reg = bitbang_swd_write_reg,
}
static int bitbang_swd_init(void)
Definition: bitbang.c:375
static void bitbang_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay_clk)
Definition: bitbang.c:506
static int bitbang_swd_switch_seq(enum swd_special_seq seq)
Definition: bitbang.c:411
static void bitbang_swd_read_reg(uint8_t cmd, uint32_t *value, uint32_t ap_delay_clk)
Definition: bitbang.c:456
static int bitbang_swd_run_queue(void)
Definition: bitbang.c:557

Definition at line 557 of file bitbang.c.

◆ queued_retval

int queued_retval
static

Definition at line 373 of file bitbang.c.

Referenced by bitbang_swd_read_reg(), and bitbang_swd_write_reg().