Package org.jnode.driver.bus.usb

Examples of org.jnode.driver.bus.usb.USBEndPoint


                log.info("*** Set transport protocol to SCM ATAPI");
            default:
                throw new DriverException("Transport protocol not implemented.");
        }

        USBEndPoint ep;
        for (int i = 0; i < intf.getNumEndPoints(); i++) {
            ep = this.usbInterface.getEndPoint(i);
            // Is it a bulk endpoint ?
            if ((ep.getDescriptor().getAttributes() & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) {
                // In or Out ?
                if ((ep.getDescriptor().getEndPointAddress() & USB_DIR_IN) == 0) {
                    this.bulkInEndPoint = ep;
                    log.info("*** Set bulk in endpoint");
                } else {
                    this.bulkOutEndPoint = ep;
                    log.info("*** Set bulk out endpoint");
                }
            } else if ((ep.getDescriptor().getAttributes() & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) {
                this.intrEndPoint = ep;
                log.info("*** Set interrupt endpoint");
            }
        }

View Full Code Here


        UsbBtDevice.setUsbDevice(dev);
        final USBConfiguration conf = dev.getConfiguration(0);
        final USBInterface intf = conf.getInterface(0);
        final InterfaceDescriptor iDesc = intf.getDescriptor();

        USBEndPoint bulkInEndpoint[] = new USBEndPoint[8];
        USBEndPoint bulkOutEndpoint[] = new USBEndPoint[8];
        USBEndPoint intrInEndpoint[] = new USBEndPoint[8];

        int num_bulk_in = 0;
        int num_bulk_out = 0;
        int num_bulk_intr = 0;

        USBEndPoint ep = null;

        for (int i = 0; i < iDesc.getNumEndPoints(); i++) {
            ep = intf.getEndPoint(i);
            // Is it a bulk endpoint ?
            if ((ep.getDescriptor().getAttributes() & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) {
                // In or Out ?
                if ((ep.getDescriptor().getEndPointAddress() & USB_DIR_IN) == 0) {
                    bulkInEndpoint[num_bulk_in] = ep;
                    num_bulk_in++;
                    log.debug("*** Set bulk in endpoint");
                } else {
                    bulkOutEndpoint[num_bulk_out] = ep;
                    num_bulk_out++;
                    log.debug("*** Set bulk out endpoint");
                }
            } else if ((ep.getDescriptor().getAttributes() & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) {
                intrInEndpoint[num_bulk_intr] = ep;
                num_bulk_intr++;
                log.debug("*** Set interrupt endpoint");
            }
        }
View Full Code Here

    public void createTDs(UHCIPipe pipe) {
        final USBPacket dataPacket = getDataPacket();
        int offset = 0;
        int length = dataPacket.getSize();
        final USBEndPoint ep = pipe.getEndPoint();
        final int dataPid = (ep.getDescriptor().isDirIn() ? USB_PID_IN : USB_PID_OUT);
        final int maxPacketSize = pipe.getMaxPacketSize();
        TransferDescriptor firstTD = null;

        while (length > 0) {

            // Create the TD for this part of the data packet
            final int curlen = Math.min(length, maxPacketSize);
            final TransferDescriptor dataTD;
            final boolean ioc = (curlen == length);
            dataTD = pipe.createTD(dataPid, ep.getDataToggle(), dataPacket.getData(), offset, curlen, ioc);
            // Add the TD to the list
            if (firstTD == null) {
                firstTD = dataTD;
            } else {
                firstTD.append(dataTD, false);
            }

            // Update fields
            ep.toggle();
            length -= curlen;
            offset += curlen;
        }
        this.firstTD = firstTD;
    }
View Full Code Here

TOP

Related Classes of org.jnode.driver.bus.usb.USBEndPoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.