svn commit: r297583 - head/sys/dev/usb/serial
Ian Lepore
ian at FreeBSD.org
Tue Apr 5 13:47:08 UTC 2016
Author: ian
Date: Tue Apr 5 13:47:06 2016
New Revision: 297583
URL: https://svnweb.freebsd.org/changeset/base/297583
Log:
Add more DPRINTF() to the ftdi driver. Now everything that can change the
chip's state has a DPRINTF, with things that happen repeatedly at debug=2
level and things that happen frequently (like per-transfer IO) at debug=3.
Modified:
head/sys/dev/usb/serial/uftdi.c
Modified: head/sys/dev/usb/serial/uftdi.c
==============================================================================
--- head/sys/dev/usb/serial/uftdi.c Tue Apr 5 13:45:23 2016 (r297582)
+++ head/sys/dev/usb/serial/uftdi.c Tue Apr 5 13:47:06 2016 (r297583)
@@ -1178,7 +1178,7 @@ uftdi_cfg_open(struct ucom_softc *ucom)
* DPRINTF() so that you can see the point at which open gets called
* when debugging is enabled.
*/
- DPRINTF("");
+ DPRINTF("\n");
}
static void
@@ -1190,7 +1190,7 @@ uftdi_cfg_close(struct ucom_softc *ucom)
* DPRINTF() so that you can see the point at which close gets called
* when debugging is enabled.
*/
- DPRINTF("");
+ DPRINTF("\n");
}
static void
@@ -1202,6 +1202,8 @@ uftdi_write_callback(struct usb_xfer *xf
uint32_t buflen;
uint8_t buf[1];
+ DPRINTFN(3, "\n");
+
switch (USB_GET_STATE(xfer)) {
default: /* Error */
if (error != USB_ERR_CANCELLED) {
@@ -1262,6 +1264,8 @@ uftdi_read_callback(struct usb_xfer *xfe
int pktmax;
int offset;
+ DPRINTFN(3, "\n");
+
usbd_xfer_status(xfer, &buflen, NULL, NULL, NULL);
switch (USB_GET_STATE(xfer)) {
@@ -1343,6 +1347,8 @@ uftdi_cfg_set_dtr(struct ucom_softc *uco
uint16_t wValue;
struct usb_device_request req;
+ DPRINTFN(2, "DTR=%u\n", onoff);
+
wValue = onoff ? FTDI_SIO_SET_DTR_HIGH : FTDI_SIO_SET_DTR_LOW;
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
@@ -1362,6 +1368,8 @@ uftdi_cfg_set_rts(struct ucom_softc *uco
uint16_t wValue;
struct usb_device_request req;
+ DPRINTFN(2, "RTS=%u\n", onoff);
+
wValue = onoff ? FTDI_SIO_SET_RTS_HIGH : FTDI_SIO_SET_RTS_LOW;
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
@@ -1381,6 +1389,8 @@ uftdi_cfg_set_break(struct ucom_softc *u
uint16_t wValue;
struct usb_device_request req;
+ DPRINTFN(2, "BREAK=%u\n", onoff);
+
if (onoff) {
sc->sc_last_lcr |= FTDI_SIO_SET_BREAK;
} else {
@@ -1618,14 +1628,14 @@ uftdi_cfg_param(struct ucom_softc *ucom,
struct uftdi_param_config cfg;
struct usb_device_request req;
+ DPRINTF("\n");
+
if (uftdi_set_parm_soft(ucom, t, &cfg)) {
/* should not happen */
return;
}
sc->sc_last_lcr = cfg.lcr;
- DPRINTF("\n");
-
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = FTDI_SIO_SET_BAUD_RATE;
USETW(req.wValue, cfg.baud_lobits);
@@ -1656,8 +1666,7 @@ uftdi_cfg_get_status(struct ucom_softc *
{
struct uftdi_softc *sc = ucom->sc_parent;
- DPRINTF("msr=0x%02x lsr=0x%02x\n",
- sc->sc_msr, sc->sc_lsr);
+ DPRINTFN(3, "msr=0x%02x lsr=0x%02x\n", sc->sc_msr, sc->sc_lsr);
*msr = sc->sc_msr;
*lsr = sc->sc_lsr;
@@ -1669,6 +1678,8 @@ uftdi_reset(struct ucom_softc *ucom, int
struct uftdi_softc *sc = ucom->sc_parent;
usb_device_request_t req;
+ DPRINTFN(2, "\n");
+
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = FTDI_SIO_RESET;
@@ -1686,6 +1697,8 @@ uftdi_set_bitmode(struct ucom_softc *uco
usb_device_request_t req;
int rv;
+ DPRINTFN(2, "\n");
+
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = FTDI_SIO_SET_BITMODE;
@@ -1710,6 +1723,8 @@ uftdi_get_bitmode(struct ucom_softc *uco
struct uftdi_softc *sc = ucom->sc_parent;
usb_device_request_t req;
+ DPRINTFN(2, "\n");
+
req.bmRequestType = UT_READ_VENDOR_DEVICE;
req.bRequest = FTDI_SIO_GET_BITMODE;
@@ -1727,6 +1742,8 @@ uftdi_set_latency(struct ucom_softc *uco
struct uftdi_softc *sc = ucom->sc_parent;
usb_device_request_t req;
+ DPRINTFN(2, "\n");
+
if (latency < 0 || latency > 255)
return (USB_ERR_INVAL);
@@ -1748,6 +1765,8 @@ uftdi_get_latency(struct ucom_softc *uco
usb_error_t err;
uint8_t buf;
+ DPRINTFN(2, "\n");
+
req.bmRequestType = UT_READ_VENDOR_DEVICE;
req.bRequest = FTDI_SIO_GET_LATENCY;
@@ -1768,6 +1787,8 @@ uftdi_set_event_char(struct ucom_softc *
usb_device_request_t req;
uint8_t enable;
+ DPRINTFN(2, "\n");
+
enable = (echar == -1) ? 0 : 1;
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
@@ -1787,6 +1808,8 @@ uftdi_set_error_char(struct ucom_softc *
usb_device_request_t req;
uint8_t enable;
+ DPRINTFN(2, "\n");
+
enable = (echar == -1) ? 0 : 1;
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
@@ -1807,6 +1830,8 @@ uftdi_read_eeprom(struct ucom_softc *uco
usb_error_t err;
uint16_t widx, wlength, woffset;
+ DPRINTFN(3, "\n");
+
/* Offset and length must both be evenly divisible by two. */
if ((eeio->offset | eeio->length) & 0x01)
return (EINVAL);
@@ -1835,6 +1860,8 @@ uftdi_write_eeprom(struct ucom_softc *uc
usb_error_t err;
uint16_t widx, wlength, woffset;
+ DPRINTFN(3, "\n");
+
/* Offset and length must both be evenly divisible by two. */
if ((eeio->offset | eeio->length) & 0x01)
return (EINVAL);
@@ -1861,6 +1888,8 @@ uftdi_erase_eeprom(struct ucom_softc *uc
usb_device_request_t req;
usb_error_t err;
+ DPRINTFN(2, "\n");
+
/* Small effort to prevent accidental erasure. */
if (confirmation != UFTDI_CONFIRM_ERASE)
return (EINVAL);
@@ -1883,8 +1912,6 @@ uftdi_ioctl(struct ucom_softc *ucom, uin
int err;
struct uftdi_bitmode * mode;
- DPRINTF("portno: %d cmd: %#x\n", ucom->sc_portno, cmd);
-
switch (cmd) {
case UFTDIIOC_RESET_IO:
case UFTDIIOC_RESET_RX:
More information about the svn-src-head
mailing list