Browse Source

jingtian: Implement device protocol dump

Luke Dashjr 11 years ago
parent
commit
899ba3a67e
1 changed files with 16 additions and 1 deletions
  1. 16 1
      driver-jingtian.c

+ 16 - 1
driver-jingtian.c

@@ -53,9 +53,24 @@ bool jingtian_spi_txrx(struct spi_port * const port)
 			bfg_gpio_set_low(cs_set_low);
 			bfg_gpio_set_low(cs_set_low);
 		if (cs_set_high)
 		if (cs_set_high)
 			bfg_gpio_set_high(cs_set_high);
 			bfg_gpio_set_high(cs_set_high);
+		if (opt_dev_protocol)
+			applog(LOG_DEBUG, "%s(%p): CS %d", __func__, port, port->chipselect);
 		*port->chipselect_current = port->chipselect;
 		*port->chipselect_current = port->chipselect;
 	}
 	}
-	return linux_spi_txrx(port);
+	if (opt_dev_protocol)
+	{
+		char x[(spi_getbufsz(port) * 2) + 1];
+		bin2hex(x, spi_gettxbuf(port), spi_getbufsz(port));
+		applog(LOG_DEBUG, "%s(%p): %cX %s", __func__, port, 'T', x);
+	}
+	bool rv = linux_spi_txrx(port);
+	if (opt_dev_protocol)
+	{
+		char x[(spi_getbufsz(port) * 2) + 1];
+		bin2hex(x, spi_getrxbuf(port), spi_getbufsz(port));
+		applog(LOG_DEBUG, "%s(%p): %cX %s", __func__, port, 'R', x);
+	}
+	return rv;
 }
 }
 
 
 static
 static