This allows applications to change the debug port clock
rate on the fly.
Signed-off-by: Keith Packard <keithp@keithp.com>
#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);
}
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);