Expose ccdbg_set_clock API
authorKeith Packard <keithp@keithp.com>
Tue, 6 Jan 2009 05:45:21 +0000 (21:45 -0800)
committerKeith Packard <keithp@keithp.com>
Tue, 6 Jan 2009 05:45:21 +0000 (21:45 -0800)
This allows applications to change the debug port clock
rate on the fly.

Signed-off-by: Keith Packard <keithp@keithp.com>
lib/ccdbg-io.c
lib/ccdbg.h

index 53ea758342c6f22f055c42549bc2fc3c403c8336..e5e85e4390ff1220c3eebf12f30fe42a820b2d9e 100644 (file)
 #include "cp-usb.h"
 #endif
 
+static uint32_t        cc_clock_us = CC_CLOCK_US;
+
+void
+ccdbg_set_clock(uint32_t us)
+{
+       cc_clock_us = us;
+}
+
 void
 ccdbg_half_clock(struct ccdbg *dbg)
 {
        struct timespec req, rem;
-       req.tv_sec = (CC_CLOCK_US / 2) / 1000000;
-       req.tv_nsec = ((CC_CLOCK_US / 2) % 1000000) * 1000;
+       req.tv_sec = (cc_clock_us / 2) / 1000000;
+       req.tv_nsec = ((cc_clock_us / 2) % 1000000) * 1000;
        nanosleep(&req, &rem);
 }
 
index 241c4eecf311b717ee4f216cd9b84edf7c492a20..037d8ff574c11386231f7aa1d93b37e018248493 100644 (file)
@@ -258,6 +258,9 @@ int
 ccdbg_hex_image_equal(struct hex_image *a, struct hex_image *b);
 
 /* ccdbg-io.c */
+void
+ccdbg_set_clock(uint32_t us);
+
 void
 ccdbg_half_clock(struct ccdbg *dbg);