OUT : Host computer --> USB device
IN : USB device --> Host computer
USB endpoint 의 종류
- CONTROL : (Asynchronous) control endpoint 는 USB device에 access하기 위해서 사용됨
- 예를 들어 configure device, retrieving information from device, sending command to the device, retrieving status reports about the device
- 모든 USB device 는 CONTROL에 해당하는 "endpoint 0"를 가짐
- USB device가 insert 될 때 사용됨
- guaranteed by the USB protocol
- INTERRUPT : (Periodic) transfer small amounts of data at a fixed rate every time
- ex) keyboard, mouse
- guaranteed by the USB protocol
- BULK : (Asynchronous) Bulk endpoints transfer large amounts of data
- Interrupt endpoint 보다는 많은 data를 가짐
- data loss 없이 많은 data를 전달하고자 할 때 사용됨
- data 양이 많을 때 multiple transfers로 나눠질 수도 있음
- ex) printer, storage, network devices
- ISOCHRONOUS : (Periodic) large amount of data 를 transfer 함, data 에 대한 guarantee가 없음
- device can handle loss of data, real-time 성 장치에 유리
- ex) audio, video 장치
Interrupt Transaction
- This function is queried by the host via a token packet,
- Return data if the has any interrupt related information to transfer, or NAK handshake if it doesn't
Bulk Transfers
- When the host wants to initiate a bulk transfer from a device, it sends a token packet specifying whether input or output is desired.
- (OUT) If the host wants input, the function in turn sends either a packet of data or a non-ACK handshake.
- (IN) If the host is sending a request to transmit, it will immediately send the data packet and wait for an appropriate handshake to be returned by the recipient.
Isochronous Transaction
- begin with an appropriate token packet being sent to the function,
- and then data is transmitted as required.
- Due to the assumed error-tolerance of isochronous data, no handshake packets are used.
void usb_host_handle_data(udev, p) @ hw/usb/host-libusb.c
switch (usb_ep_get_type(udev, p->pid, p->ep->nr)) {
case USB_ENDPOINT_XFER_BULK:
…
case USB_ENDPOINT_XFER_INT:
…
case USB_ENDPOINT_XFER_ISOC:
…
[3] http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_116_USB%20Data%20Structure.pdf