diff options
| author | Keith Packard <keithp@keithp.com> | 2008-12-17 23:12:59 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2008-12-17 23:12:59 -0800 | 
| commit | fa168f963f8b00144d12aa2770e9c0917cfae123 (patch) | |
| tree | b57701ef1b9cc331fc97b977557e8b4029365033 /ccdbg-command.c | |
| parent | 5df84df7cd6a31527dcfd11030f00ef9d8abf170 (diff) | |
Fill out ccdbg-command to support all debug commands.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ccdbg-command.c')
| -rw-r--r-- | ccdbg-command.c | 64 | 
1 files changed, 61 insertions, 3 deletions
| diff --git a/ccdbg-command.c b/ccdbg-command.c index 099afc55..415010f8 100644 --- a/ccdbg-command.c +++ b/ccdbg-command.c @@ -48,9 +48,15 @@ ccdbg_reset(struct ccdbg *dbg)  }  uint8_t -ccdbg_read_status(struct ccdbg *dbg) +ccdbg_chip_erase(struct ccdbg *dbg)  { -	return ccdbg_cmd_write_read8(dbg, CC_READ_STATUS, NULL, 0); +	return ccdbg_cmd_write_read8(dbg, CC_CHIP_ERASE, NULL, 0); +} + +uint8_t +ccdbg_wr_config(struct ccdbg *dbg, uint8_t config) +{ +	return ccdbg_cmd_write_read8(dbg, CC_WR_CONFIG, &config, 1);  }  uint8_t @@ -59,9 +65,61 @@ ccdbg_rd_config(struct ccdbg *dbg)  	return ccdbg_cmd_write_read8(dbg, CC_RD_CONFIG, NULL, 0);  } +uint8_t +ccdbg_get_pc(struct ccdbg *dbg) +{ +	return ccdbg_cmd_write_read16(dbg, CC_GET_PC, NULL, 0); +} + +uint8_t +ccdbg_read_status(struct ccdbg *dbg) +{ +	return ccdbg_cmd_write_read8(dbg, CC_READ_STATUS, NULL, 0); +} + +uint8_t +ccdbg_set_hw_brkpnt(struct ccdbg *dbg, uint8_t number, uint8_t enable, uint16_t addr) +{ +	uint8_t	data[3]; + +	data[0] = (number << 3) | (enable << 2); +	data[1] = (addr >> 8); +	data[2] = addr; +	return ccdbg_cmd_write_read8(dbg, CC_SET_HW_BRKPNT, data, 3); +} + +uint8_t +ccdbg_halt(struct ccdbg *dbg) +{ +	return ccdbg_cmd_write_read8(dbg, CC_HALT, NULL, 0); +} + +uint8_t +ccdbg_resume(struct ccdbg *dbg) +{ +	return ccdbg_cmd_write_read8(dbg, CC_RESUME, NULL, 0); +} + +uint8_t +ccdbg_debug_instr(struct ccdbg *dbg, uint8_t *instr, int nbytes) +{ +	return ccdbg_cmd_write_read8(dbg, CC_DEBUG_INSTR(nbytes), instr, nbytes); +} + +uint8_t +ccdbg_step_instr(struct ccdbg *dbg) +{ +	return ccdbg_cmd_write_read8(dbg, CC_STEP_INSTR, NULL, 0); +} + +uint8_t +ccdbg_step_replace(struct ccdbg *dbg, uint8_t *instr, int nbytes) +{ +	return ccdbg_cmd_write_read8(dbg, CC_STEP_REPLACE(nbytes), instr, nbytes); +} +  uint16_t  ccdbg_get_chip_id(struct ccdbg *dbg)  {  	return ccdbg_cmd_write_read16(dbg, CC_GET_CHIP_ID, NULL, 0);  } - | 
