projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fill out ccdbg-command to support all debug commands.
[fw/altos]
/
ccdbg.c
diff --git
a/ccdbg.c
b/ccdbg.c
index a2b5946db62ec0ad8e4d7fd14a9ff0e18a492c22..b682372a96ba5a1d4615908aaf202add8a1a7488 100644
(file)
--- a/
ccdbg.c
+++ b/
ccdbg.c
@@
-18,18
+18,49
@@
#include "ccdbg.h"
#include "ccdbg.h"
+#define MOV 0x75
+
+static uint8_t instructions[] = {
+ 3, MOV, 0xfe, 0x02,
+ 3, MOV, 0x90, 0xff,
+ 0
+};
+
+static void
+ccdbg_instructions(struct ccdbg *dbg, uint8_t *inst)
+{
+ while(inst[0] != 0) {
+ uint8_t len = inst[0];
+ uint8_t status;
+ status = ccdbg_debug_instr(dbg, inst+1, len);
+ printf ("inst status 0x%02x\n", status);
+ inst += len + 1;
+ }
+}
+
int
main (int argc, char **argv)
{
struct ccdbg *dbg;
uint8_t status;
int
main (int argc, char **argv)
{
struct ccdbg *dbg;
uint8_t status;
+ uint16_t chip_id;
dbg = ccdbg_open("/dev/ttyUSB0");
if (!dbg)
exit (1);
dbg = ccdbg_open("/dev/ttyUSB0");
if (!dbg)
exit (1);
- ccdbg_reset(dbg);
+#if 0
+ ccdbg_manual(dbg, stdin);
+#endif
+#if 1
+ ccdbg_debug_mode(dbg);
status = ccdbg_read_status(dbg);
printf("Status: 0x%02x\n", status);
status = ccdbg_read_status(dbg);
printf("Status: 0x%02x\n", status);
+ chip_id = ccdbg_get_chip_id(dbg);
+ printf("Chip id: 0x%04x\n", chip_id);
+ status = ccdbg_halt(dbg);
+ printf ("halt status: 0x%02x\n", status);
+ ccdbg_instructions(dbg, instructions);
+#endif
ccdbg_close(dbg);
exit (0);
}
ccdbg_close(dbg);
exit (0);
}