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

Go to the source code of this file.

Macros

#define _E   "DSP5680XX_ERROR:%d\nAt:%s:%d:%s"
 
#define CHECK_DBG   if (!dsp5680xx_context.debug_mode_enabled) DEBUG_FAIL
 
#define CHECK_HALT(target)   if (target->state != TARGET_HALTED) HALT_FAIL
 
#define check_halt_and_debug(target)   { CHECK_HALT(target); CHECK_DBG; }
 
#define CMD1   eonce_instruction_exec_single(target, DSP5680XX_ONCE_ORX, 0, 0, 0, NULL);
 
#define CMD2   jtag_data_write16((t, data)
 
#define core_move_at_pr0_inc_to_y0(target)   exe(target, 1, 0x8568, 0, 0)
 
#define core_move_at_pr0_inc_to_y0(target)   exe(target, 1, 0x8568, 0, 0)
 
#define core_move_at_pr0_inc_to_y1(target)   exe(target, 1, 0x8768, 0, 0)
 
#define core_move_at_pr2_inc_to_y0(target)   exe(target, 1, 0x856A, 0, 0)
 
#define core_move_at_r0_inc_to_y0(target)   exe(target, 1, 0xf500, 0, 0)
 
#define core_move_at_r0_to_y0(target)   exe(target, 1, 0xF514, 0, 0)
 
#define core_move_at_r0_to_y1(target)   exe(target, 1, 0xF714, 0, 0)
 
#define core_move_at_r0_y0(target)   exe(target, 1, 0xF514, 0, 0)
 
#define core_move_at_r2_disp_to_y0(target, disp)   exe(target, 2, 0xF542, disp, 0)
 
#define core_move_at_r2_to_y0(target)   exe(target, 1, 0xF516, 0, 0)
 
#define core_move_byte_y0_at_r0(target)   exe(target, 1, 0xd5a0, 0, 0)
 
#define core_move_long_at_r0_y(target)   exe(target, 1, 0xF734, 0, 0)
 
#define core_move_long_to_n(target, value)   exe(target, 3, 0xe41e, value&0xffff, value>>16)
 
#define core_move_long_to_r0(target, value)   exe(target, 3, 0xe418, value&0xffff, value>>16)
 
#define core_move_long_to_r1(target, value)   exe(target, 3, 0xE419, value&0xffff, value>>16)
 
#define core_move_long_to_r2(target, value)   exe(target, 3, 0xe41A, value&0xffff, value>>16)
 
#define core_move_long_to_r3(target, value)   exe(target, 3, 0xE41B, value&0xffff, value>>16)
 
#define core_move_long_to_r4(target, value)   exe(target, 3, 0xE41C, value&0xffff, value>>16)
 
#define core_move_long_to_y(target, value)   exe(target, 3, 0xe417, value&0xffff, value>>16)
 
#define core_move_pc_to_r4(target)   exe(target, 1, 0xE716, 0, 0)
 
#define core_move_r4_to_y(target)   exe(target, 1, 0xe764, 0, 0)
 
#define core_move_value_at_r0(target, value)   exe(target, 2, 0x8640, value, 0)
 
#define core_move_value_at_r2(target, value)   exe(target, 2, 0x8642, value, 0)
 
#define core_move_value_at_r2_disp(target, value, disp)   exe(target, 3, 0x8646, value, disp)
 
#define core_move_value_to_y0(target, value)   exe(target, 2, 0x8745, value, 0)
 
#define core_move_y0_at_pr0_inc(target)   exe(target, 1, 0x8560, 0, 0)
 
#define core_move_y0_at_pr3_inc(target)   exe(target, 1, 0x8563, 0, 0)
 
#define core_move_y0_at_r0(target)   exe(target, 1, 0xd514, 0, 0)
 
#define core_move_y0_at_r0_inc(target)   exe(target, 1, 0xd500, 0, 0)
 
#define core_move_y0_at_r2(target)   exe(target, 1, 0xd516, 0, 0)
 
#define core_move_y0_at_r3(target)   exe(target, 1, 0xD503, 0, 0)
 
#define core_move_y1_at_pr0_inc(target)   exe(target, 1, 0x8760, 0, 0)
 
#define core_move_y1_at_r0(target)   exe(target, 1, 0xd714, 0, 0)
 
#define core_move_y1_at_r0_inc(target)   exe(target, 1, 0xD700, 0, 0)
 
#define core_move_y1_at_r2(target)   exe(target, 1, 0xd716, 0, 0)
 
#define core_tx_lower_data(t, data)   PT1\ PT2
 
#define DEBUG_FAIL   { err_check(ERROR_FAIL, DSP5680XX_ERROR_NOT_IN_DEBUG, DEBUG_MSG) }
 
#define DEBUG_MSG   "Debug mode be enabled to read mem."
 
#define dsp5680xx_exe_1(target, oc1, oc2, oc3)   dsp5680xx_exe1(target, oc1)
 
#define dsp5680xx_exe_2(target, oc1, oc2, oc3)   dsp5680xx_exe2(target, oc1, oc2)
 
#define dsp5680xx_exe_3(target, oc1, oc2, oc3)   dsp5680xx_exe3(target, oc1, oc2, oc3)
 
#define dsp5680xx_exe_generic(t, words, oc1, oc2, oc3)   dsp5680xx_exe_##words(t, oc1, oc2, oc3)
 
#define eonce_bfclr_at_r0(target, value)   exe(target, 2, 0x8040, value, 0)
 
#define eonce_nop(target)   exe(target, 1, 0xe700, 0, 0)
 
#define err_check(r, c, m)   if (r != ERROR_OK) {LOG_ERROR(_E, c, __func__, __LINE__, m); return r; }
 
#define err_check_propagate(retval)   if (retval != ERROR_OK) return retval;
 
#define exe(a, b, c, d, e)   dsp5680xx_exe_generic(a, b, c, d, e)
 
#define HALT_FAIL   { err_check(ERROR_FAIL, DSP5680XX_ERROR_TARGET_RUNNING, HALT_MSG) }
 
#define HALT_MSG   "Target must be halted."
 
#define jtag_data_read16(target, data_read)   jtag_data_read(target, data_read, 16)
 
#define jtag_data_read32(target, data_read)   jtag_data_read(target, data_read, 32)
 
#define jtag_data_read8(target, data_read)   jtag_data_read(target, data_read, 8)
 
#define jtag_data_write16(target, instr, data_read)   jtag_data_write(target, instr, 16, data_read)
 
#define jtag_data_write24(target, instr, data_read)   jtag_data_write(target, instr, 24, data_read)
 
#define jtag_data_write32(target, instr, data_read)   jtag_data_write(target, instr, 32, data_read)
 
#define jtag_data_write8(target, instr, data_read)   jtag_data_write(target, instr, 8, data_read)
 

Functions

static int core_load_tx_rx_high_addr_to_r0 (struct target *target)
 
static int core_move_value_to_pc (struct target *target, uint32_t value)
 
static int core_rx_lower_data (struct target *target, uint8_t *data_read)
 
static int core_rx_upper_data (struct target *target, uint8_t *data_read)
 
static int core_tx_upper_data (struct target *target, uint16_t data, uint32_t *eonce_status_low)
 
static int dsp5680xx_arch_state (struct target *target)
 
static int dsp5680xx_assert_reset (struct target *target)
 
static int dsp5680xx_checksum_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t *checksum)
 This function is not implemented. More...
 
static int dsp5680xx_convert_address (uint32_t *address, int *pmem)
 The value of address determines if it corresponds to P: (program) or X: (dat) memory. More...
 
static int dsp5680xx_deassert_reset (struct target *target)
 
static int dsp5680xx_drscan (struct target *target, uint8_t *d_in, uint8_t *d_out, int len)
 
static int dsp5680xx_exe1 (struct target *target, uint16_t opcode)
 
static int dsp5680xx_exe2 (struct target *target, uint16_t opcode1, uint16_t opcode2)
 
static int dsp5680xx_exe3 (struct target *target, uint16_t opcode1, uint16_t opcode2, uint16_t opcode3)
 
static int dsp5680xx_execute_queue (void)
 
int dsp5680xx_f_erase (struct target *target, int first, int last)
 Erases either a sector or the complete flash array. More...
 
int dsp5680xx_f_erase_check (struct target *target, uint8_t *erased, uint32_t sector)
 The FM has the functionality of checking if the flash array is erased. More...
 
static int dsp5680xx_f_ex (struct target *target, uint16_t c, uint32_t address, uint32_t data, uint16_t *hfm_ustat, int pmem)
 Executes a command on the FM module. More...
 
int dsp5680xx_f_lock (struct target *target)
 Writes the flash security words with a specific value. More...
 
int dsp5680xx_f_protect_check (struct target *target, uint16_t *protected)
 Reads the memory mapped protection register. More...
 
static int dsp5680xx_f_signature (struct target *target, uint32_t address, uint32_t words, uint16_t *signature)
 Executes the FM calculate signature command. More...
 
static int dsp5680xx_f_sim_reset (struct target *target)
 Resets the SIM. More...
 
int dsp5680xx_f_unlock (struct target *target)
 Executes a mass erase command. More...
 
int dsp5680xx_f_wr (struct target *t, const uint8_t *b, uint32_t a, uint32_t count, int is_flash_lock)
 Writes to flash memory. More...
 
static int dsp5680xx_halt (struct target *target)
 
static int dsp5680xx_init_target (struct command_context *cmd_ctx, struct target *target)
 
static int dsp5680xx_irscan (struct target *target, uint32_t *d_in, uint32_t *d_out, uint8_t ir_len)
 Test func. More...
 
static int dsp5680xx_jtag_status (struct target *target, uint8_t *status)
 
static int dsp5680xx_poll (struct target *target)
 
static int dsp5680xx_read (struct target *t, target_addr_t a, uint32_t size, uint32_t count, uint8_t *buf)
 
static int dsp5680xx_read_16_single (struct target *t, uint32_t a, uint8_t *data_read, int r_pmem)
 
static int dsp5680xx_read_32_single (struct target *t, uint32_t a, uint8_t *data_read, int r_pmem)
 
static int dsp5680xx_read_buffer (struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
 This function is called by verify_image, it is used to read data from memory. More...
 
static int dsp5680xx_read_core_reg (struct target *target, uint8_t reg_addr, uint16_t *data_read)
 
static int dsp5680xx_resume (struct target *target, int current, target_addr_t address, int hb, int d)
 
static int dsp5680xx_soft_reset_halt (struct target *target)
 Halts the core and resets the SIM. More...
 
static int dsp5680xx_step (struct target *target, int current, target_addr_t address, int handle_breakpoints)
 
static int dsp5680xx_target_create (struct target *target, Jim_Interp *interp)
 
static int dsp5680xx_write (struct target *target, target_addr_t a, uint32_t size, uint32_t count, const uint8_t *b)
 Writes buffer to memory. More...
 
static int dsp5680xx_write_16 (struct target *t, uint32_t a, uint32_t c, const uint8_t *d, int pmem)
 
static int dsp5680xx_write_16_single (struct target *t, uint32_t a, uint16_t data, uint8_t w_pmem)
 
static int dsp5680xx_write_32 (struct target *t, uint32_t a, uint32_t c, const uint8_t *d, int pmem)
 
static int dsp5680xx_write_32_single (struct target *t, uint32_t a, uint32_t data, int w_pmem)
 
static int dsp5680xx_write_8 (struct target *t, uint32_t a, uint32_t c, const uint8_t *d, int pmem)
 
static int dsp5680xx_write_buffer (struct target *t, target_addr_t a, uint32_t size, const uint8_t *b)
 
static int eonce_enter_debug_mode (struct target *target, uint16_t *eonce_status)
 Puts the core into debug mode, enabling the EOnCE module. More...
 
static int eonce_enter_debug_mode_without_reset (struct target *target, uint16_t *eonce_status)
 Puts the core into debug mode, enabling the EOnCE module. More...
 
static int eonce_exit_debug_mode (struct target *target, uint8_t *eonce_status)
 Takes the core out of debug mode. More...
 
static int eonce_instruction_exec_single (struct target *target, uint8_t instr, uint8_t rw, uint8_t go, uint8_t ex, uint8_t *eonce_status)
 Executes EOnCE instruction. More...
 
static int eonce_load_tx_rx_to_r0 (struct target *target)
 
static int eonce_pc_store (struct target *target)
 Reads the current value of the program counter and stores it. More...
 
static int eonce_read_status_reg (struct target *target, uint16_t *data)
 
static int erase_sector (struct target *target, int sector, uint16_t *hfm_ustat)
 Executes the FM page erase command. More...
 
static int jtag_data_read (struct target *target, uint8_t *data_read, int num_bits)
 
static int jtag_data_write (struct target *target, uint32_t instr, int num_bits, uint32_t *data_read)
 
static int mass_erase (struct target *target, uint16_t *hfm_ustat)
 Executes the FM mass erase command. More...
 
static int perl_crc (const uint8_t *buff8, uint32_t word_count)
 Calculates a signature over word_count words in the data from buff8. More...
 
static int reset_jtag (void)
 Reset state machine. More...
 
static int set_fm_ck_div (struct target *target)
 Prior to the execution of any Flash module command, the Flash module Clock Divider (CLKDIV) register must be initialized. More...
 
static int switch_tap (struct target *target, struct jtag_tap *master_tap, struct jtag_tap *core_tap)
 

Variables

static uint32_t data_read_dummy
 
static struct dsp5680xx_common dsp5680xx_context
 
struct target_type dsp5680xx_target
 Holds methods for dsp5680xx targets. More...
 
static const uint16_t pgm_write_pflash []
 
static const uint32_t pgm_write_pflash_length = 31
 

Macro Definition Documentation

◆ _E

#define _E   "DSP5680XX_ERROR:%d\nAt:%s:%d:%s"

Definition at line 21 of file dsp5680xx.c.

◆ CHECK_DBG

#define CHECK_DBG   if (!dsp5680xx_context.debug_mode_enabled) DEBUG_FAIL

Definition at line 26 of file dsp5680xx.c.

◆ CHECK_HALT

#define CHECK_HALT (   target)    if (target->state != TARGET_HALTED) HALT_FAIL

Definition at line 29 of file dsp5680xx.c.

◆ check_halt_and_debug

#define check_halt_and_debug (   target)    { CHECK_HALT(target); CHECK_DBG; }

Definition at line 30 of file dsp5680xx.c.

◆ CMD1

Definition at line 320 of file dsp5680xx.c.

◆ CMD2

#define CMD2   jtag_data_write16((t, data)

Definition at line 321 of file dsp5680xx.c.

◆ core_move_at_pr0_inc_to_y0 [1/2]

#define core_move_at_pr0_inc_to_y0 (   target)    exe(target, 1, 0x8568, 0, 0)

Definition at line 449 of file dsp5680xx.c.

◆ core_move_at_pr0_inc_to_y0 [2/2]

#define core_move_at_pr0_inc_to_y0 (   target)    exe(target, 1, 0x8568, 0, 0)

Definition at line 449 of file dsp5680xx.c.

◆ core_move_at_pr0_inc_to_y1

#define core_move_at_pr0_inc_to_y1 (   target)    exe(target, 1, 0x8768, 0, 0)

Definition at line 404 of file dsp5680xx.c.

◆ core_move_at_pr2_inc_to_y0

#define core_move_at_pr2_inc_to_y0 (   target)    exe(target, 1, 0x856A, 0, 0)

Definition at line 425 of file dsp5680xx.c.

◆ core_move_at_r0_inc_to_y0

#define core_move_at_r0_inc_to_y0 (   target)    exe(target, 1, 0xf500, 0, 0)

Definition at line 452 of file dsp5680xx.c.

◆ core_move_at_r0_to_y0

#define core_move_at_r0_to_y0 (   target)    exe(target, 1, 0xF514, 0, 0)

Definition at line 377 of file dsp5680xx.c.

◆ core_move_at_r0_to_y1

#define core_move_at_r0_to_y1 (   target)    exe(target, 1, 0xF714, 0, 0)

Definition at line 380 of file dsp5680xx.c.

◆ core_move_at_r0_y0

#define core_move_at_r0_y0 (   target)    exe(target, 1, 0xF514, 0, 0)

Definition at line 455 of file dsp5680xx.c.

◆ core_move_at_r2_disp_to_y0

#define core_move_at_r2_disp_to_y0 (   target,
  disp 
)    exe(target, 2, 0xF542, disp, 0)

Definition at line 461 of file dsp5680xx.c.

◆ core_move_at_r2_to_y0

#define core_move_at_r2_to_y0 (   target)    exe(target, 1, 0xF516, 0, 0)

Definition at line 422 of file dsp5680xx.c.

◆ core_move_byte_y0_at_r0

#define core_move_byte_y0_at_r0 (   target)    exe(target, 1, 0xd5a0, 0, 0)

Definition at line 470 of file dsp5680xx.c.

◆ core_move_long_at_r0_y

#define core_move_long_at_r0_y (   target)    exe(target, 1, 0xF734, 0, 0)

Definition at line 383 of file dsp5680xx.c.

◆ core_move_long_to_n

#define core_move_long_to_n (   target,
  value 
)    exe(target, 3, 0xe41e, value&0xffff, value>>16)

Definition at line 374 of file dsp5680xx.c.

◆ core_move_long_to_r0

#define core_move_long_to_r0 (   target,
  value 
)    exe(target, 3, 0xe418, value&0xffff, value>>16)

Definition at line 371 of file dsp5680xx.c.

◆ core_move_long_to_r1

#define core_move_long_to_r1 (   target,
  value 
)    exe(target, 3, 0xE419, value&0xffff, value>>16)

Definition at line 428 of file dsp5680xx.c.

◆ core_move_long_to_r2

#define core_move_long_to_r2 (   target,
  value 
)    exe(target, 3, 0xe41A, value&0xffff, value>>16)

Definition at line 407 of file dsp5680xx.c.

◆ core_move_long_to_r3

#define core_move_long_to_r3 (   target,
  value 
)    exe(target, 3, 0xE41B, value&0xffff, value>>16)

Definition at line 431 of file dsp5680xx.c.

◆ core_move_long_to_r4

#define core_move_long_to_r4 (   target,
  value 
)    exe(target, 3, 0xE41C, value&0xffff, value>>16)

Definition at line 440 of file dsp5680xx.c.

◆ core_move_long_to_y

#define core_move_long_to_y (   target,
  value 
)    exe(target, 3, 0xe417, value&0xffff, value>>16)

Definition at line 479 of file dsp5680xx.c.

◆ core_move_pc_to_r4

#define core_move_pc_to_r4 (   target)    exe(target, 1, 0xE716, 0, 0)

Definition at line 443 of file dsp5680xx.c.

◆ core_move_r4_to_y

#define core_move_r4_to_y (   target)    exe(target, 1, 0xe764, 0, 0)

Definition at line 446 of file dsp5680xx.c.

◆ core_move_value_at_r0

#define core_move_value_at_r0 (   target,
  value 
)    exe(target, 2, 0x8640, value, 0)

Definition at line 416 of file dsp5680xx.c.

◆ core_move_value_at_r2

#define core_move_value_at_r2 (   target,
  value 
)    exe(target, 2, 0x8642, value, 0)

Definition at line 413 of file dsp5680xx.c.

◆ core_move_value_at_r2_disp

#define core_move_value_at_r2_disp (   target,
  value,
  disp 
)    exe(target, 3, 0x8646, value, disp)

Definition at line 419 of file dsp5680xx.c.

◆ core_move_value_to_y0

#define core_move_value_to_y0 (   target,
  value 
)    exe(target, 2, 0x8745, value, 0)

Definition at line 392 of file dsp5680xx.c.

◆ core_move_y0_at_pr0_inc

#define core_move_y0_at_pr0_inc (   target)    exe(target, 1, 0x8560, 0, 0)

Definition at line 398 of file dsp5680xx.c.

◆ core_move_y0_at_pr3_inc

#define core_move_y0_at_pr3_inc (   target)    exe(target, 1, 0x8563, 0, 0)

Definition at line 434 of file dsp5680xx.c.

◆ core_move_y0_at_r0

#define core_move_y0_at_r0 (   target)    exe(target, 1, 0xd514, 0, 0)

Definition at line 386 of file dsp5680xx.c.

◆ core_move_y0_at_r0_inc

#define core_move_y0_at_r0_inc (   target)    exe(target, 1, 0xd500, 0, 0)

Definition at line 395 of file dsp5680xx.c.

◆ core_move_y0_at_r2

#define core_move_y0_at_r2 (   target)    exe(target, 1, 0xd516, 0, 0)

Definition at line 410 of file dsp5680xx.c.

◆ core_move_y0_at_r3

#define core_move_y0_at_r3 (   target)    exe(target, 1, 0xD503, 0, 0)

Definition at line 437 of file dsp5680xx.c.

◆ core_move_y1_at_pr0_inc

#define core_move_y1_at_pr0_inc (   target)    exe(target, 1, 0x8760, 0, 0)

Definition at line 473 of file dsp5680xx.c.

◆ core_move_y1_at_r0

#define core_move_y1_at_r0 (   target)    exe(target, 1, 0xd714, 0, 0)

Definition at line 467 of file dsp5680xx.c.

◆ core_move_y1_at_r0_inc

#define core_move_y1_at_r0_inc (   target)    exe(target, 1, 0xD700, 0, 0)

Definition at line 476 of file dsp5680xx.c.

◆ core_move_y1_at_r2

#define core_move_y1_at_r2 (   target)    exe(target, 1, 0xd716, 0, 0)

Definition at line 464 of file dsp5680xx.c.

◆ core_tx_lower_data

#define core_tx_lower_data (   t,
  data 
)    PT1\ PT2

Definition at line 322 of file dsp5680xx.c.

◆ DEBUG_FAIL

Definition at line 25 of file dsp5680xx.c.

◆ DEBUG_MSG

#define DEBUG_MSG   "Debug mode be enabled to read mem."

Definition at line 24 of file dsp5680xx.c.

◆ dsp5680xx_exe_1

#define dsp5680xx_exe_1 (   target,
  oc1,
  oc2,
  oc3 
)    dsp5680xx_exe1(target, oc1)

Definition at line 237 of file dsp5680xx.c.

◆ dsp5680xx_exe_2

#define dsp5680xx_exe_2 (   target,
  oc1,
  oc2,
  oc3 
)    dsp5680xx_exe2(target, oc1, oc2)

Definition at line 238 of file dsp5680xx.c.

◆ dsp5680xx_exe_3

#define dsp5680xx_exe_3 (   target,
  oc1,
  oc2,
  oc3 
)    dsp5680xx_exe3(target, oc1, oc2, oc3)

Definition at line 239 of file dsp5680xx.c.

◆ dsp5680xx_exe_generic

#define dsp5680xx_exe_generic (   t,
  words,
  oc1,
  oc2,
  oc3 
)    dsp5680xx_exe_##words(t, oc1, oc2, oc3)

Definition at line 240 of file dsp5680xx.c.

◆ eonce_bfclr_at_r0

#define eonce_bfclr_at_r0 (   target,
  value 
)    exe(target, 2, 0x8040, value, 0)

Definition at line 389 of file dsp5680xx.c.

◆ eonce_nop

#define eonce_nop (   target)    exe(target, 1, 0xe700, 0, 0)

Definition at line 458 of file dsp5680xx.c.

◆ err_check

#define err_check (   r,
  c,
 
)    if (r != ERROR_OK) {LOG_ERROR(_E, c, __func__, __LINE__, m); return r; }

Definition at line 22 of file dsp5680xx.c.

◆ err_check_propagate

#define err_check_propagate (   retval)    if (retval != ERROR_OK) return retval;

Definition at line 23 of file dsp5680xx.c.

◆ exe

#define exe (   a,
  b,
  c,
  d,
 
)    dsp5680xx_exe_generic(a, b, c, d, e)

Definition at line 368 of file dsp5680xx.c.

◆ HALT_FAIL

Definition at line 28 of file dsp5680xx.c.

◆ HALT_MSG

#define HALT_MSG   "Target must be halted."

Definition at line 27 of file dsp5680xx.c.

◆ jtag_data_read16

#define jtag_data_read16 (   target,
  data_read 
)    jtag_data_read(target, data_read, 16)

Definition at line 183 of file dsp5680xx.c.

◆ jtag_data_read32

#define jtag_data_read32 (   target,
  data_read 
)    jtag_data_read(target, data_read, 32)

Definition at line 184 of file dsp5680xx.c.

◆ jtag_data_read8

#define jtag_data_read8 (   target,
  data_read 
)    jtag_data_read(target, data_read, 8)

Definition at line 182 of file dsp5680xx.c.

◆ jtag_data_write16

#define jtag_data_write16 (   target,
  instr,
  data_read 
)    jtag_data_write(target, instr, 16, data_read)

Definition at line 203 of file dsp5680xx.c.

◆ jtag_data_write24

#define jtag_data_write24 (   target,
  instr,
  data_read 
)    jtag_data_write(target, instr, 24, data_read)

Definition at line 204 of file dsp5680xx.c.

◆ jtag_data_write32

#define jtag_data_write32 (   target,
  instr,
  data_read 
)    jtag_data_write(target, instr, 32, data_read)

Definition at line 205 of file dsp5680xx.c.

◆ jtag_data_write8

#define jtag_data_write8 (   target,
  instr,
  data_read 
)    jtag_data_write(target, instr, 8, data_read)

Definition at line 202 of file dsp5680xx.c.

Function Documentation

◆ core_load_tx_rx_high_addr_to_r0()

static int core_load_tx_rx_high_addr_to_r0 ( struct target target)
static

◆ core_move_value_to_pc()

static int core_move_value_to_pc ( struct target target,
uint32_t  value 
)
static

Definition at line 481 of file dsp5680xx.c.

References check_halt_and_debug, dsp5680xx_exe_generic, and err_check_propagate.

Referenced by dsp5680xx_resume().

◆ core_rx_lower_data()

static int core_rx_lower_data ( struct target target,
uint8_t *  data_read 
)
static
Parameters
target
data_readReturns the data read from the lower OTX register via JTAG.
Returns
: Returns an error code (see error code documentation)

Definition at line 349 of file dsp5680xx.c.

References DSP5680XX_ONCE_OTX, eonce_instruction_exec_single(), err_check_propagate, jtag_data_read16, and NULL.

Referenced by dsp5680xx_read_16_single(), dsp5680xx_read_32_single(), and eonce_pc_store().

◆ core_rx_upper_data()

static int core_rx_upper_data ( struct target target,
uint8_t *  data_read 
)
static
Parameters
target
data_readReturns the data read from the upper OTX register via JTAG.
Returns
: Returns an error code (see error code documentation)

Definition at line 330 of file dsp5680xx.c.

References DSP5680XX_ONCE_OTX1, eonce_instruction_exec_single(), err_check_propagate, jtag_data_read16, and NULL.

Referenced by dsp5680xx_f_ex(), dsp5680xx_read_32_single(), and set_fm_ck_div().

◆ core_tx_upper_data()

static int core_tx_upper_data ( struct target target,
uint16_t  data,
uint32_t *  eonce_status_low 
)
static

◆ dsp5680xx_arch_state()

static int dsp5680xx_arch_state ( struct target target)
static

Definition at line 878 of file dsp5680xx.c.

References ERROR_OK, and LOG_USER.

◆ dsp5680xx_assert_reset()

static int dsp5680xx_assert_reset ( struct target target)
static

Definition at line 884 of file dsp5680xx.c.

References ERROR_OK, target::state, and TARGET_RESET.

◆ dsp5680xx_checksum_memory()

static int dsp5680xx_checksum_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t *  checksum 
)
static

This function is not implemented.

It returns an error in order to get OpenOCD to do read out the data and calculate the CRC, or try a binary comparison.

Parameters
target
addressStart address of the image.
sizeIn bytes.
checksum
Returns

Definition at line 1485 of file dsp5680xx.c.

References ERROR_FAIL.

◆ dsp5680xx_convert_address()

static int dsp5680xx_convert_address ( uint32_t *  address,
int *  pmem 
)
static

The value of address determines if it corresponds to P: (program) or X: (dat) memory.

If the address is over 0x200000 then it is considered X: memory, and pmem = 0. The special case of 0xFFXXXX is not modified, since it allows to read out the memory mapped EOnCE registers.

Parameters
address
pmem
Returns

Definition at line 1072 of file dsp5680xx.c.

References ERROR_OK, and S_FILE_DATA_OFFSET.

Referenced by dsp5680xx_read(), and dsp5680xx_write().

◆ dsp5680xx_deassert_reset()

static int dsp5680xx_deassert_reset ( struct target target)
static

Definition at line 890 of file dsp5680xx.c.

References ERROR_OK, target::state, and TARGET_RUNNING.

◆ dsp5680xx_drscan()

◆ dsp5680xx_exe1()

static int dsp5680xx_exe1 ( struct target target,
uint16_t  opcode 
)
static

◆ dsp5680xx_exe2()

static int dsp5680xx_exe2 ( struct target target,
uint16_t  opcode1,
uint16_t  opcode2 
)
static

◆ dsp5680xx_exe3()

static int dsp5680xx_exe3 ( struct target target,
uint16_t  opcode1,
uint16_t  opcode2,
uint16_t  opcode3 
)
static

◆ dsp5680xx_execute_queue()

static int dsp5680xx_execute_queue ( void  )
static

◆ dsp5680xx_f_erase()

int dsp5680xx_f_erase ( struct target target,
int  first,
int  last 
)

Erases either a sector or the complete flash array.

If either the range first-last covers the complete array or if first == 0 and last == 0 then a mass erase command is executed on the FM. If not, then individual sectors are erased.

Parameters
target
first
last
Returns

Definition at line 1862 of file dsp5680xx.c.

References dsp5680xx_common::debug_mode_enabled, dsp5680xx_context, dsp5680xx_f_sim_reset(), dsp5680xx_halt(), erase_sector(), err_check_propagate, ERROR_OK, HFM_SECTOR_COUNT, mass_erase(), and set_fm_ck_div().

Referenced by dsp5680xx_flash_erase().

◆ dsp5680xx_f_erase_check()

int dsp5680xx_f_erase_check ( struct target target,
uint8_t *  erased,
uint32_t  sector 
)

The FM has the functionality of checking if the flash array is erased.

This function executes it. It does not support individual sector analysis.

Parameters
target
erased
sectorThis parameter is ignored because the FM does not support checking if individual sectors are erased.
Returns

Definition at line 1799 of file dsp5680xx.c.

References dsp5680xx_common::debug_mode_enabled, dsp5680xx_context, dsp5680xx_f_ex(), dsp5680xx_halt(), err_check_propagate, HFM_ERASE_VERIFY, HFM_FLASH_BASE_ADDR, HFM_SECTOR_SIZE, HFM_USTAT_MASK_BLANK, and set_fm_ck_div().

◆ dsp5680xx_f_ex()

static int dsp5680xx_f_ex ( struct target target,
uint16_t  c,
uint32_t  address,
uint32_t  data,
uint16_t *  hfm_ustat,
int  pmem 
)
static

Executes a command on the FM module.

Some commands use the parameters address and data, others ignore them.

Parameters
target
cCommand to execute.
addressCommand parameter.
dataCommand parameter.
hfm_ustatFM status register.
pmemAddress is P: (program) memory (pmem == 1) or X: (dat) memory (pmem == 0)
Returns

Definition at line 1603 of file dsp5680xx.c.

References core_load_tx_rx_high_addr_to_r0(), core_move_at_r2_disp_to_y0, core_move_long_to_r2, core_move_long_to_r3, core_move_value_at_r2_disp, core_move_value_to_y0, core_move_y0_at_pr3_inc, core_move_y0_at_r0, core_move_y0_at_r3, core_rx_upper_data(), dsp5680xx_context, DSP5680XX_ERROR_FM_BUSY, DSP5680XX_ERROR_FM_CMD_TIMED_OUT, DSP5680XX_ERROR_FM_EXEC, dsp5680xx_execute_queue(), err_check, err_check_propagate, ERROR_OK, ERROR_TARGET_FAILURE, dsp5680xx_common::flush, HFM_BASE_ADDR, HFM_CMD, HFM_CNFG, HFM_PROT, HFM_PROTB, HFM_USTAT, and HFM_USTAT_MASK_PVIOL_ACCER.

Referenced by dsp5680xx_f_erase_check(), dsp5680xx_f_signature(), erase_sector(), and mass_erase().

◆ dsp5680xx_f_lock()

int dsp5680xx_f_lock ( struct target target)

Writes the flash security words with a specific value.

The chip's security will be enabled after the first reset following the execution of this function.

Parameters
target
Returns

Definition at line 2196 of file dsp5680xx.c.

References dsp5680xx_common::debug_mode_enabled, dsp5680xx_context, DSP5680XX_ERROR_JTAG_RESET, DSP5680XX_ERROR_JTAG_TAP_ENABLE_CORE, DSP5680XX_ERROR_JTAG_TAP_ENABLE_MASTER, dsp5680xx_f_wr(), jtag_tap::enabled, err_check, err_check_propagate, ERROR_FAIL, HFM_LOCK_ADDR_L, HFM_LOCK_FLASH, jtag_add_reset(), jtag_add_sleep(), jtag_tap_by_string(), reset_jtag(), target::state, switch_tap(), TARGET_RUNNING, and TIME_DIV_FREESCALE.

Referenced by dsp5680xx_flash_protect().

◆ dsp5680xx_f_protect_check()

int dsp5680xx_f_protect_check ( struct target target,
uint16_t *  protected 
)

Reads the memory mapped protection register.

A 1 implies the sector is protected, a 0 implies the sector is not protected.

Parameters
target
protectedData read from the protection register.
Returns

Definition at line 1572 of file dsp5680xx.c.

References check_halt_and_debug, DSP5680XX_ERROR_PROTECT_CHECK_INVALID_ARGS, dsp5680xx_read_16_single(), err_check, err_check_propagate, ERROR_FAIL, HFM_BASE_ADDR, and HFM_PROT.

Referenced by dsp5680xx_flash_protect_check().

◆ dsp5680xx_f_signature()

static int dsp5680xx_f_signature ( struct target target,
uint32_t  address,
uint32_t  words,
uint16_t *  signature 
)
static

Executes the FM calculate signature command.

The FM will calculate over the data from address to address + words -1. The result is written to a register, then read out by this function and returned in signature. The value signature may be compared to the one returned by perl_crc to verify the flash was written correctly.

Parameters
target
addressStart of flash array where the signature should be calculated.
wordsNumber of words over which the signature should be calculated.
signatureValue calculated by the FM.
Returns

Definition at line 1774 of file dsp5680xx.c.

References dsp5680xx_common::debug_mode_enabled, dsp5680xx_context, DSP5680XX_ERROR_HALT, dsp5680xx_f_ex(), dsp5680xx_read_16_single(), eonce_enter_debug_mode_without_reset(), err_check, err_check_propagate, HFM_BASE_ADDR, HFM_CALCULATE_DATA_SIGNATURE, HFM_DATA, and NULL.

Referenced by dsp5680xx_f_wr().

◆ dsp5680xx_f_sim_reset()

static int dsp5680xx_f_sim_reset ( struct target target)
static

Resets the SIM.

(System Integration Modul).

Parameters
target
Returns

Definition at line 1535 of file dsp5680xx.c.

References jtag_tap::chip, dsp5680xx_write(), err_check_propagate, ERROR_OK, MC568013_SIM_BASE_ADDR, S_FILE_DATA_OFFSET, SIM_CMD_RESET, and target::tap.

Referenced by dsp5680xx_f_erase(), and dsp5680xx_soft_reset_halt().

◆ dsp5680xx_f_unlock()

int dsp5680xx_f_unlock ( struct target target)

Executes a mass erase command.

The must be done from the Master tap. It is up to the user to select the master tap (jtag tapenable dsp5680xx.chp) before running this function. The flash array will be unsecured (and erased) after the first reset following the execution of this function.

Parameters
target
Returns

Definition at line 2095 of file dsp5680xx.c.

References dsp5680xx_common::debug_mode_enabled, dsp5680xx_context, dsp5680xx_drscan(), DSP5680XX_ERROR_JTAG_RESET, DSP5680XX_ERROR_JTAG_TAP_ENABLE_CORE, DSP5680XX_ERROR_JTAG_TAP_ENABLE_MASTER, dsp5680xx_irscan(), DSP5680XX_JTAG_CORE_TAP_IRLEN, DSP5680XX_JTAG_MASTER_TAP_IRLEN, jtag_tap::enabled, eonce_enter_debug_mode_without_reset(), err_check, err_check_propagate, ERROR_FAIL, ERROR_OK, HFM_CLK_DEFAULT, jtag_add_reset(), jtag_add_sleep(), JTAG_INSTR_DEBUG_REQUEST, jtag_tap_by_string(), LOG_WARNING, MASTER_TAP_CMD_FLASH_ERASE, reset_jtag(), target::state, switch_tap(), TARGET_RUNNING, and TIME_DIV_FREESCALE.

Referenced by dsp5680xx_flash_protect().

◆ dsp5680xx_f_wr()

int dsp5680xx_f_wr ( struct target target,
const uint8_t *  buffer,
uint32_t  address,
uint32_t  count,
int  is_flash_lock 
)

Writes to flash memory.

Does not check if flash is erased, it's up to the user to erase the flash before running this function. The flashing algorithm runs from RAM, reading from a register to which this function writes to. The algorithm is open loop, there is no control to verify that the FM read the register before writing the next data. A closed loop approach was much slower, and the current implementation does not fail, and if it did the crc check would detect it, allowing to flash again.

Parameters
target
buffer
addressWord addressing.
countIn bytes.
is_flash_lock
Returns

Definition at line 1956 of file dsp5680xx.c.

References buffer, core_load_tx_rx_high_addr_to_r0(), core_move_long_to_r2, core_move_long_to_r3, core_move_value_at_r2_disp, core_tx_upper_data(), count, dsp5680xx_common::debug_mode_enabled, dsp5680xx_context, DSP5680XX_ERROR_FLASHING_CRC, DSP5680XX_ERROR_FLASHING_INVALID_WORD_COUNT, dsp5680xx_execute_queue(), dsp5680xx_f_signature(), dsp5680xx_resume(), dsp5680xx_write(), eonce_enter_debug_mode(), err_check, err_check_propagate, ERROR_FAIL, ERROR_OK, dsp5680xx_common::flush, FLUSH_COUNT_FLASH, HFM_BASE_ADDR, HFM_CNFG, HFM_PROT, HFM_PROTB, HFM_SIZE_WORDS, HFM_USTAT, NULL, perl_crc(), pgm_write_pflash, pgm_write_pflash_length, and set_fm_ck_div().

Referenced by dsp5680xx_f_lock(), and dsp5680xx_flash_write().

◆ dsp5680xx_halt()

◆ dsp5680xx_init_target()

static int dsp5680xx_init_target ( struct command_context cmd_ctx,
struct target target 
)
static

◆ dsp5680xx_irscan()

static int dsp5680xx_irscan ( struct target target,
uint32_t *  d_in,
uint32_t *  d_out,
uint8_t  ir_len 
)
static

Test func.

Parameters
target
d_inThis is the data that will be shifted into the JTAG IR reg.
d_outThe data that will be shifted out of the JTAG IR reg will be stored here.
ir_lenLength of the data to be shifted to JTAG IR.

Definition at line 112 of file dsp5680xx.c.

References dsp5680xx_context, DSP5680XX_ERROR_INVALID_IR_LEN, DSP5680XX_ERROR_JTAG_INVALID_TAP, DSP5680XX_ERROR_JTAG_IRSCAN, dsp5680xx_execute_queue(), DSP5680XX_JTAG_MASTER_TAP_IRLEN, jtag_tap::enabled, err_check, ERROR_FAIL, ERROR_OK, dsp5680xx_common::flush, jtag_tap::ir_length, jtag_add_plain_ir_scan(), jtag_tap_by_string(), target::tap, and TAP_IDLE.

Referenced by dsp5680xx_f_unlock(), dsp5680xx_jtag_status(), eonce_enter_debug_mode(), eonce_enter_debug_mode_without_reset(), and switch_tap().

◆ dsp5680xx_jtag_status()

static int dsp5680xx_jtag_status ( struct target target,
uint8_t *  status 
)
static

◆ dsp5680xx_poll()

◆ dsp5680xx_read()

◆ dsp5680xx_read_16_single()

static int dsp5680xx_read_16_single ( struct target t,
uint32_t  a,
uint8_t *  data_read,
int  r_pmem 
)
static

◆ dsp5680xx_read_32_single()

static int dsp5680xx_read_32_single ( struct target t,
uint32_t  a,
uint8_t *  data_read,
int  r_pmem 
)
static

◆ dsp5680xx_read_buffer()

static int dsp5680xx_read_buffer ( struct target target,
target_addr_t  address,
uint32_t  size,
uint8_t *  buffer 
)
static

This function is called by verify_image, it is used to read data from memory.

Parameters
target
addressWord addressing.
sizeIn bytes.
buffer
Returns

Definition at line 1465 of file dsp5680xx.c.

References buffer, check_halt_and_debug, dsp5680xx_read(), and size.

◆ dsp5680xx_read_core_reg()

static int dsp5680xx_read_core_reg ( struct target target,
uint8_t  reg_addr,
uint16_t *  data_read 
)
static

◆ dsp5680xx_resume()

◆ dsp5680xx_soft_reset_halt()

static int dsp5680xx_soft_reset_halt ( struct target target)
static

Halts the core and resets the SIM.

(System Integration Modul).

Parameters
target
Returns

Definition at line 1560 of file dsp5680xx.c.

References dsp5680xx_f_sim_reset(), dsp5680xx_halt(), and err_check_propagate.

◆ dsp5680xx_step()

static int dsp5680xx_step ( struct target target,
int  current,
target_addr_t  address,
int  handle_breakpoints 
)
static

Definition at line 2237 of file dsp5680xx.c.

References DSP5680XX_ERROR_NOT_IMPLEMENTED_STEP, err_check, and ERROR_FAIL.

◆ dsp5680xx_target_create()

static int dsp5680xx_target_create ( struct target target,
Jim_Interp *  interp 
)
static

Definition at line 858 of file dsp5680xx.c.

References target::arch_info, and ERROR_OK.

◆ dsp5680xx_write()

static int dsp5680xx_write ( struct target target,
target_addr_t  a,
uint32_t  size,
uint32_t  count,
const uint8_t *  b 
)
static

Writes buffer to memory.

The parameter address determines whether buffer should be written to P: (program) memory or X: (dat) memory.

Parameters
target
aaddress
sizeBytes (1), Half words (2), Words (4).
countIn bytes.
bbuffer
Returns

Definition at line 1409 of file dsp5680xx.c.

References buffer, check_halt_and_debug, count, dsp5680xx_convert_address(), DSP5680XX_ERROR_INVALID_DATA_SIZE_UNIT, dsp5680xx_write_16(), dsp5680xx_write_32(), dsp5680xx_write_8(), err_check, err_check_propagate, ERROR_TARGET_DATA_ABORT, and size.

Referenced by dsp5680xx_f_sim_reset(), dsp5680xx_f_wr(), and dsp5680xx_write_buffer().

◆ dsp5680xx_write_16()

static int dsp5680xx_write_16 ( struct target t,
uint32_t  a,
uint32_t  c,
const uint8_t *  d,
int  pmem 
)
static

◆ dsp5680xx_write_16_single()

static int dsp5680xx_write_16_single ( struct target t,
uint32_t  a,
uint16_t  data,
uint8_t  w_pmem 
)
static

◆ dsp5680xx_write_32()

static int dsp5680xx_write_32 ( struct target t,
uint32_t  a,
uint32_t  c,
const uint8_t *  d,
int  pmem 
)
static

◆ dsp5680xx_write_32_single()

static int dsp5680xx_write_32_single ( struct target t,
uint32_t  a,
uint32_t  data,
int  w_pmem 
)
static

◆ dsp5680xx_write_8()

static int dsp5680xx_write_8 ( struct target t,
uint32_t  a,
uint32_t  c,
const uint8_t *  d,
int  pmem 
)
static

◆ dsp5680xx_write_buffer()

static int dsp5680xx_write_buffer ( struct target t,
target_addr_t  a,
uint32_t  size,
const uint8_t *  b 
)
static

Definition at line 1448 of file dsp5680xx.c.

References check_halt_and_debug, dsp5680xx_write(), and size.

◆ eonce_enter_debug_mode()

◆ eonce_enter_debug_mode_without_reset()

static int eonce_enter_debug_mode_without_reset ( struct target target,
uint16_t *  eonce_status 
)
static

Puts the core into debug mode, enabling the EOnCE module.

This will not always work, eonce_enter_debug_mode executes much more complicated routine, which is guaranteed to work, but requires a reset. This will complicate comm with the flash module, since after a reset clock divisors must be set again. This implementation works most of the time, and is not accessible to the user.

Parameters
target
eonce_statusData read from the EOnCE status register.
Returns

No error msg here, since there is still hope with full halting sequence

Definition at line 638 of file dsp5680xx.c.

References dsp5680xx_common::debug_mode_enabled, dsp5680xx_context, dsp5680xx_irscan(), DSP5680XX_JTAG_CORE_TAP_IRLEN, eonce_read_status_reg(), err_check_propagate, ERROR_FAIL, ERROR_OK, ERROR_TARGET_FAILURE, JTAG_INSTR_DEBUG_REQUEST, JTAG_INSTR_ENABLE_ONCE, JTAG_STATUS_DEBUG, JTAG_STATUS_MASK, LOG_DEBUG, target::state, and TARGET_HALTED.

Referenced by dsp5680xx_f_signature(), dsp5680xx_f_unlock(), and eonce_enter_debug_mode().

◆ eonce_exit_debug_mode()

static int eonce_exit_debug_mode ( struct target target,
uint8_t *  eonce_status 
)
static

Takes the core out of debug mode.

Parameters
target
eonce_statusData read from the EOnCE status register.
Returns

Definition at line 550 of file dsp5680xx.c.

References eonce_instruction_exec_single(), and err_check_propagate.

Referenced by dsp5680xx_poll(), and dsp5680xx_resume().

◆ eonce_instruction_exec_single()

static int eonce_instruction_exec_single ( struct target target,
uint8_t  instr,
uint8_t  rw,
uint8_t  go,
uint8_t  ex,
uint8_t *  eonce_status 
)
static

Executes EOnCE instruction.

Parameters
target
instrInstruction to execute.
rw
go
ex
eonce_statusValue read from the EOnCE status register.
Returns

Definition at line 219 of file dsp5680xx.c.

References err_check_propagate, and jtag_data_write().

Referenced by core_rx_lower_data(), core_rx_upper_data(), core_tx_upper_data(), dsp5680xx_exe1(), dsp5680xx_exe2(), dsp5680xx_exe3(), dsp5680xx_read_core_reg(), and eonce_exit_debug_mode().

◆ eonce_load_tx_rx_to_r0()

static int eonce_load_tx_rx_to_r0 ( struct target target)
static

◆ eonce_pc_store()

static int eonce_pc_store ( struct target target)
static

Reads the current value of the program counter and stores it.

Parameters
target
Returns

Definition at line 837 of file dsp5680xx.c.

References core_move_pc_to_r4, core_move_r4_to_y, core_move_y0_at_r0, core_rx_lower_data(), dsp5680xx_context, eonce_load_tx_rx_to_r0(), err_check_propagate, ERROR_OK, LOG_USER, and dsp5680xx_common::stored_pc.

Referenced by dsp5680xx_halt().

◆ eonce_read_status_reg()

static int eonce_read_status_reg ( struct target target,
uint16_t *  data 
)
static

◆ erase_sector()

static int erase_sector ( struct target target,
int  sector,
uint16_t *  hfm_ustat 
)
static

Executes the FM page erase command.

Parameters
target
sectorPage to erase.
hfm_ustatFM module status register.
Returns

Definition at line 1835 of file dsp5680xx.c.

References dsp5680xx_f_ex(), err_check_propagate, HFM_FLASH_BASE_ADDR, HFM_PAGE_ERASE, and HFM_SECTOR_SIZE.

Referenced by dsp5680xx_f_erase().

◆ jtag_data_read()

static int jtag_data_read ( struct target target,
uint8_t *  data_read,
int  num_bits 
)
static

TODO remove this or move to jtagio?

Definition at line 169 of file dsp5680xx.c.

References dsp5680xx_drscan(), and LOG_DEBUG.

◆ jtag_data_write()

static int jtag_data_write ( struct target target,
uint32_t  instr,
int  num_bits,
uint32_t *  data_read 
)
static

Definition at line 188 of file dsp5680xx.c.

References data_read_dummy, dsp5680xx_drscan(), and err_check_propagate.

Referenced by eonce_instruction_exec_single().

◆ mass_erase()

static int mass_erase ( struct target target,
uint16_t *  hfm_ustat 
)
static

Executes the FM mass erase command.

Erases the flash array completely.

Parameters
target
hfm_ustatFM module status register.
Returns

Definition at line 1854 of file dsp5680xx.c.

References dsp5680xx_f_ex(), and HFM_MASS_ERASE.

Referenced by bluenrgx_erase(), and dsp5680xx_f_erase().

◆ perl_crc()

static int perl_crc ( const uint8_t *  buff8,
uint32_t  word_count 
)
static

Calculates a signature over word_count words in the data from buff8.

The algorithm used is the same the FM uses, so the return may be used to compare with the one generated by the FM module, and check if flashing was successful. This algorithm is based on the perl script available from the Freescale website at FAQ 25630.

Parameters
buff8
word_count
Returns

Definition at line 1502 of file dsp5680xx.c.

Referenced by dsp5680xx_f_wr().

◆ reset_jtag()

static int reset_jtag ( void  )
static

◆ set_fm_ck_div()

static int set_fm_ck_div ( struct target target)
static

Prior to the execution of any Flash module command, the Flash module Clock Divider (CLKDIV) register must be initialized.

The values of this register determine the speed of the internal Flash Clock (FCLK). FCLK must be in the range of 150kHz ≤ FCLK ≤ 200kHz for proper operation of the Flash module. (Running FCLK too slowly wears out the module, while running it too fast under programs Flash leading to bit errors.)

Parameters
target
Returns

Definition at line 1711 of file dsp5680xx.c.

References core_load_tx_rx_high_addr_to_r0(), core_move_at_r2_to_y0, core_move_long_to_r2, core_move_value_at_r2, core_move_y0_at_r0, core_rx_upper_data(), DSP5680XX_ERROR_FM_SET_CLK, err_check, err_check_propagate, ERROR_OK, ERROR_TARGET_FAILURE, HFM_BASE_ADDR, HFM_CLK_DEFAULT, and LOG_DEBUG.

Referenced by dsp5680xx_f_erase(), dsp5680xx_f_erase_check(), and dsp5680xx_f_wr().

◆ switch_tap()

Variable Documentation

◆ data_read_dummy

uint32_t data_read_dummy
static

Definition at line 186 of file dsp5680xx.c.

Referenced by jtag_data_write().

◆ dsp5680xx_context

◆ dsp5680xx_target

struct target_type dsp5680xx_target
Initial value:
= {
.name = "dsp5680xx",
.poll = dsp5680xx_poll,
.arch_state = dsp5680xx_arch_state,
.halt = dsp5680xx_halt,
.resume = dsp5680xx_resume,
.step = dsp5680xx_step,
.write_buffer = dsp5680xx_write_buffer,
.read_buffer = dsp5680xx_read_buffer,
.assert_reset = dsp5680xx_assert_reset,
.deassert_reset = dsp5680xx_deassert_reset,
.soft_reset_halt = dsp5680xx_soft_reset_halt,
.read_memory = dsp5680xx_read,
.write_memory = dsp5680xx_write,
.checksum_memory = dsp5680xx_checksum_memory,
.target_create = dsp5680xx_target_create,
.init_target = dsp5680xx_init_target,
}
static int dsp5680xx_read_buffer(struct target *target, target_addr_t address, uint32_t size, uint8_t *buffer)
This function is called by verify_image, it is used to read data from memory.
Definition: dsp5680xx.c:1465
static int dsp5680xx_soft_reset_halt(struct target *target)
Halts the core and resets the SIM.
Definition: dsp5680xx.c:1560
static int dsp5680xx_halt(struct target *target)
Definition: dsp5680xx.c:896
static int dsp5680xx_deassert_reset(struct target *target)
Definition: dsp5680xx.c:890
static int dsp5680xx_step(struct target *target, int current, target_addr_t address, int handle_breakpoints)
Definition: dsp5680xx.c:2237
static int dsp5680xx_resume(struct target *target, int current, target_addr_t address, int hb, int d)
Definition: dsp5680xx.c:996
static int dsp5680xx_target_create(struct target *target, Jim_Interp *interp)
Definition: dsp5680xx.c:858
static int dsp5680xx_poll(struct target *target)
Definition: dsp5680xx.c:922
static int dsp5680xx_assert_reset(struct target *target)
Definition: dsp5680xx.c:884
static int dsp5680xx_read(struct target *t, target_addr_t a, uint32_t size, uint32_t count, uint8_t *buf)
Definition: dsp5680xx.c:1154
static int dsp5680xx_init_target(struct command_context *cmd_ctx, struct target *target)
Definition: dsp5680xx.c:866
static int dsp5680xx_write(struct target *target, target_addr_t a, uint32_t size, uint32_t count, const uint8_t *b)
Writes buffer to memory.
Definition: dsp5680xx.c:1409
static int dsp5680xx_checksum_memory(struct target *target, target_addr_t address, uint32_t size, uint32_t *checksum)
This function is not implemented.
Definition: dsp5680xx.c:1485
static int dsp5680xx_arch_state(struct target *target)
Definition: dsp5680xx.c:878
static int dsp5680xx_write_buffer(struct target *t, target_addr_t a, uint32_t size, const uint8_t *b)
Definition: dsp5680xx.c:1448

Holds methods for dsp5680xx targets.

Definition at line 2237 of file dsp5680xx.c.

◆ pgm_write_pflash

const uint16_t pgm_write_pflash[]
static
Initial value:
= {
0x8A46, 0x0013, 0x807D, 0xE700,
0xE700, 0x8A44, 0xFFFE, 0x017B,
0xE700, 0xF514, 0x8563, 0x8646,
0x0020, 0x0014, 0x8646, 0x0080,
0x0013, 0xF042, 0x0013, 0x8B40,
0x2004, 0x8246, 0x0013, 0x0020,
0xA967, 0x8B40, 0x1065, 0x8246,
0x0013, 0x0010, 0xA961
}

Definition at line 1943 of file dsp5680xx.c.

Referenced by dsp5680xx_f_wr().

◆ pgm_write_pflash_length

const uint32_t pgm_write_pflash_length = 31
static

Definition at line 1954 of file dsp5680xx.c.

Referenced by dsp5680xx_f_wr().