diff options
| author | Keith Packard <keithp@keithp.com> | 2008-12-18 00:18:50 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2008-12-18 00:18:50 -0800 | 
| commit | 807e2adacb025af77bb53c03209e9c8e0d7a5f95 (patch) | |
| tree | ae58ce250aca9f66086e888face7e8c8d3c1473e /ccdbg-command.c | |
| parent | 8c879bf51c14a5928135d59211facd72f6a32808 (diff) | |
Add ability to read/write arbitrary memory. Write LED blinker program.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ccdbg-command.c')
| -rw-r--r-- | ccdbg-command.c | 23 | 
1 files changed, 23 insertions, 0 deletions
diff --git a/ccdbg-command.c b/ccdbg-command.c index 415010f8..50dd1fd4 100644 --- a/ccdbg-command.c +++ b/ccdbg-command.c @@ -123,3 +123,26 @@ ccdbg_get_chip_id(struct ccdbg *dbg)  {  	return ccdbg_cmd_write_read16(dbg, CC_GET_CHIP_ID, NULL, 0);  } + +/* + * Execute a sequence of instructions + */ +uint8_t +ccdbg_execute(struct ccdbg *dbg, uint8_t *inst) +{ +	uint8_t status = 0; +	while(inst[0] != 0) { +		uint8_t	len = inst[0]; +		int i; +		ccdbg_debug(CC_DEBUG_INSTRUCTIONS, "\t%02x", inst[1]); +		for (i = 0; i < len - 1; i++) +			ccdbg_debug(CC_DEBUG_INSTRUCTIONS, " %02x", inst[i+2]); +		status = ccdbg_debug_instr(dbg, inst+1, len); +		for (; i < 3; i++) +			ccdbg_debug(CC_DEBUG_INSTRUCTIONS, "   "); +		ccdbg_debug(CC_DEBUG_INSTRUCTIONS, " -> %02x\n", status); +		inst += len + 1; +	} +	return status; +} +  | 
