DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

AN249 데이터 시트보기 (PDF) - Silicon Laboratories

부품명
상세내역
제조사
AN249
Silabs
Silicon Laboratories Silabs
AN249 Datasheet PDF : 42 Pages
1 2 3 4 5 6 7 8 9 10 Next Last
AN249
4.4.2. Two Transfer Types
Data traffic contained in HID reports can be transferred between device and host through one of two methods.
Reports travel across the “Control Pipe” when control endpoint transfers are initiated by host calls to the Windows
API functions, HidD_SetOutputReport(), HidD_GetInputReport(), HidD_GetFeatureReport(), and
HidD_SetFeatureReport(). Reports travel across the “Interrupt Pipe” when data is made available for transfer
across endpoints configured as Interrupt IN or Interrupt OUT. The next subsections examine Control Pipe and
Interrupt Pipe data transfers.
4.4.2.1. Control Transfers from the Perspective of the Host
The HID specification defines six HID-specific requests. For a complete list of HID-specific requests, see the
relevant section in the HID specification.
HidD_SetOutputReport() and HidD_GetInputReport() allow host applications to send and receive IN and
OUT reports. Parameters passed in with the call to HidD_SetOutputReport() include the handle to the HID
device, the buffer containing the report, and the number of bytes to transmit. Similarly, calls to
HidD_GetInputReport() require parameters for the handle to the HID device, a buffer where the incoming
report will be stored, and the number of packets that the system expects to receive. HidD_GetFeatureReport()
and HidDSetFeatureReport() receive and send Feature reports, which are bi-directional.
The API calls first send a packet to the control endpoint of the device that contains reserved command byte
corresponding to HidD_SetOutputReport() or HidD_GetInputReport(). In the case of the
HidD_SetOutputReport() command, the system then transmits a second packet containing the report. In the
case of the HidD_GetInputReport() command, the API transmits a second packet containing the Report ID of
the report the application wishes to retrieve. The host then expects the device to ready that packet for transmission
to the host, and the host makes an attempt to retrieve that packet.
4.4.2.2. Control Transfers from the Perspective of the Device
After the host initiates a control endpoint transfer, the device’s control endpoint handler parses the bytes of this
setup packet to determine what request has been transmitted to the device.
If a HidD_SetOutputReport() request has been transmitted to the device, the Report ID of the report to be
retrieved will be included as part of the setup packet. The device then transmits that report back to the host.
If a HidD_GetInputReport() request has been transmitted, the firmware switches the handler into
EP_GetReport mode. The host then transmits a report to the device. After the report has been transmitted, the
microcontroller signals firmware of the availability of the report, and the report can be retrieved from the buffer.
4.4.2.3. Interrupt Transfers from the Perspective of the Host
During enumeration, host system software learns about the interface of the attached USB device. After reception of
endpoint descriptors, the system polls any Endpoint configured as interrupt IN or interrupt OUT at an interval
defined in the Endpoint Descriptor.
To retrieve IN Endpoint reports transmitted across the interrupt pipe by the device after a poll from the host, the
application calls a Windows API function called Readfile(). This function requires parameters for the handle of
the device, a buffer to store the information, the number of bytes requested, and a variable where the number of
bytes successfully retrieved will be stored.
To transmit an OUT Endpoint Report across the Interrupt Pipe, an application calls the Windows API routine named
Writefile(), and passes into this function parameters including the device handle, a buffer containing the report
to be transmitted, the number of bytes to be transmitted, and a variable where the number of bytes successfully
transmitted will be stored.
4.4.3. Interrupt Transfers from the Perspective of the Device
Until a device has data to send across the IN endpoint, it should simply NAK the host’s polled requests for data by
not signaling that data is ready to be received. Once data has been collected into a report structure and placed
onto the IN endpoint’s buffer, firmware signals that data is ready to transmit.
When the host sends a packet across the OUT endpoint, the microcontroller signals the firmware and the OUT
Endpoint handler retrieves the bytes from the OUT Endpoint buffer.
Rev. 0.2
9

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]