Changeset 1d1bb0f in mainline for uspace/drv/usbhid/usbhid.h
- Timestamp:
- 2011-06-19T13:38:37Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b72efe8
- Parents:
- adfdbd5 (diff), 9724d7f (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
radfdbd5 r1d1bb0f 46 46 #include <bool.h> 47 47 48 struct usb_hid_dev; 48 typedef struct usb_hid_dev usb_hid_dev_t; 49 typedef struct usb_hid_subdriver usb_hid_subdriver_t; 49 50 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 */ 57 typedef int (*usb_hid_driver_init_t)(usb_hid_dev_t *dev, void **data); 56 58 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 */ 64 typedef 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 */ 72 typedef 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 */ 81 typedef void (*usb_hid_driver_poll_ended_t)(usb_hid_dev_t *dev, void *data, 82 bool ended_due_to_errors); 83 84 struct usb_hid_subdriver { 58 85 /** Function to be called when initializing HID device. */ 59 86 usb_hid_driver_init_t init; … … 61 88 usb_hid_driver_deinit_t deinit; 62 89 /** Function to be called when data arrives from the device. */ 63 usb_hid_driver_poll poll;90 usb_hid_driver_poll_t poll; 64 91 /** Function to be called when polling ends. */ 65 usb_hid_driver_poll_ended poll_end;92 usb_hid_driver_poll_ended_t poll_end; 66 93 /** Arbitrary data needed by the subdriver. */ 67 94 void *data; 68 } usb_hid_subdriver_t;95 }; 69 96 70 97 /*----------------------------------------------------------------------------*/ … … 72 99 * Structure for holding general HID device data. 73 100 */ 74 typedefstruct usb_hid_dev {101 struct usb_hid_dev { 75 102 /** Structure holding generic USB device information. */ 76 103 usb_device_t *usb_dev; … … 94 121 usb_hid_report_t *report; 95 122 123 uint8_t report_id; 124 96 125 uint8_t *input_report; 97 126 … … 100 129 101 130 int report_nr; 102 } usb_hid_dev_t;131 }; 103 132 104 133 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.