X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ccdbg-command.c;h=50dd1fd4500612e3fe002b666e18b9a04b8b104a;hp=415010f823d439b54e56cb7d83e13d6d69e1d215;hb=807e2adacb025af77bb53c03209e9c8e0d7a5f95;hpb=8c879bf51c14a5928135d59211facd72f6a32808 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; +} +