Lines Matching +full:pmsg +full:- +full:size

1 /*-
28 * i2c-tiny-usb, DIY USB to IIC bridge (using AVR or RP2040) from
31 * https://github.com/harbaum/I2C-Tiny-USB
33 * https://github.com/Nicolai-Electronics/rp2040-i2c-interface
103 error = usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, data, 0, in usb_read()
107 actlen = -1; in usb_read()
126 error = usbd_do_request_flags(sc->sc_udev, &sc->sc_mtx, &req, data, 0, in usb_write()
130 actlen = -1; in usb_write()
143 if (uaa->usb_mode != USB_MODE_HOST) in i2ctinyusb_probe()
148 device_set_desc(dev, "I2C-Tiny-USB I2C interface"); in i2ctinyusb_probe()
167 sc->sc_udev = uaa->device; in i2ctinyusb_attach()
168 mtx_init(&sc->sc_mtx, "i2ctinyusb lock", NULL, MTX_DEF | MTX_RECURSE); in i2ctinyusb_attach()
170 sc->iicbus_dev = device_add_child(dev, "iicbus", -1); in i2ctinyusb_attach()
171 if (sc->iicbus_dev == NULL) { in i2ctinyusb_attach()
198 mtx_destroy(&sc->sc_mtx); in i2ctinyusb_detach()
210 struct iic_msg *pmsg; in i2ctinyusb_transfer() local
215 mtx_lock(&sc->sc_mtx); in i2ctinyusb_transfer()
218 pmsg = &msgs[i]; in i2ctinyusb_transfer()
221 if (i == nmsgs - 1) in i2ctinyusb_transfer()
225 if ((ret = usb_read(sc, cmd, pmsg->flags, pmsg->slave, pmsg->buf, in i2ctinyusb_transfer()
226 pmsg->len)) != pmsg->len) { in i2ctinyusb_transfer()
232 if ((ret = usb_write(sc, cmd, pmsg->flags, pmsg->slave, pmsg->buf, in i2ctinyusb_transfer()
233 pmsg->len)) != pmsg->len) { in i2ctinyusb_transfer()
255 mtx_unlock(&sc->sc_mtx); in i2ctinyusb_transfer()
267 mtx_lock(&sc->sc_mtx); in i2ctinyusb_reset()
269 mtx_unlock(&sc->sc_mtx); in i2ctinyusb_reset()
294 .size = sizeof(struct i2ctinyusb_softc),