-#ifdef CP_USB_ASYNC
- cp_usb_async_sync(dbg->cp_async);
-#endif
-}
-
-static char
-is_bit(uint8_t get, uint8_t mask, char on, uint8_t bit)
-{
- if (mask&bit) {
- if (get&bit)
- return on;
- else
- return '.';
- } else
- return '-';
-}
-void
-ccdbg_print(char *format, uint8_t mask, uint8_t set)
-{
- ccdbg_debug (CC_DEBUG_BITBANG, format,
- is_bit(set, mask, 'C', CC_CLOCK),
- is_bit(set, mask, 'D', CC_DATA),
- is_bit(set, mask, 'R', CC_RESET_N));
-}
-
-void
-ccdbg_send(struct ccdbg *dbg, uint8_t mask, uint8_t set)
-{
- ccdbg_write(dbg, mask, set);
- ccdbg_print("%c %c %c\n", mask, set);
- ccdbg_half_clock(dbg);
-}
-
-void
-ccdbg_send_bit(struct ccdbg *dbg, uint8_t bit)
-{
- if (bit) bit = CC_DATA;
- ccdbg_send(dbg, CC_CLOCK|CC_DATA|CC_RESET_N, CC_CLOCK|bit|CC_RESET_N);
- ccdbg_send(dbg, CC_CLOCK|CC_DATA|CC_RESET_N, bit|CC_RESET_N);
-}
-
-void
-ccdbg_send_byte(struct ccdbg *dbg, uint8_t byte)
-{
- int bit;
- ccdbg_debug(CC_DEBUG_BITBANG, "#\n# Send Byte 0x%02x\n#\n", byte);
- for (bit = 7; bit >= 0; bit--) {
- ccdbg_send_bit(dbg, (byte >> bit) & 1);
- if (bit == 3)
- ccdbg_debug(CC_DEBUG_BITBANG, "\n");
- }
- ccdbg_sync_io(dbg);