From: Keith Packard Date: Tue, 6 Jan 2009 05:45:21 +0000 (-0800) Subject: Expose ccdbg_set_clock API X-Git-Tag: 0.5~58^2~70 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=60940b4be23962db79b8e914ec943d0636dd68ad Expose ccdbg_set_clock API This allows applications to change the debug port clock rate on the fly. Signed-off-by: Keith Packard --- diff --git a/lib/ccdbg-io.c b/lib/ccdbg-io.c index 53ea7583..e5e85e43 100644 --- a/lib/ccdbg-io.c +++ b/lib/ccdbg-io.c @@ -24,12 +24,20 @@ #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); } diff --git a/lib/ccdbg.h b/lib/ccdbg.h index 241c4eec..037d8ff5 100644 --- a/lib/ccdbg.h +++ b/lib/ccdbg.h @@ -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);