Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In order to save bandwidth, the host has the ability to silence a particular report in an interrupt IN endpoint by limiting the reporting frequency. The host sends the SET_IDLE request to realize this operation. The HID class implemented by Micrium contains an internal task responsible for respecting the reporting frequency limitation applying to one or several input reports.  shows Figure - Periodic Input Reports Task shows the periodic input reports tasks functioning.

Anchor
Figure - Periodic Input Reports Task
Figure - Periodic Input Reports Task

Panel
borderWidth0
titleFigure - Periodic Input Reports Task

Periodic Input Reports TaskImage Added


Panel
bgColor#f0f0f0

(1) The device receives a SET_IDLE request. This request specifies an idle duration for a given report ID. Refer to “Device Class Definition for Human Interface Devices (HID) Version 1.11”, section 7.2.4 for more details about the SET_IDLE request. A report ID allows you to distinguish among the different types of reports sent over the same endpoint.

(2) A report ID structure allocated during the HID class initialization phase is updated with the idle duration. An idle duration counter is initialized with the idle duration value. Then the report ID structure is inserted at the end of a linked list containing input reports ID structures. The idle duration value is expressed in 4-ms unit which gives a range of 4 to 1020 ms. If the idle duration is less than the interrupt IN endpoint polling interval, the reports are generated at the polling interval.

(3) Every 4 ms, the periodic input report task browses the input reports ID list. For each input report ID, the task performs one of two possible operations. The task period matches the 4-ms unit used for the idle duration. If no SET_IDLE requests have been sent by the host, the input reports ID list is empty and the task has nothing to process. The task processes only report IDs different from 0 and with an idle duration greater than 0.

(4) For a given input report ID, the task verifies if the idle duration has elapsed. If the idle duration has not elapsed, the counter is decremented and no input report is sent to the host.

(5) If the idle duration has elapsed, that is the idle duration counter has reached zero, an input report is sent to the host by calling the USBD_HID_Wr() function via the interrupt IN endpoint.

(6) The input report data sent by the task comes from an internal data buffer allocated for each input report described in the Report descriptor. An application task can call the USBD_HID_Wr() function to send an input report. After sending the input report data, USBD_HID_Wr() updates the internal buffer associated to an input report ID with the data just sent. Then, the periodic input reports task always sends the same input report data after each idle duration elapsed and until the application task updates the data in the internal buffer. There is some locking mechanism to avoid corruption of the input report ID data in the event of a modification happening at the exact time of transmission done by the periodic input report task.


The periodic input reports task is implemented in the HID OS layer in the function USBD_HID_OS_TmrTask(). Refer to the HID OS Functions reference for more details about this function.

...