Changeset e1dbcbc in mainline for uspace/drv/usbhid/usbhid.h


Ignore:
Timestamp:
2011-04-29T13:43:01Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a81a1d09
Parents:
380e0364 (diff), f19f1b7 (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 development/ changes

File:
1 edited

Legend:

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

    r380e0364 re1dbcbc  
    3434 */
    3535
    36 #ifndef USB_USBHID_H_
    37 #define USB_USBHID_H_
     36#ifndef USB_HID_USBHID_H_
     37#define USB_HID_USBHID_H_
    3838
    3939#include <stdint.h>
     
    4545#include <usb/classes/hid.h>
    4646
     47struct usb_hid_dev;
     48
     49typedef int (*usb_hid_driver_init_t)(struct usb_hid_dev *);
     50typedef void (*usb_hid_driver_deinit_t)(struct usb_hid_dev *);
     51typedef bool (*usb_hid_driver_poll)(struct usb_hid_dev *, uint8_t *, size_t);
     52typedef int (*usb_hid_driver_poll_ended)(struct usb_hid_dev *, bool reason);
     53
     54// TODO: add function and class name??
     55typedef struct usb_hid_subdriver {     
     56        /** Function to be called when initializing HID device. */
     57        usb_hid_driver_init_t init;
     58        /** Function to be called when destroying the HID device structure. */
     59        usb_hid_driver_deinit_t deinit;
     60        /** Function to be called when data arrives from the device. */
     61        usb_hid_driver_poll poll;
     62        /** Function to be called when polling ends. */
     63        usb_hid_driver_poll_ended poll_end;
     64} usb_hid_subdriver_t;
     65
    4766/*----------------------------------------------------------------------------*/
    4867/**
    4968 * Structure for holding general HID device data.
    5069 */
    51 typedef struct usb_hid_dev_t {
     70typedef struct usb_hid_dev {
    5271        /** Structure holding generic USB device information. */
    5372        usb_device_t *usb_dev;
     
    5978        int poll_pipe_index;
    6079       
    61         /** Function to be called when data arrives from the device. */
    62         usb_polling_callback_t poll_callback;
     80        /** Subdrivers. */
     81        usb_hid_subdriver_t *subdrivers;
     82       
     83        /** Number of subdrivers. */
     84        int subdriver_count;
    6385       
    6486        /** Report descriptor. */
     
    6991       
    7092        /** HID Report parser. */
    71         usb_hid_report_parser_t *parser;
     93        usb_hid_report_t *report;
    7294       
    7395        /** Arbitrary data (e.g. a special structure for handling keyboard). */
    7496        void *data;
    75        
    76         /** Type of the device (keyboard, mouse, generic HID device). */
    77         usb_hid_iface_protocol_t device_type;
    7897} usb_hid_dev_t;
    7998
     
    95114int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev);
    96115
     116bool usb_hid_polling_callback(usb_device_t *dev, uint8_t *buffer,
     117    size_t buffer_size, void *arg);
     118
    97119void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason,
    98120     void *arg);
    99121
    100 const char *usb_hid_get_function_name(usb_hid_iface_protocol_t device_type);
     122const char *usb_hid_get_function_name(const usb_hid_dev_t *hid_dev);
    101123
    102 const char *usb_hid_get_class_name(usb_hid_iface_protocol_t device_type);
     124const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev);
    103125
    104126void usb_hid_free(usb_hid_dev_t **hid_dev);
    105127
    106 #endif /* USB_USBHID_H_ */
     128#endif /* USB_HID_USBHID_H_ */
    107129
    108130/**
Note: See TracChangeset for help on using the changeset viewer.