Changeset 26d46d2 in mainline for uspace/drv/usbhid/usbhid.h
- Timestamp:
- 2011-04-10T22:33:27Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1a46610, fd153d3
- Parents:
- c6fe469 (diff), c7bdfa7 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhid/usbhid.h
rc6fe469 r26d46d2 34 34 */ 35 35 36 #ifndef USB_ USBHID_H_37 #define USB_ USBHID_H_36 #ifndef USB_HID_USBHID_H_ 37 #define USB_HID_USBHID_H_ 38 38 39 39 #include <stdint.h> … … 45 45 #include <usb/classes/hid.h> 46 46 47 struct usb_hid_dev; 48 49 typedef int (*usb_hid_driver_init_t)(struct usb_hid_dev *); 50 typedef void (*usb_hid_driver_deinit_t)(struct usb_hid_dev *); 51 typedef bool (*usb_hid_driver_poll)(struct usb_hid_dev *, uint8_t *, size_t); 52 typedef int (*usb_hid_driver_poll_ended)(struct usb_hid_dev *, bool reason); 53 54 // TODO: add function and class name?? 55 typedef 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 47 66 /*----------------------------------------------------------------------------*/ 48 67 /** 49 68 * Structure for holding general HID device data. 50 69 */ 51 typedef struct usb_hid_dev _t{70 typedef struct usb_hid_dev { 52 71 /** Structure holding generic USB device information. */ 53 72 usb_device_t *usb_dev; … … 59 78 int poll_pipe_index; 60 79 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; 63 85 64 86 /** Report descriptor. */ … … 73 95 /** Arbitrary data (e.g. a special structure for handling keyboard). */ 74 96 void *data; 75 76 /** Type of the device (keyboard, mouse, generic HID device). */77 usb_hid_iface_protocol_t device_type;78 97 } usb_hid_dev_t; 79 98 … … 95 114 int usb_hid_init(usb_hid_dev_t *hid_dev, usb_device_t *dev); 96 115 116 bool usb_hid_polling_callback(usb_device_t *dev, uint8_t *buffer, 117 size_t buffer_size, void *arg); 118 97 119 void usb_hid_polling_ended_callback(usb_device_t *dev, bool reason, 98 120 void *arg); 99 121 100 const char *usb_hid_get_function_name( usb_hid_iface_protocol_t device_type);122 const char *usb_hid_get_function_name(const usb_hid_dev_t *hid_dev); 101 123 102 const char *usb_hid_get_class_name( usb_hid_iface_protocol_t device_type);124 const char *usb_hid_get_class_name(const usb_hid_dev_t *hid_dev); 103 125 104 126 void usb_hid_free(usb_hid_dev_t **hid_dev); 105 127 106 #endif /* USB_ USBHID_H_ */128 #endif /* USB_HID_USBHID_H_ */ 107 129 108 130 /**
Note:
See TracChangeset
for help on using the changeset viewer.