Cleanup work; separating out the cp interface to be more abstract.
[fw/altos] / lib / cccp.c
index 99a0d81f1a11a895d470d558d7fdfe6caa8ac585..34e866e89c4cda97c248702a55ad63bb1061b3ac 100644 (file)
@@ -98,3 +98,15 @@ cccp_fini(struct ccdbg *dbg)
        cccp_write(dbg, 0xf, 0xf);
        dbg->clock = 1;
 }
+
+cccp_open()
+{
+       dbg->fd = open("/dev/ttyUSB0", 2);
+       if (dbg->fd < 0) {
+               perror(file);
+               free(dbg);
+               return NULL;
+       }
+       cccp_init(dbg);
+       cccp_write(dbg, CC_CLOCK, CC_CLOCK);
+}