Changeset f1fae414 in mainline for uspace/drv/bus/usb/usbhid/usbhid.h


Ignore:
Timestamp:
2011-06-22T01:34:53Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8d7e82c1, cac458f
Parents:
72ec8cc (diff), bf172825 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhid/usbhid.h

    r72ec8cc rf1fae414  
    4646#include <bool.h>
    4747
    48 struct usb_hid_dev;
     48typedef struct usb_hid_dev usb_hid_dev_t;
     49typedef struct usb_hid_subdriver usb_hid_subdriver_t;
    4950
    50 typedef int (*usb_hid_driver_init_t)(struct usb_hid_dev *, void **data);
    51 typedef void (*usb_hid_driver_deinit_t)(struct usb_hid_dev *, void *data);
    52 typedef bool (*usb_hid_driver_poll)(struct usb_hid_dev *, void *data, uint8_t *,
    53                                     size_t);
    54 typedef int (*usb_hid_driver_poll_ended)(struct usb_hid_dev *, void *data,
    55                                          bool reason);
     51/** Subdriver initialization callback.
     52 *
     53 * @param dev Backing USB HID device.
     54 * @param data Custom subdriver data (pointer where to store them).
     55 * @return Error code.
     56 */
     57typedef int (*usb_hid_driver_init_t)(usb_hid_dev_t *dev, void **data);
    5658
    57 typedef struct usb_hid_subdriver {     
     59/** Subdriver deinitialization callback.
     60 *
     61 * @param dev Backing USB HID device.
     62 * @param data Custom subdriver data.
     63 */
     64typedef void (*usb_hid_driver_deinit_t)(usb_hid_dev_t *dev, void *data);
     65
     66/** Subdriver callback on data from device.
     67 *
     68 * @param dev Backing USB HID device.
     69 * @param data Custom subdriver data.
     70 * @return Whether to continue polling (typically true always).
     71 */
     72typedef bool (*usb_hid_driver_poll_t)(usb_hid_dev_t *dev, void *data);
     73
     74/** Subdriver callback after communication with the device ceased.
     75 *
     76 * @param dev Backing USB HID device.
     77 * @param data Custom subdriver data.
     78 * @param ended_due_to_errors Whether communication ended due to errors in
     79 *      communication (true) or deliberately by driver (false).
     80 */
     81typedef void (*usb_hid_driver_poll_ended_t)(usb_hid_dev_t *dev, void *data,
     82    bool ended_due_to_errors);
     83
     84struct usb_hid_subdriver {
    5885        /** Function to be called when initializing HID device. */
    5986        usb_hid_driver_init_t init;
     
    6188        usb_hid_driver_deinit_t deinit;
    6289        /** Function to be called when data arrives from the device. */
    63         usb_hid_driver_poll poll;
     90        usb_hid_driver_poll_t poll;
    6491        /** Function to be called when polling ends. */
    65         usb_hid_driver_poll_ended poll_end;
     92        usb_hid_driver_poll_ended_t poll_end;
    6693        /** Arbitrary data needed by the subdriver. */
    6794        void *data;
    68 } usb_hid_subdriver_t;
     95};
    6996
    7097/*----------------------------------------------------------------------------*/
     
    7299 * Structure for holding general HID device data.
    73100 */
    74 typedef struct usb_hid_dev {
     101struct usb_hid_dev {
    75102        /** Structure holding generic USB device information. */
    76103        usb_device_t *usb_dev;
     
    94121        usb_hid_report_t *report;
    95122       
     123        uint8_t report_id;
     124       
    96125        uint8_t *input_report;
    97126       
     
    100129       
    101130        int report_nr;
    102 } usb_hid_dev_t;
     131};
    103132
    104133/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.