1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

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.
This commit is contained in:
Ian Lepore 2016-04-05 13:47:06 +00:00
parent 89de2fb6d4
commit dc57f06939
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297583

View File

@ -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 *xfer, usb_error_t error)
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 *xfer, usb_error_t error)
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 *ucom, uint8_t onoff)
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 *ucom, uint8_t onoff)
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 *ucom, uint8_t onoff)
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 termios *t)
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 *ucom, uint8_t *lsr, uint8_t *msr)
{
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 reset_type)
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 *ucom, uint8_t bitmode, uint8_t iomask)
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 *ucom, uint8_t *bitmode, uint8_t *iomask)
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 *ucom, int latency)
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 *ucom, int *latency)
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 *ucom, int echar)
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 *ucom, int echar)
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 *ucom, struct uftdi_eeio *eeio)
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 *ucom, struct uftdi_eeio *eeio)
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 *ucom, int confirmation)
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, uint32_t cmd, caddr_t data,
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: