diff options
author | Keith Packard <keithp@keithp.com> | 2009-01-05 21:45:21 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-01-05 21:45:21 -0800 |
commit | 60940b4be23962db79b8e914ec943d0636dd68ad (patch) | |
tree | 44ff3b464ed793533f9f3ea57eeab2dd59779482 | |
parent | eb09e61b0682eb2aeac8e1a34d58b897ba6db8e7 (diff) |
Expose ccdbg_set_clock API
This allows applications to change the debug port clock
rate on the fly.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | lib/ccdbg-io.c | 12 | ||||
-rw-r--r-- | lib/ccdbg.h | 3 |
2 files changed, 13 insertions, 2 deletions
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 @@ -259,6 +259,9 @@ 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); int |